Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExpandRolPermissions ¶
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