mongo

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const PermissionsEntryTimestampBson = "timestamp"

Variables

View Source
var CreateCollections = []func(db *Database) error{}
View Source
var PermissionsEntryBson = getBsonFieldObject[PermissionsEntry]()
View Source
var TopicBson = getBsonFieldObject[model.Topic]()

Functions

This section is empty.

Types

type Database

type Database struct {
	// contains filtered or unexported fields
}

func New

func New(conf configuration.Config) (*Database, error)

func (*Database) CheckMultipleResourcePermissions

func (this *Database) CheckMultipleResourcePermissions(ctx context.Context, topicId string, ids []string, userId string, groupIds []string, permissions string) (result map[string]bool, err error)

func (*Database) CheckResourcePermissions

func (this *Database) CheckResourcePermissions(ctx context.Context, topicId string, id string, userId string, groupIds []string, permissions string) (bool, error)

func (*Database) CreateId

func (this *Database) CreateId() string

func (*Database) DeleteResource

func (this *Database) DeleteResource(ctx context.Context, topicId string, id string) error

func (*Database) DeleteTopic

func (this *Database) DeleteTopic(ctx context.Context, id string) error

func (*Database) Disconnect

func (this *Database) Disconnect()

func (*Database) GetResource

func (this *Database) GetResource(ctx context.Context, topicId string, id string, options model.GetOptions) (resource model.Resource, err error)

func (*Database) GetTopic

func (this *Database) GetTopic(ctx context.Context, id string) (result model.Topic, exists bool, err error)

func (*Database) ListResourceIdsByPermissions

func (this *Database) ListResourceIdsByPermissions(ctx context.Context, topicId string, userId string, groupIds []string, permissions string, options model.ListOptions) ([]string, error)

func (*Database) ListResourcesByPermissions

func (this *Database) ListResourcesByPermissions(ctx context.Context, topicId string, userId string, groupIds []string, permissions string, listOptions model.ListOptions) (result []model.Resource, err error)

func (*Database) ListTopics

func (this *Database) ListTopics(ctx context.Context, listOptions model.ListOptions) (result []model.Topic, err error)

func (*Database) SetPermissions

func (this *Database) SetPermissions(ctx context.Context, topic string, id string, permissions model.ResourcePermissions, t time.Time) (err error)

func (*Database) SetResourcePermissions

func (this *Database) SetResourcePermissions(ctx context.Context, r model.Resource, t time.Time, preventOlderUpdates bool) (updateIgnored bool, err error)

func (*Database) SetTopic

func (this *Database) SetTopic(ctx context.Context, topic model.Topic) error

type PermissionsEntry

type PermissionsEntry struct {
	Timestamp     int64    `json:"timestamp"`
	TopicId       string   `json:"topic_id" bson:"topic_id"`
	Id            string   `json:"id" bson:"id"`
	AdminUsers    []string `json:"admin_users" bson:"admin_users"`
	AdminGroups   []string `json:"admin_groups" bson:"admin_groups"`
	ReadUsers     []string `json:"read_users" bson:"read_users"`
	ReadGroups    []string `json:"read_groups" bson:"read_groups"`
	WriteUsers    []string `json:"write_users" bson:"write_users"`
	WriteGroups   []string `json:"write_groups" bson:"write_groups"`
	ExecuteUsers  []string `json:"execute_users" bson:"execute_users"`
	ExecuteGroups []string `json:"execute_groups" bson:"execute_groups"`
}

func (*PermissionsEntry) ToResource

func (this *PermissionsEntry) ToResource() model.Resource

Jump to

Keyboard shortcuts

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