Documentation
¶
Overview ¶
Package accesstypes provides types for permissions, roles, and domains types for the access package
Index ¶
- Constants
- type Domain
- type Field
- type Permission
- type PermissionDetail
- type PermissionScope
- type ResolvedPermissions
- type ResolvedResourcePermissions
- type ResolvedTagPermissions
- type Resource
- type Role
- type RoleCollection
- type RolePermissionCollection
- type Tag
- type TagPermissions
- type User
- type UserPermissionCollection
Constants ¶
const GlobalDomain = Domain("global")
GlobalDomain is the domain used when a permission is applied at the Global level instead of to a specific domain.
const GlobalResource = Resource("global")
GlobalResource is the resource used when a permission is applied to the entire application, (i.e. Global level) instead of to a specific resource.
const NoopUser = "noop"
NoopUser is the user assigned to an empty role in casbin to ensure the role can be enumerated if no one else is assigned
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Domain ¶
type Domain string
Domain represents a domain in the authorization system
func UnmarshalDomain ¶
UnmarshalDomain unmarshals a domain string into a Domain type.
type Permission ¶
type Permission string
Permission represents a permission in the authorization system
const ( // NullPermission represents no permission NullPermission Permission = "" // Create is the create permission in CRUD Create Permission = "Create" // Read is the read permission in CRUD used to fetch single resource Read Permission = "Read" // List is the list permission used to fetch multiple resources List Permission = "List" // Update is the update permission in CRUD Update Permission = "Update" // Delete is the delete permission in CRUD Delete Permission = "Delete" // Execute is the execute permission used in RPC Execute Permission = "Execute" )
func UnmarshalPermission ¶
func UnmarshalPermission(permission string) Permission
UnmarshalPermission unmarshals a permission string into a Permission type.
func (Permission) Marshal ¶
func (p Permission) Marshal() string
Marshal marshals a Permission type into a string.
type PermissionDetail ¶
type PermissionDetail struct {
Description string
Scope PermissionScope
}
PermissionDetail is a struct that holds the description and scope of a permission
type PermissionScope ¶
type PermissionScope string
PermissionScope is the type use to define different scopes
const ( // GlobalPermissionScope is the permission scope for global permissions GlobalPermissionScope PermissionScope = "global" // DomainPermissionScope is the permission scope for domain permissions DomainPermissionScope PermissionScope = "domain" )
type ResolvedPermissions ¶ added in v0.2.5
type ResolvedPermissions struct {
Resources ResolvedResourcePermissions
Tags ResolvedTagPermissions
}
ResolvedPermissions is a struct that holds the resolved permissions for resources and tags.
type ResolvedResourcePermissions ¶ added in v0.2.5
type ResolvedResourcePermissions map[Domain]map[Resource]map[Permission]bool
ResolvedResourcePermissions is a mapping for each domain and resource of which permissions are rquired for the resource
type ResolvedTagPermissions ¶ added in v0.3.0
type ResolvedTagPermissions map[Domain]map[Resource]map[Tag]map[Permission]bool
ResolvedTagPermissions is a mapping for each domain and resource of which permissions are required for a Tag
type Resource ¶
type Resource string
Resource represents a resource in the authorization system
func UnmarshalResource ¶
UnmarshalResource unmarshals a resource string into a Resource type.
func (Resource) ResourceAndTag ¶ added in v0.3.0
ResourceAndTag splits the Resource name from the Tag name for a fully qualified field resource name
func (Resource) ResourceWithTag ¶ added in v0.3.0
ResourceWithTag returns the fully qualified resource name for the resource feild with tag
type Role ¶
type Role string
Role represents a role in the authorization system
func UnmarshalRole ¶
UnmarshalRole unmarshals a role string into a Role type.
type RoleCollection ¶
RoleCollection is a map of domain to roles defind in that domain
type RolePermissionCollection ¶
type RolePermissionCollection map[Permission][]Resource
RolePermissionCollection is a map of permissions a Role has on resources
type TagPermissions ¶ added in v0.5.0
type TagPermissions map[Tag][]Permission
TagPermissions is a map of Tags to a slice of permissions associated with the Tag
type User ¶
type User string
User represents a user in the authorization system
func UnmarshalUser ¶
UnmarshalUser unmarshals a user string into a User type.
type UserPermissionCollection ¶
type UserPermissionCollection map[Domain]map[Resource][]Permission
UserPermissionCollection is a mapping of permissions a user has for domain and resource