model

package
v0.0.0-...-d841f61 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LineObjectTypeCRUD = "CRUD"
	LineObjectTypeRW   = "RW"
)
View Source
const (
	PermissionCreate = "create"
	PermissionRead   = "read"
	PermissionUpdate = "update"
	PermissionDelete = "delete"
	PermissionCan    = "can"
)

available permissions

View Source
const (
	PermissionBitmaskCreate = 8 // 0b1000
	PermissionBitmaskRead   = 4 // 0b0100
	PermissionBitmaskUpdate = 2 // 0b0010
	PermissionBitmaskDelete = 1 // 0b0001
	PermissionBitmaskCan    = 1 // 0b0001
)

bitmasks of available permissions

Variables

This section is empty.

Functions

This section is empty.

Types

type LineType

type LineType string
const (
	LineTypeObject  LineType = "action"
	LineTypeRole    LineType = "role"
	LineTypeSubject LineType = "user"
)

type Rbac

type Rbac struct {
	ID   string   `bson:"_id,omitempty"`
	Type LineType `bson:"crecord_type"`
	Name string   `bson:"crecord_name"`
	// ObjectType defines if object has can permission or CRUD permissions.
	ObjectType string `bson:"type,omitempty"`
	// Role is only for subject.
	Role string `bson:"role,omitempty"`
	// PermConfigList is only for role.
	PermConfigList map[string]struct {
		// Bitmask contains bitmask of CRUD permissions.
		Bitmask int `bson:"checksum"`
	} `bson:"rights,omitempty"`
	// Following fields contains extra data for subject.
	Email          string `bson:"mail,omitempty"`
	Lastname       string `bson:"lastname,omitempty"`
	Firstname      string `bson:"firstname,omitempty"`
	HashedPassword string `bson:"shadowpasswd,omitempty"`
	AuthApiKey     string `bson:"authkey,omitempty"`
	IsEnabled      bool   `bson:"enable,omitempty"`
	ExternalID     string `bson:"external_id,omitempty"`
	Source         string `bson:"source,omitempty"`
	Contact        struct {
		Name    string `bson:"name,omitempty"`
		Address string `bson:"address,omitempty"`
	} `bson:"contact,omitempty"`
}

Rbac represents mongo collection structure. Collection contains - objects with defined ID and Name fields - roles with defined ID, Name and PermConfigList fields - subjects with defined ID, Role and data fields

Jump to

Keyboard shortcuts

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