roles

package
v1.1.0-alpha.4 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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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