model

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 7 Imported by: 10

Documentation

Index

Constants

View Source
const ClientVersion = "2" //increment on breaking changes to prevent old client access

Variables

View Source
var ErrNotFound = errors.New("not found")
View Source
var PermissionCheckFailed = errors.New("permission check failed")

Functions

This section is empty.

Types

type AdminLoadPermSearchRequest added in v0.0.27

type AdminLoadPermSearchRequest struct {
	PermissionSearchUrl string `json:"permission_search_url"`
	Token               string `json:"token"`
	TopicId             string `json:"topic_id"`           //topic as used in permissions-v2
	OverwriteExisting   bool   `json:"overwrite_existing"` //false -> skip known elements; true -> force state of permission-search
	DryRun              bool   `json:"dry_run"`            //true -> log changes without executing them
}

type ComputedPermissions added in v0.0.15

type ComputedPermissions struct {
	Id string `json:"id"`
	PermissionsMap
}

type GetOptions

type GetOptions struct {
	CheckPermission bool
	UserId          string
	GroupIds        []string
	RoleIds         []string
	Permissions     PermissionList
}

type GroupPermissions added in v0.0.7

type GroupPermissions struct {
	GroupName string `json:"group_name"`
	PermissionsMap
}

type ListOptions

type ListOptions struct {
	Limit  int64 // 0 -> unlimited
	Offset int64
	Ids    []string
}

func ListOptionsFromQuery

func ListOptionsFromQuery(q url.Values) (result ListOptions, err error)

type Permission added in v0.0.7

type Permission rune
const Administrate Permission = 'a' // user may delete resource; user may change resource rights (e.g. delete device)
const Execute Permission = 'x' //user may use the resource (e.g. cmd to device; read device data; read database)
const Read Permission = 'r' //user may read the resource (metadata)  (e.g. read device name)
const Write Permission = 'w' //user may write the resource (metadata)(e.g. rename device)

type PermissionList added in v0.0.7

type PermissionList []Permission

func PermissionListFromString added in v0.0.7

func PermissionListFromString(str string) (result PermissionList, err error)

func (PermissionList) Encode added in v0.0.7

func (this PermissionList) Encode() string

type PermissionsMap added in v0.0.7

type PermissionsMap struct {
	Read         bool `json:"read"`
	Write        bool `json:"write"`
	Execute      bool `json:"execute"`
	Administrate bool `json:"administrate"`
}

type Resource

type Resource struct {
	Id      string `json:"id"`
	TopicId string `json:"topic_id"`
	ResourcePermissions
}

type ResourcePermissions

type ResourcePermissions struct {
	UserPermissions  map[string]PermissionsMap `json:"user_permissions"`
	GroupPermissions map[string]PermissionsMap `json:"group_permissions"`
	RolePermissions  map[string]PermissionsMap `json:"role_permissions"`
}

func (ResourcePermissions) Valid

func (this ResourcePermissions) Valid() bool

type Topic

type Topic struct {
	Id string `json:"id"`

	PublishToKafkaTopic string `json:"publish_to_kafka_topic"`

	EnsureKafkaTopicInit                bool `json:"ensure_kafka_topic_init"`
	EnsureKafkaTopicInitPartitionNumber int  `json:"ensure_kafka_topic_init_partition_number"`

	LastUpdateUnixTimestamp int64 `json:"last_update_unix_timestamp"` //should be ignored by the user; is set by db

	DefaultPermissions ResourcePermissions `json:"default_permissions"`
}

func (Topic) Equal

func (this Topic) Equal(topic Topic) bool

func (Topic) Validate

func (this Topic) Validate() error

Jump to

Keyboard shortcuts

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