Documentation ¶
Index ¶
- func FindAllowedResources(ctx context.Context, rm gimlet.RoleManager, roles []string, ...) ([]string, error)
- func HighestPermissionsForRoles(rolesIDs []string, rm gimlet.RoleManager, opts gimlet.PermissionOpts) (gimlet.Permissions, error)
- func HighestPermissionsForRolesAndResourceType(roleIDs []string, resourceType string, rm gimlet.RoleManager) (map[string]gimlet.Permissions, error)
- func MakeRoleWithPermissions(rm gimlet.RoleManager, resourceType string, resources []string, ...) (*gimlet.Role, error)
- func NewInMemoryRoleManager() gimlet.RoleManager
- func NewMongoBackedRoleManager(opts MongoBackedRoleManagerOpts) gimlet.RoleManager
- type MongoBackedRoleManagerOpts
- type PermissionSummary
- type PermissionsForResources
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindAllowedResources ¶
func FindAllowedResources(ctx context.Context, rm gimlet.RoleManager, roles []string, resourceType, requiredPermission string, requiredLevel int) ([]string, error)
FindAllowedResources takes a list of roles and a permission to check in those roles. It returns a list of all resources that the given roles have access to with the given permission check. It answers the question "Given this list of roles (likely from a single user), what resources can they access, given this permission check?"
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 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