mongo

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: 15 Imported by: 0

Documentation

Index

Constants

View Source
const PermissionsEntrySyncedBson = "synced"
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) AdminListResourceIds added in v0.0.9

func (this *Database) AdminListResourceIds(ctx context.Context, topicId string, listOptions model.ListOptions) (result []string, err error)

func (*Database) AdminListResources added in v0.0.15

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

func (*Database) CheckMultipleResourcePermissions

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

func (*Database) CheckResourcePermissions

func (this *Database) CheckResourcePermissions(ctx context.Context, topicId string, id string, userId string, roleIds []string, groupIds []string, permissions ...model.Permission) (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, roleIds []string, groupIds []string, options model.ListOptions, permissions ...model.Permission) ([]string, error)

func (*Database) ListResourcesByPermissions

func (this *Database) ListResourcesByPermissions(ctx context.Context, topicId string, userId string, roleIds []string, groupIds []string, listOptions model.ListOptions, permissions ...model.Permission) (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) ListUnsyncedResources added in v0.0.16

func (this *Database) ListUnsyncedResources(ctx context.Context) (result []model.Resource, err error)

func (*Database) MarkResourceAsSynced added in v0.0.16

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

func (*Database) SetPermissions

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

func (*Database) SetResource added in v0.0.16

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

func (*Database) SetTopic

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

type PermissionsEntry

type PermissionsEntry struct {
	TopicId       string   `json:"topic_id" bson:"topic_id"`
	Id            string   `json:"id" bson:"id"`
	Timestamp     int64    `json:"timestamp" bson:"timestamp"`
	Synced        bool     `json:"synced" bson:"synced"`
	AdminUsers    []string `json:"admin_users" bson:"admin_users"`
	AdminGroups   []string `json:"admin_groups" bson:"admin_groups"`
	AdminRoles    []string `json:"admin_roles" bson:"admin_roles"`
	ReadUsers     []string `json:"read_users" bson:"read_users"`
	ReadGroups    []string `json:"read_groups" bson:"read_groups"`
	ReadRoles     []string `json:"read_roles" bson:"read_roles"`
	WriteUsers    []string `json:"write_users" bson:"write_users"`
	WriteGroups   []string `json:"write_groups" bson:"write_groups"`
	WriteRoles    []string `json:"write_roles" bson:"write_roles"`
	ExecuteUsers  []string `json:"execute_users" bson:"execute_users"`
	ExecuteGroups []string `json:"execute_groups" bson:"execute_groups"`
	ExecuteRoles  []string `json:"execute_roles" bson:"execute_roles"`
}

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