mrperms

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 5 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 {
	Caption string
	// contains filtered or unexported fields
}

func NewClientSection

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

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) DefaultRole

func (a *ModulesAccess) DefaultRole() 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
	DefaultRole   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

Jump to

Keyboard shortcuts

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