espocketbase

package module
v0.0.0-...-1f461a3 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 7 Imported by: 0

README

eventsoutcing_pocketbase

Documentation

Index

Constants

View Source
const FieldAdmin = "admin"
View Source
const UsersCollName = "users"
View Source
const UsersFieldAvatar = "avatar"
View Source
const UsersFieldEmail = "email"
View Source
const UsersFieldName = "name"
View Source
const UsersFieldUsername = "username"

Variables

This section is empty.

Functions

func AuthGlobalAdmin

func AuthGlobalAdmin(fieldAdmin string) string

func ToSnakeCase

func ToSnakeCase(str string) string

Types

type AuthorizationBuilder

type AuthorizationBuilder struct {
	CollectionName string
	FieldKey       string

	CollectionUsers           string
	CollectionUsersFieldAdmin string

	Roles []string

	AuthGlobalAdmin string
	AuthLoggedIn    string
	// contains filtered or unexported fields
}

func NewAuthorizationBuilder

func NewAuthorizationBuilder(collectionName string, fieldKey string, roles []string) (ret *AuthorizationBuilder)

func (*AuthorizationBuilder) AuthFieldFor

func (o *AuthorizationBuilder) AuthFieldFor(role string) string

func (*AuthorizationBuilder) CreateRule

func (o *AuthorizationBuilder) CreateRule() string

func (*AuthorizationBuilder) DeleteRule

func (o *AuthorizationBuilder) DeleteRule() string

func (*AuthorizationBuilder) Init

func (o *AuthorizationBuilder) Init()

func (*AuthorizationBuilder) ListRule

func (o *AuthorizationBuilder) ListRule() string

func (*AuthorizationBuilder) UpdateRule

func (o *AuthorizationBuilder) UpdateRule() (ret string)

func (*AuthorizationBuilder) ViewRule

func (o *AuthorizationBuilder) ViewRule() string

type ColBase

type ColBase struct {
	Env
	Coll *models.Collection
}

func (*ColBase) CheckOrInit

func (db *ColBase) CheckOrInit() (ret bool, err error)

type ColBaseAuth

type ColBaseAuth struct {
	*ColBase
	UsersColId  string
	AuthBuilder *AuthorizationBuilder
}

func NewCollectionBaseAuth

func NewCollectionBaseAuth(
	collectionName string, fieldKey string, usersColId string, roles []string, env Env) *ColBaseAuth

func (*ColBaseAuth) CheckOrInit

func (db *ColBaseAuth) CheckOrInit() (ret bool, err error)

type Collection

type Collection interface {
	CheckOrInit() (bool, error)
}

type Env

type Env interface {
	Dao() *daos.Dao
	IsRecreateDb() bool
	IsAuthDisabled() bool
}

type User

type User struct {
	Email    string `json:"email,omitempty"`
	Name     string `json:"name,omitempty"`
	Username string `json:"username,omitempty"`
	Admin    bool   `json:"admin,omitempty"`
}

type Users

type Users struct {
	*ColBase
}

func NewUsersDb

func NewUsersDb(env Env) *Users

func (*Users) CheckOrInit

func (db *Users) CheckOrInit() (ret bool, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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