Documentation
¶
Overview ¶
Package authorizer is a hard coded package that contains the roles, actions, permissions and function related to ShellHub's API.
Index ¶
Constants ¶
View Source
const ( MemberRoleObserver = "observer" MemberRoleOperator = "operator" MemberRoleAdministrator = "administrator" MemberRoleOwner = "owner" )
View Source
const ( DeviceAccept = iota DeviceReject DeviceRemove DeviceConnect DeviceRename DeviceDetails SessionPlay SessionClose SessionRemove SessionDetails FirewallCreate FirewallEdit FirewallRemove PublicKeyCreate PublicKeyEdit PublicKeyRemove NamespaceRename NamespaceAddMember NamespaceRemoveMember NamespaceEditMember NamespaceEnableSessionRecord NamespaceDelete BillingChooseDevices BillingAddPaymentMethod BillingUpdatePaymentMethod BillingRemovePaymentMethod BillingCancelSubscription BillingCreateSubscription BillingGetPaymentMethod BillingGetSubscription )
Variables ¶
View Source
var Actions = actions{ Device: deviceActions{ Accept: DeviceAccept, Reject: DeviceReject, Remove: DeviceRemove, Connect: DeviceConnect, Rename: DeviceRename, }, Session: sessionActions{ Play: SessionPlay, Close: SessionClose, Remove: SessionRemove, Details: SessionDetails, }, Firewall: firewallActions{ Create: FirewallCreate, Edit: FirewallEdit, Remove: FirewallRemove, }, PublicKey: publicKeyActions{ Create: PublicKeyCreate, Edit: PublicKeyEdit, Remove: PublicKeyRemove, }, Namespace: namespaceActions{ Rename: NamespaceRename, AddMember: NamespaceAddMember, RemoveMember: NamespaceRemoveMember, EditMember: NamespaceEditMember, EnableSessionRecord: NamespaceEnableSessionRecord, Delete: NamespaceDelete, }, Billing: billingActions{ ChooseDevices: BillingChooseDevices, AddPaymentMethod: BillingAddPaymentMethod, UpdatePaymentMethod: BillingUpdatePaymentMethod, RemovePaymentMethod: BillingRemovePaymentMethod, CancelSubscription: BillingCancelSubscription, CreateSubscription: BillingCreateSubscription, GetSubscription: BillingGetSubscription, }, }
Actions has all available and allowed actions. You should use it to get the code's action.
Functions ¶
func CheckPermission ¶
CheckPermission checks if the user's role has the permission to execute an action.
func GetRoleCode ¶
GetRoleCode converts a member's role to an int.
Types ¶
type Permissions ¶
type Permissions []int
Click to show internal directories.
Click to hide internal directories.