roles

package
v1.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadRoleIDsFromContext

func ReadRoleIDsFromContext(ctx context.Context) (roleIDs []string, ok bool)

ReadRoleIDsFromContext extracts roleIDs from the metadata context and returns them as []string

Types

type Manager

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

Manager manages a cache of roles by fetching unknown roles from the settings.RoleService.

func NewManager

func NewManager(o ...Option) Manager

NewManager returns a new instance of Manager.

func (*Manager) FindPermissionByID

func (m *Manager) FindPermissionByID(ctx context.Context, roleIDs []string, permissionID string) *settingsmsg.Setting

FindPermissionByID searches for a permission-setting by the permissionID, but limited to the given roleIDs

func (*Manager) FindRoleIDsForUser

func (m *Manager) FindRoleIDsForUser(ctx context.Context, userID string) ([]string, error)

FindRoleIdsForUser returns all roles that are assigned to the supplied userid

func (*Manager) List

func (m *Manager) List(ctx context.Context, roleIDs []string) []*settingsmsg.Bundle

List returns all roles that match the given roleIDs.

type Option

type Option func(*Options)

Option mutates option

func Logger

func Logger(logger log.Logger) Option

Logger sets a preconfigured logger

func RoleService

func RoleService(rs settingssvc.RoleService) Option

RoleService provides endpoints for fetching roles.

func StoreOptions

func StoreOptions(storeOpts []store.Option) Option

StoreOptions are the options for the store

type Options

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

Options are all the possible options.

Jump to

Keyboard shortcuts

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