Documentation ¶
Index ¶
- Variables
- type Permission
- func (p Permission) Action() (action string)
- func (p Permission) MarshalJSON() ([]byte, error)
- func (p Permission) Module() (module string)
- func (p Permission) Permission() string
- func (p Permission) Split() (string, string, string)
- func (p Permission) String() string
- func (p Permission) Subsystem() (subsystem string)
- func (p *Permission) UnmarshalJSON(b []byte) error
- type Permissions
Constants ¶
This section is empty.
Variables ¶
var ( // AllPermissions ... AllPermissions = Permissions{ UserCanCreate, UserCanCreateStaff, UserCanDeleteAsStranger, UserCanDeleteAsOwner, UserCanDeleteStaffAsStranger, UserCanDeleteStaffAsOwner, UserCanModifyAsStranger, UserCanModifyAsOwner, UserCanModifyStaffAsStranger, UserCanModifyStaffAsOwner, UserCanRetrieveAsOwner, UserCanRetrieveAsStranger, UserCanRetrieveStaffAsOwner, UserCanRetrieveStaffAsStranger, UserPermissionCanCreate, UserPermissionCanDelete, UserPermissionCanModify, UserPermissionCanRetrieve, PermissionCanCreate, PermissionCanDelete, PermissionCanModify, PermissionCanRetrieve, GroupCanCreate, GroupCanDelete, GroupCanModify, GroupCanRetrieve, GroupPermissionCanCreate, GroupPermissionCanDelete, GroupPermissionCanModify, GroupPermissionCanRetrieve, } )
Functions ¶
This section is empty.
Types ¶
type Permission ¶
type Permission string
Permission is a string that consist of subsystem, module/content type and an action.
const ( UserCanCreate Permission = "charon:user:can create" UserCanCreateStaff Permission = "charon:user:can create staff" UserCanDeleteAsStranger Permission = "charon:user:can delete as stranger" UserCanDeleteAsOwner Permission = "charon:user:can delete as owner" UserCanDeleteStaffAsStranger Permission = "charon:user:can delete staff as stranger" UserCanDeleteStaffAsOwner Permission = "charon:user:can delete staff as owner" UserCanModifyAsStranger Permission = "charon:user:can modify as stranger" UserCanModifyAsOwner Permission = "charon:user:can modify as owner" UserCanModifyStaffAsStranger Permission = "charon:user:can modify staff as stranger" UserCanModifyStaffAsOwner Permission = "charon:user:can modify staff as owner" UserCanRetrieveAsOwner Permission = "charon:user:can retrieve as owner" UserCanRetrieveAsStranger Permission = "charon:user:can retrieve as stranger" UserCanRetrieveStaffAsOwner Permission = "charon:user:can retrieve staff as owner" UserCanRetrieveStaffAsStranger Permission = "charon:user:can retrieve staff as stranger" UserPermissionCanCreate Permission = "charon:user_permission:can create" UserPermissionCanDelete Permission = "charon:user_permission:can delete" UserPermissionCanModify Permission = "charon:user_permission:can modify" UserPermissionCanRetrieve Permission = "charon:user_permission:can retrieve" UserPermissionCanCheckGrantingAsStranger Permission = "charon:user_permission:can check granting as a stranger" UserGroupCanCreate Permission = "charon:user_group:can create" UserGroupCanDelete Permission = "charon:user_group:can delete" UserGroupCanModify Permission = "charon:user_group:can modify" UserGroupCanRetrieve Permission = "charon:user_group:can retrieve" UserGroupCanCheckBelongingAsStranger Permission = "charon:user_group:can check belonging as a stranger" PermissionCanCreate Permission = "charon:permission:can create" PermissionCanDelete Permission = "charon:permission:can delete" PermissionCanModify Permission = "charon:permission:can modify" PermissionCanRetrieve Permission = "charon:permission:can retrieve" GroupCanCreate Permission = "charon:group:can create" GroupCanDelete Permission = "charon:group:can delete" GroupCanModify Permission = "charon:group:can modify" GroupCanRetrieve Permission = "charon:group:can retrieve" GroupPermissionCanCreate Permission = "charon:group_permission:can create" GroupPermissionCanDelete Permission = "charon:group_permission:can delete" GroupPermissionCanModify Permission = "charon:group_permission:can modify" GroupPermissionCanRetrieve Permission = "charon:group_permission:can retrieve" )
func (Permission) Action ¶
func (p Permission) Action() (action string)
Action is a handy wrapper for Split method, that just returns action.
func (Permission) MarshalJSON ¶
func (p Permission) MarshalJSON() ([]byte, error)
MarshalJSON implements json Marshaller interface.
func (Permission) Module ¶
func (p Permission) Module() (module string)
Module is a handy wrapper for Split method, that just returns module.
func (Permission) Permission ¶
func (p Permission) Permission() string
Permission implements Permission interface.
func (Permission) Split ¶
func (p Permission) Split() (string, string, string)
Split returns subsystem, module/content ty and action that describes single Permission.
func (Permission) String ¶
func (p Permission) String() string
String implements fmt.Stringer interface.
func (Permission) Subsystem ¶
func (p Permission) Subsystem() (subsystem string)
Subsystem is a handy wrapper for Split method, that just returns subsystem.
func (*Permission) UnmarshalJSON ¶
func (p *Permission) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json Unmarshaler interface.
type Permissions ¶
type Permissions []Permission
Permissions is collection of permission that provide convenient API.
func NewPermissions ¶
func NewPermissions(ss ...string) Permissions
NewPermissions allocates new Permissions using given slice of strings. It maps each string in a slice into Permission.
func (Permissions) Contains ¶
func (p Permissions) Contains(permissions ...Permission) bool
Contains returns true if given Permission exists in the collection. If none is provided returns false.
func (*Permissions) Set ¶ added in v0.4.2
func (p *Permissions) Set(s string) error
Set implements flag Value interface.
func (*Permissions) String ¶ added in v0.4.2
func (p *Permissions) String() string
String implements flag Value interface.
func (Permissions) Strings ¶
func (p Permissions) Strings() (s []string)
Strings maps Permissions into slice of strings.
Directories ¶
Path | Synopsis |
---|---|
Package charonrpc is a generated protocol buffer package.
|
Package charonrpc is a generated protocol buffer package. |
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0
|
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 |
cmd
|
|
charond
Package main is server implementation of Charon auth service.
|
Package main is server implementation of Charon auth service. |
example
|
|
internal
|
|
model
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0
|
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 |