rolemanager

package
v0.0.0-...-39de395 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HighestPermissionsForRoles

func HighestPermissionsForRoles(rolesIDs []string, rm gimlet.RoleManager, opts gimlet.PermissionOpts) (gimlet.Permissions, error)

HighestPermissionsForRoles takes in a list of roles and returns an aggregated list of the highest levels for all permissions

func HighestPermissionsForRolesAndResourceType

func HighestPermissionsForRolesAndResourceType(roleIDs []string, resourceType string, rm gimlet.RoleManager) (map[string]gimlet.Permissions, error)

HighestPermissionsForResourceType takes a list of role IDs, a resource type, and a role manager and returns a mapping of all resource IDs for the given roles to their highest permissions based on those roles.

func MakeRoleWithPermissions

func MakeRoleWithPermissions(rm gimlet.RoleManager, resourceType string, resources []string, permissions gimlet.Permissions) (*gimlet.Role, error)

func NewInMemoryRoleManager

func NewInMemoryRoleManager() gimlet.RoleManager

func NewMongoBackedRoleManager

func NewMongoBackedRoleManager(opts MongoBackedRoleManagerOpts) gimlet.RoleManager

Types

type MongoBackedRoleManagerOpts

type MongoBackedRoleManagerOpts struct {
	Client          *mongo.Client
	DBName          string
	RoleCollection  string
	ScopeCollection string
}

type PermissionSummary

type PermissionSummary struct {
	Type        string                  `json:"type"`
	Permissions PermissionsForResources `json:"permissions"`
}

func PermissionSummaryForRoles

func PermissionSummaryForRoles(ctx context.Context, rolesIDs []string, rm gimlet.RoleManager) ([]PermissionSummary, error)

type PermissionsForResources

type PermissionsForResources map[string]gimlet.Permissions

Jump to

Keyboard shortcuts

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