roles

package
v0.0.0-...-d6bc107 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Dotcom site admin
	RoleDotcomSiteAdmin = ToRole(services.Dotcom, "site_admin")
)

services.Dotcom

View Source
var (
	// Enterprise Portal customer admin
	RoleEnterprisePortalCustomerAdmin = ToRole(services.EnterprisePortal, "customer_admin")
)

services.EnterprisePortal

View Source
var (
	// SSC admin
	RoleSSCAdmin = ToRole(services.SSC, "admin")
)

services.SSC

View Source
var (
	RoleWorkspacesServiceAdmin = ToRole(services.Workspaces, "service_admin")
)

services.Workspaces

Functions

func ByResourceType

func ByResourceType() map[ResourceType][]Role

ByResourceType returns all allowed roles grouped by resource type.

func ByService

func ByService() map[services.Service][]Role

ByService returns all allowed roles grouped by service.

func Contains

func Contains(role Role) bool

Contains returns true if the role is in the list of allowed roles

func ServiceRolesByService

func ServiceRolesByService() map[services.Service][]Role

ServiceRolesByService returns all allowed service roles grouped by service.

func ToStrings

func ToStrings(roles []Role) []string

ToStrings converts a list of roles to a list of strings.

Types

type ResourceType

type ResourceType string

ResourceType is the type of resource that a role is associated with.

const (
	// Service type is a special type used for service level roles.
	Service ResourceType = "service"
	// Subscription resources for Enterprise Portal.
	EnterpriseSubscription ResourceType = "enterprise_subscription"
)

func ResourceTypes

func ResourceTypes() []ResourceType

ResourceTypes returns all allowed resource types.

func (ResourceType) DisplayName

func (r ResourceType) DisplayName() string

DisplayName returns the display name of the resource type.

func (ResourceType) IsService

func (r ResourceType) IsService() bool

IsService returns true if the resource type is a service. This is a special helper function as service level roles have special handling.

type Role

type Role string

Role is always the full qualified role name, e.g. "dotcom::site_admin".

func List

func List() []Role

List returns a list of all List

func ToRole

func ToRole(service services.Service, name string) Role

ToRole returns a role string in the format of "service::role", which comprises a fully qualified role name.

func ToRoles

func ToRoles(strings []string) []Role

ToRoles converts a list of strings to a list of roles. It does not validate each input value.

func (Role) ResourceType

func (r Role) ResourceType() ResourceType

ResourceType returns the resource type that the role is associated with. If the role is not registered, it returns "unknown".

func (Role) Service

func (r Role) Service() services.Service

Service returns the service that the role belongs to.

Jump to

Keyboard shortcuts

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