Documentation
¶
Index ¶
- Constants
- func AddUserToNamespace(ctx context.Context, role Role, id, user uuid.UUID) error
- func Register(roles ...Role)
- func RegisterManager(namespaceManager NamespaceManager)
- func RemoveUserFromNamespace(ctx context.Context, id, user uuid.UUID) error
- func SetRole(ctx context.Context, role Role, user uuid.UUID) error
- func UnsetRole(ctx context.Context, user uuid.UUID) error
- type Action
- type Evaluator
- type NamespaceManager
- type NamespaceRole
- type Policy
- type Resource
- type Role
Constants ¶
View Source
const ( // ActionAll matches any action ActionAll = Action("*") // ActionCreate should be used for creation actions ActionCreate = Action("create") // ActionRead should be used for reading actions ActionRead = Action("read") // ActionUpdate should be used for updating actions ActionUpdate = Action("update") // ActionDelete should be used for deletion actions ActionDelete = Action("delete") // ActionList should be used for listing actions ActionList = Action("list") // ResourceAll matches any resource ResourceAll = Resource("*") )
Variables ¶
This section is empty.
Functions ¶
func AddUserToNamespace ¶
AddUserToNamespace sets the role of a user in the given namespace
func RegisterManager ¶
func RegisterManager(namespaceManager NamespaceManager)
RegisterManager sets the global namespace manager
func RemoveUserFromNamespace ¶
RemoveUserFromNamespace removes the role of a user in the given namespace
Types ¶
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator implements a permissions evaluation engine
func WithNamespaceAndUser ¶
WithNamespaceAndUser initializes a policy evaluation engine for the given namespace
type NamespaceManager ¶
type NamespaceManager interface { // AddUserToNamespace sets the role of a user in the given namespace AddUserToNamespace(ctx context.Context, role Role, id, user uuid.UUID) error // RemoveUserFromNamespace removes the role of a user in the given namespace RemoveUserFromNamespace(ctx context.Context, id, user uuid.UUID) error // RolesFor is used in gathering all of the roles for both the global and given namespace for // a given user RolesFor(ctx context.Context, globalNamespace, namespace, user uuid.UUID) ([]NamespaceRole, error) }
NamespaceManager is the main storage interface for storing roles based off of namespaces (including the global namespace)
type NamespaceRole ¶
type NamespaceRole interface { // Namespace is the uuid of the namespace the role is associated with Namespace() uuid.UUID // Name is the name of the role initially registered with the global manager Name() string }
NamespaceRole is a storage interface that each manager should implement
Click to show internal directories.
Click to hide internal directories.