guard

package
v0.0.0-...-e9665ab Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PermissionGroups = []PermissionGroup{
	{
		Name: "Account roles",
		Permissions: []Permission{
			{DisplayName: "View roles", Name: viewRoles},
			{DisplayName: "Create roles", Name: createRoles},
			{DisplayName: "Edit roles", Name: updateRoles},
			{DisplayName: "Delete roles", Name: deleteRoles},
		},
	},
	{
		Name: "Account users",
		Permissions: []Permission{
			{DisplayName: "View users", Name: viewUsers},
			{DisplayName: "Invite users", Name: inviteUsers},
			{DisplayName: "Activate users", Name: activateUsers},
			{DisplayName: "Change user roles", Name: changeRoles},
			{DisplayName: "Review 2FA resets", Name: reviewTOTPResets},
			{DisplayName: "Suspend users", Name: suspendUsers},
			{DisplayName: "Unsuspend users", Name: unsuspendUsers},
		},
	},
	{
		Name: "System",
		Permissions: []Permission{
			{DisplayName: "View system config", Name: viewConfig},
			{DisplayName: "Edit system config", Name: updateConfig},
		},
	},
}

Functions

This section is empty.

Types

type Account

type Account struct {
	*Passport
}

func (Account) CanActivateTOTP

func (a Account) CanActivateTOTP(userID string) bool

func (Account) CanActivateUsers

func (a Account) CanActivateUsers() bool

func (Account) CanAssignSuperRole

func (a Account) CanAssignSuperRole(userID string) bool

func (Account) CanChangePassword

func (a Account) CanChangePassword(userID string) bool

func (Account) CanChangeRoles

func (a Account) CanChangeRoles(userID string) bool

func (Account) CanChangeTOTPTel

func (a Account) CanChangeTOTPTel(userID string) bool

func (Account) CanChoosePassword

func (a Account) CanChoosePassword(userID string) bool

func (Account) CanCreateRoles

func (a Account) CanCreateRoles() bool

func (Account) CanDeleteRoles

func (a Account) CanDeleteRoles() bool

func (Account) CanDisableTOTP

func (a Account) CanDisableTOTP(userID string) bool

func (Account) CanInviteUsers

func (a Account) CanInviteUsers() bool

func (Account) CanRegenerateRecoveryCodes

func (a Account) CanRegenerateRecoveryCodes(userID string) bool

func (Account) CanResetPassword

func (a Account) CanResetPassword(userID string) bool

func (Account) CanResetTOTP

func (a Account) CanResetTOTP(userID string) bool

func (Account) CanReviewTOTPResets

func (a Account) CanReviewTOTPResets() bool

func (Account) CanSetupTOTP

func (a Account) CanSetupTOTP(userID string) bool

func (Account) CanSuspendUsers

func (a Account) CanSuspendUsers() bool

func (Account) CanUnsuspendUsers

func (a Account) CanUnsuspendUsers() bool

func (Account) CanUpdateRoles

func (a Account) CanUpdateRoles() bool

func (Account) CanVerifyTOTP

func (a Account) CanVerifyTOTP(userID string) bool

func (Account) CanViewRoles

func (a Account) CanViewRoles() bool

func (Account) CanViewUsers

func (a Account) CanViewUsers() bool

type Passport

type Passport struct {
	UserID      string
	IsSuper     bool
	Permissions []string

	Account Account
	System  System
}

func NewPassport

func NewPassport(user *account.User, superRoleID string) Passport

func (Passport) CanAccessAdmin

func (p Passport) CanAccessAdmin() bool

type Permission

type Permission struct {
	DisplayName string
	Name        string
}

type PermissionGroup

type PermissionGroup struct {
	Name        string
	Permissions []Permission
}

type System

type System struct {
	*Passport
}

func (System) CanUpdateConfig

func (s System) CanUpdateConfig() bool

func (System) CanViewConfig

func (s System) CanViewConfig() bool

func (System) CanViewMetrics

func (s System) CanViewMetrics() bool

Jump to

Keyboard shortcuts

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