Documentation ¶
Index ¶
- Variables
- func AddInheritance(role string, inherit ...string) error
- func AddPermission(role string, permission ...string) error
- func CheckPermission(role, perm string) error
- func CreateRole(aul *CreateRoleRequest) error
- func DeleteInheritance(role string, inherit ...string) error
- func DeletePermission(role string, permission ...string) error
- func DeleteRole(name string) error
- func GetDefaultRoleName() string
- func GetGuestRoleName() string
- func GetPermissionName(name string) string
- func GuestHasPermission(permission string) bool
- func HasPermission(role, permission string) bool
- func LoadRole(config *viper.Viper)
- func PermInterceptor(perm string) iris.Handler
- func RegisterPerm(name string, perm map[string]string)
- func SetDefaultRole(name string) error
- func SetGuestRole(name string) error
- func UpdateRole(name string, aul *UpdateRoleRequest) error
- type CreateRoleRequest
- type PermSet
- type PermissionJson
- type PermissionPersistence
- type Role
- type RoleInfo
- type RoleJson
- type RolePersistence
- func (s *RolePersistence) AddInheritance(role string, inherit ...string) error
- func (s *RolePersistence) AddPermission(role string, perms ...string) error
- func (s *RolePersistence) CreateRole(aul *CreateRoleRequest) (err error)
- func (s *RolePersistence) DeleteInheritance(role string, inherit ...string) error
- func (s *RolePersistence) DeletePermission(role string, permission ...string) error
- func (s *RolePersistence) DeleteRole(name string) error
- func (s *RolePersistence) GetAllRoles() (roles []*RoleJson)
- func (s *RolePersistence) GetDefaultRole() *RoleJson
- func (s *RolePersistence) GetGuestRole() *RoleJson
- func (s *RolePersistence) GetGuestRoleName() string
- func (s *RolePersistence) GetRole(name string) *RoleJson
- func (s *RolePersistence) GuestHasPermission(permission string) bool
- func (s *RolePersistence) HasPermission(role, permission string) bool
- func (s *RolePersistence) SetDefaultRole(name string) error
- func (s *RolePersistence) SetGuestRole(name string) (err error)
- func (s *RolePersistence) UpdateRole(name string, aul *UpdateRoleRequest) error
- type UpdateRoleRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var ( PermPO = &PermissionPersistence{ perm: make(map[string]string), } )
Functions ¶
func AddInheritance ¶
func AddPermission ¶
func CheckPermission ¶
func CreateRole ¶
func CreateRole(aul *CreateRoleRequest) error
func DeleteInheritance ¶
func DeletePermission ¶
func DeleteRole ¶
func GetDefaultRoleName ¶
func GetDefaultRoleName() string
func GetGuestRoleName ¶
func GetGuestRoleName() string
func GuestHasPermission ¶
func HasPermission ¶
func PermInterceptor ¶
func PermInterceptor(perm string) iris.Handler
func RegisterPerm ¶
func SetDefaultRole ¶
func SetGuestRole ¶
func UpdateRole ¶
func UpdateRole(name string, aul *UpdateRoleRequest) error
Types ¶
type CreateRoleRequest ¶
type PermissionJson ¶
func GetAllPermissions ¶
func GetAllPermissions() (perms []*PermissionJson)
type PermissionPersistence ¶
type PermissionPersistence struct {
// contains filtered or unexported fields
}
type RoleInfo ¶
type RoleInfo struct { Name string `mapstructure:"name" yaml:"name"` DisplayName string `mapstructure:"display_name" yaml:"display_name"` Default bool `mapstructure:"default" yaml:"default,omitempty"` Guest bool `mapstructure:"guest" yaml:"guest,omitempty"` Permissions []string `mapstructure:"permissions" yaml:"permissions"` Inheritance []string `mapstructure:"inheritance" yaml:"inheritance"` }
type RoleJson ¶
type RoleJson struct { Name string `json:"name"` DisplayName string `json:"display_name"` Default bool `json:"default"` Guest bool `json:"guest"` Permissions []*PermissionJson `json:"permissions,omitempty"` Inheritance []string `json:"inheritance,omitempty"` }
func GetAllRoles ¶
func GetAllRoles() []*RoleJson
func GetDefaultRole ¶
func GetDefaultRole() *RoleJson
func GetGuestRole ¶
func GetGuestRole() *RoleJson
type RolePersistence ¶
var (
RolePO *RolePersistence
)
func (*RolePersistence) AddInheritance ¶
func (s *RolePersistence) AddInheritance(role string, inherit ...string) error
func (*RolePersistence) AddPermission ¶
func (s *RolePersistence) AddPermission(role string, perms ...string) error
func (*RolePersistence) CreateRole ¶
func (s *RolePersistence) CreateRole(aul *CreateRoleRequest) (err error)
func (*RolePersistence) DeleteInheritance ¶
func (s *RolePersistence) DeleteInheritance(role string, inherit ...string) error
func (*RolePersistence) DeletePermission ¶
func (s *RolePersistence) DeletePermission(role string, permission ...string) error
func (*RolePersistence) DeleteRole ¶
func (s *RolePersistence) DeleteRole(name string) error
func (*RolePersistence) GetAllRoles ¶
func (s *RolePersistence) GetAllRoles() (roles []*RoleJson)
func (*RolePersistence) GetDefaultRole ¶
func (s *RolePersistence) GetDefaultRole() *RoleJson
func (*RolePersistence) GetGuestRole ¶
func (s *RolePersistence) GetGuestRole() *RoleJson
func (*RolePersistence) GetGuestRoleName ¶
func (s *RolePersistence) GetGuestRoleName() string
func (*RolePersistence) GetRole ¶
func (s *RolePersistence) GetRole(name string) *RoleJson
func (*RolePersistence) GuestHasPermission ¶
func (s *RolePersistence) GuestHasPermission(permission string) bool
func (*RolePersistence) HasPermission ¶
func (s *RolePersistence) HasPermission(role, permission string) bool
func (*RolePersistence) SetDefaultRole ¶
func (s *RolePersistence) SetDefaultRole(name string) error
func (*RolePersistence) SetGuestRole ¶
func (s *RolePersistence) SetGuestRole(name string) (err error)
func (*RolePersistence) UpdateRole ¶
func (s *RolePersistence) UpdateRole(name string, aul *UpdateRoleRequest) error
type UpdateRoleRequest ¶
type UpdateRoleRequest struct { DisplayName string `json:"display_name" validate:"required,lte=191"` Position uint `json:"position"` AddPermissions []string `json:"add_permissions"` DelPermissions []string `json:"del_permissions"` AddInheritance []string `json:"add_inheritance"` DelInheritance []string `json:"del_inheritance"` }
Click to show internal directories.
Click to hide internal directories.