Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
keeps the sortability of ulid and the randomness of uuid
func (*ID) MarshalText ¶
func (*ID) UnmarshalText ¶
type Permission ¶
type Permission string
Permission represents a permission prefix; it is used to check if a user has the permission to do something. It might be suffixed with a resource ID to check if the user has the permission to do something on a specific resource.
const ( // PermRoot has all permissions PermRoot Permission = "perm" // PermUserCreate is the permission to create a user PermUserCreate Permission = "perm:users:create" PermUserRead Permission = "perm:users:read" PermUserDelete Permission = "perm:users:delete" // PermSensorRead is the permission to read a sensor PermSensorRead Permission = "perm:sensors:read" PermSensorUpdate Permission = "perm:sensors:update" PermSensorDelete Permission = "perm:sensors:delete" // PermAlertsRead is the permission to read alerts PermAlertsRead Permission = "perm:alerts:read" // PermSensorsStateUpdate is the permission to update a sensor state PermSensorsStateUpdate Permission = "perm:sensors:state:update" )
func (Permission) Customize ¶
func (p Permission) Customize(resourceID string) Permission
type Permissions ¶
type Permissions []Permission
Permissions is a list of permissions
func FromString ¶
func FromString(s ...string) Permissions
func (Permissions) Can ¶
func (p Permissions) Can(permission ...Permission) error
func (Permissions) Has ¶
func (p Permissions) Has(permission ...Permission) bool
func (Permissions) Strings ¶
func (p Permissions) Strings() []string
Click to show internal directories.
Click to hide internal directories.