Documentation ¶
Index ¶
- Constants
- Variables
- type Authority
- func (a *Authority) AssignPermissionsToRole(roleSlug string, permSlugs []string) error
- func (a *Authority) AssignRoleToUser(userID interface{}, roleSlug string) error
- func (a *Authority) CheckRolePermission(roleSlug, permSlug string) (bool, error)
- func (a *Authority) CheckUserPermission(userID interface{}, roleSlug string) (bool, error)
- func (a *Authority) CheckUserRole(userID interface{}, roleSlug string) (bool, error)
- func (a *Authority) CreatePermission(p authority.Permission) error
- func (a *Authority) CreateRole(r authority.Role) error
- type ServiceProvider
Constants ¶
const Binding = "agomezguru.authority"
Variables ¶
var App foundation.Application
Functions ¶
This section is empty.
Types ¶
type Authority ¶
type Authority struct {
// contains filtered or unexported fields
}
func (*Authority) AssignPermissionsToRole ¶ added in v0.0.2
Assigns a group of permissions to a given role it accepts the role slug as the first parameter, the second parameter is a slice of permission slugs (strings) to be assigned to the role. It returns an error in case of any. It returns an error in case the role does not exists. It returns an error in case any of the permissions does not exists. It returns an error in case any of the permissions is already assigned
func (*Authority) AssignRoleToUser ¶ added in v0.0.2
Assigns a role to a given user it accepts the user id as the first parameter the second parameter the role slug. It returns an error in case of any. It returns an error in case the role does not exists. It returns an error in case the role is already assigned
func (*Authority) CheckRolePermission ¶ added in v0.0.2
Checks if a permission is assigned to a role, it accepts in the role slug as the first parameter. The second parameter, the permission slug. It returns two parameters: the first parameter of the return is a boolean represents whether the permission is assigned or not; the second is an error in case of any. In case the role does not exists, an error is returned. in case the permission does not exists, an error is returned
func (*Authority) CheckUserPermission ¶ added in v0.0.2
Checks if a permission is assigned to a user it accepts in the user id as the first parameter, the second parameter the role slug. It returns two parameters: the first parameter of the return is a boolean represents whether the role is assigned or not, the second is an error in case of any In case the role does not exists, an error is returned
func (*Authority) CheckUserRole ¶ added in v0.0.2
Checks if a role is assigned to a user it accepts the user id as the first parameter the second parameter the role slug. It returns two parameters the first parameter of the return is a boolean represents whether the role is assigned or not. The second is an error in case of any. In case the role does not exists, an error is returned
func (*Authority) CreatePermission ¶ added in v0.0.2
func (a *Authority) CreatePermission(p authority.Permission) error
Add a new permission to the database it accepts the Permission struct as a parameter it returns an error in case of any it returns an error if the permission is already exists
type ServiceProvider ¶
type ServiceProvider struct { }
func (*ServiceProvider) Boot ¶
func (receiver *ServiceProvider) Boot(app foundation.Application)
func (*ServiceProvider) Register ¶
func (receiver *ServiceProvider) Register(app foundation.Application)