Documentation
¶
Index ¶
- Constants
- type Action
- type Permissions
- func (p *Permissions) AddGroup(uuid string, grouplist ...string) (err error)
- func (p *Permissions) Can(uuid, id string, action Action) (can bool)
- func (p *Permissions) Close() (err error)
- func (p *Permissions) Get(id, group string) (actions Action)
- func (p *Permissions) Groups(uuid string) (gs []string, err error)
- func (p *Permissions) Has(id, group string) (ok bool)
- func (p *Permissions) RemoveGroup(uuid string, grouplist ...string) (err error)
- func (p *Permissions) SetPermissions(id, group string, actions Action) (err error)
Constants ¶
View Source
const ( // ErrInvalidActions is returned when an invalid permissions value is attempted to be set ErrInvalidActions = errors.Error("invalid permissions, please see constant block for reference") // ErrPermissionsUnchanged is returned when matching permissions are set for a resource ErrPermissionsUnchanged = errors.Error("permissions match, unchanged") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Permissions ¶
type Permissions struct {
// contains filtered or unexported fields
}
Permissions manages permissions
func New ¶
func New(dir string) (pp *Permissions, err error)
New will return a new instance of Permissions
func (*Permissions) AddGroup ¶
func (p *Permissions) AddGroup(uuid string, grouplist ...string) (err error)
AddGroup will add a group to a uuid
func (*Permissions) Can ¶
func (p *Permissions) Can(uuid, id string, action Action) (can bool)
Can will return if a user (UUID) can perform a given action on a provided resource id
func (*Permissions) Get ¶
func (p *Permissions) Get(id, group string) (actions Action)
Get will get the permissions for a given group for a resource id
func (*Permissions) Groups ¶
func (p *Permissions) Groups(uuid string) (gs []string, err error)
Groups will return a slice of the groups a user belongs to
func (*Permissions) Has ¶
func (p *Permissions) Has(id, group string) (ok bool)
Has will return whether or not an ID has a particular group associated with it
func (*Permissions) RemoveGroup ¶
func (p *Permissions) RemoveGroup(uuid string, grouplist ...string) (err error)
RemoveGroup will remove a group to a uuid
func (*Permissions) SetPermissions ¶
func (p *Permissions) SetPermissions(id, group string, actions Action) (err error)
SetPermissions will set the permissions for a given group for a resource id
Click to show internal directories.
Click to hide internal directories.