xroles

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpandRolPermissions

type ExpandRolPermissions = func(permissionsOrRoles []string) []string

ExpandRolPermissions returns the given permissions and roles expanded to its corresponding permissions. allPermissions by role are provided by RolesRepository Roles are expanded recursively.

func NewRolePermissionsExpander

func NewRolePermissionsExpander(rolesRepository RolesRepository) ExpandRolPermissions

NewRolePermissionsExpander returns a function that returns the given permissions and roles expanded to its corresponding permissions. allPermissions by role are provided by RolesRepository

type InMemoryRolesRepository

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

func NewInMemoryRolesRepository

func NewInMemoryRolesRepository(rolesPermissions map[string][]string) *InMemoryRolesRepository

NewInMemoryRolesRepository returns a new InMemoryRolesRepository whose roles are defined by the given map. The map keys are the role names and the values are the permissions for that role.

func (InMemoryRolesRepository) FindByRole

func (i InMemoryRolesRepository) FindByRole(role string) ([]string, bool)

type RolesRepository

type RolesRepository interface {
	// FindByRole returns the permissions for the given role and true if the role exists.
	// If the role does not exist, it returns an empty slice and false.
	FindByRole(role string) ([]string, bool)
}

RolesRepository provides roles and their corresponding permissions

Jump to

Keyboard shortcuts

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