authorizer

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 1 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Permission

type Permission int
const (
	DeviceAccept Permission = iota
	DeviceReject
	DeviceUpdate
	DeviceRemove
	DeviceConnect
	DeviceRename
	DeviceDetails
	DeviceCreateTag
	DeviceUpdateTag
	DeviceRemoveTag
	DeviceRenameTag
	DeviceDeleteTag

	SessionPlay
	SessionClose
	SessionRemove
	SessionDetails

	FirewallCreate
	FirewallEdit
	FirewallRemove
	FirewallAddTag
	FirewallRemoveTag
	FirewallUpdateTag

	PublicKeyCreate
	PublicKeyEdit
	PublicKeyRemove
	PublicKeyAddTag
	PublicKeyRemoveTag
	PublicKeyUpdateTag

	NamespaceUpdate
	NamespaceAddMember
	NamespaceRemoveMember
	NamespaceEditMember
	NamespaceEnableSessionRecord
	NamespaceDelete

	BillingCreateCustomer
	BillingChooseDevices
	BillingAddPaymentMethod
	BillingUpdatePaymentMethod
	BillingRemovePaymentMethod
	BillingCancelSubscription
	BillingCreateSubscription
	BillingGetPaymentMethod
	BillingGetSubscription

	APIKeyCreate
	APIKeyUpdate
	APIKeyDelete
)

type Role

type Role string

Role defines a user access level.

const (
	// RoleInvalid represents an invalid role. Any operation with this role will
	// be rejected.
	RoleInvalid Role = ""
	// RoleObserver represents a namespace observer. An observer can only connect to a
	// device and retrieve device and session details.
	RoleObserver Role = "observer"
	// RoleOperator represents a namespace operator. An operator has only device-related
	// permissions, excluding the [DeviceRemove] permission. An operator also has the
	// [SessionDetails] permission.
	RoleOperator Role = "operator"
	// RoleAdministrator represents a namespace administrator. An administrator has
	// similar permissions to [RoleOwner] but cannot delete the namespace. They also do
	// not have permission for any billing-related actions.
	RoleAdministrator Role = "administrator"
	// RoleOwner represents a namespace owner. The owner has all permissions.
	RoleOwner Role = "owner"
)

func RoleFromString

func RoleFromString(str string) Role

RoleFromString returns the Role corresponding to the given string. If the string is not a valid role, it returns RoleInvalid.

func (Role) HasAuthority

func (r Role) HasAuthority(passive Role) bool

HasAuthority reports whether the role r has greater or equal authority compared to the passive role. It always returns false if either role is invalid or if the passive role is RoleOwner.

func (Role) HasPermission

func (r Role) HasPermission(permission Permission) bool

HasPermission reports whether the role r has the specified permission.

func (Role) Permissions

func (r Role) Permissions() []Permission

Permissions returns all permissions associated with the role r. If the role is RoleInvalid, it returns an empty slice.

func (Role) String

func (r Role) String() string

String converts the given role to its corresponding string. If the string is not a valid role, it returns "N/A".

Jump to

Keyboard shortcuts

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