authorization

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 10, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EntityIDsKey   = "entity_ids"
	PrincipalIDKey = "principal_id"
	RoleKey        = "role"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizeMany

type AuthorizeMany struct {
	Meta `bson:",inline"`
	Comp `bson:",inline"`
	Core `bson:",inline"`
}

AuthorizeMany represents the payload to authorize multiple entities.

func NewAuthorizeMany

func NewAuthorizeMany(m Meta, c Comp, cr Core) *AuthorizeMany

type Comp

type Comp struct{}

func ApplyComp

func ApplyComp(c *Comp, modifiers ...CompOption) Comp

type CompOption

type CompOption = contract.CompOption[Comp]

type Core

type Core struct {
	EntityIDs   *[]contract.ID `json:"entity_ids" validate:"nnpt,nz"`
	PrincipalID *contract.ID   `json:"principal_id" validate:"nnpt,nz"`
	Role        *contract.Role `json:"role" validate:"nnpt,rolerange"`
}

func ApplyCore

func ApplyCore(c *Core, modifiers ...CoreOption) Core

func (*Core) GetEntityIDs

func (c *Core) GetEntityIDs() []contract.ID

func (*Core) GetPrincipalID

func (c *Core) GetPrincipalID() contract.ID

func (*Core) GetRole

func (c *Core) GetRole() contract.Role

func (*Core) SetEntityIDs

func (c *Core) SetEntityIDs(x []contract.ID)

func (*Core) SetPrincipalID

func (c *Core) SetPrincipalID(x contract.ID)

func (*Core) SetRole

func (c *Core) SetRole(x contract.Role)

type CoreOption

type CoreOption = contracti.CoreOption[Core]

func WithEntityIDs

func WithEntityIDs(x []contract.ID) CoreOption

func WithPrincipalID

func WithPrincipalID(x contract.ID) CoreOption

func WithRole

func WithRole(x contract.Role) CoreOption

type Meta

type Meta struct{}

func ApplyMeta

func ApplyMeta(m *Meta, modifiers ...MetaOption) Meta

type MetaOption

type MetaOption = contract.MetaOption[Meta]

Jump to

Keyboard shortcuts

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