mrperms

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientSection

type ClientSection struct {
	// contains filtered or unexported fields
}

func NewClientSection

func NewClientSection(caption, rootPath, priv string, access *ModulesAccess) *ClientSection

func (*ClientSection) Caption

func (s *ClientSection) Caption() string

func (*ClientSection) MiddlewareWithPermission

func (s *ClientSection) MiddlewareWithPermission(name string, next mrcore.HttpHandlerFunc) mrcore.HttpHandlerFunc

func (*ClientSection) Path

func (s *ClientSection) Path(actionPath string) string

type ModulesAccess

type ModulesAccess struct {
	// contains filtered or unexported fields
}

func NewModulesAccess

func NewModulesAccess(opt ModulesAccessOptions) (*ModulesAccess, error)

func (*ModulesAccess) CheckPermission

func (a *ModulesAccess) CheckPermission(rolesIDs []int32, name string) bool

func (*ModulesAccess) CheckPrivilege

func (a *ModulesAccess) CheckPrivilege(rolesIDs []int32, name string) bool

func (*ModulesAccess) GuestRole added in v0.8.0

func (a *ModulesAccess) GuestRole() string

func (*ModulesAccess) NewRoleGroup

func (a *ModulesAccess) NewRoleGroup(roles []string) *RoleGroup

func (*ModulesAccess) RegisteredPermissions

func (a *ModulesAccess) RegisteredPermissions() []string

func (*ModulesAccess) RegisteredPrivileges

func (a *ModulesAccess) RegisteredPrivileges() []string

func (*ModulesAccess) RegisteredRoles

func (a *ModulesAccess) RegisteredRoles() []string

type ModulesAccessOptions

type ModulesAccessOptions struct {
	RolesDirPath  string
	RolesFileType string
	Roles         []string
	Privileges    []string
	Permissions   []string
	GuestRole     string // optional
}

type RoleGroup

type RoleGroup struct {
	// contains filtered or unexported fields
}

func (*RoleGroup) CheckPermission

func (g *RoleGroup) CheckPermission(name string) bool

func (*RoleGroup) CheckPrivilege

func (g *RoleGroup) CheckPrivilege(name string) bool

func (*RoleGroup) IsAuthorized added in v0.8.0

func (g *RoleGroup) IsAuthorized() bool

IsAuthorized - авторизован тогда, когда несколько ролей или роль одна и она не равна гостевой роли

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL