roles

package
v0.0.0-...-e341b83 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DisableAdvisoryLock     = false
	UseBlockingAdvisoryLock = true
)

Functions

func NewMockRoleDao

func NewMockRoleDao() *roleDaoMock

func NewRoleHandler

func NewRoleHandler(role RoleService, generic services.GenericService) *roleHandler

func PresentRole

func PresentRole(role *Role) openapi.Role

Types

type Role

type Role struct {
	api.Meta
	Name        string   `json:"name"         gorm:"uniqueIndex;not null"`
	DisplayName *string  `json:"display_name"`
	Description *string  `json:"description"`
	Permissions []string `json:"permissions"  gorm:"type:text;serializer:json"`
	BuiltIn     bool     `json:"built_in"     gorm:"default:false"`
}

func ConvertRole

func ConvertRole(role openapi.Role) *Role

func (*Role) BeforeCreate

func (d *Role) BeforeCreate(tx *gorm.DB) error

type RoleDao

type RoleDao interface {
	Get(ctx context.Context, id string) (*Role, error)
	Create(ctx context.Context, role *Role) (*Role, error)
	Replace(ctx context.Context, role *Role) (*Role, error)
	Delete(ctx context.Context, id string) error
	FindByIDs(ctx context.Context, ids []string) (RoleList, error)
	All(ctx context.Context) (RoleList, error)
}

func NewRoleDao

func NewRoleDao(sessionFactory *db.SessionFactory) RoleDao

type RoleIndex

type RoleIndex map[string]*Role

type RoleList

type RoleList []*Role

func (RoleList) Index

func (l RoleList) Index() RoleIndex

type RolePatchRequest

type RolePatchRequest struct {
	DisplayName *string  `json:"display_name,omitempty"`
	Description *string  `json:"description,omitempty"`
	Permissions []string `json:"permissions,omitempty"`
}

type RoleService

type RoleService interface {
	Get(ctx context.Context, id string) (*Role, *errors.ServiceError)
	Create(ctx context.Context, role *Role) (*Role, *errors.ServiceError)
	Replace(ctx context.Context, role *Role) (*Role, *errors.ServiceError)
	Delete(ctx context.Context, id string) *errors.ServiceError
	All(ctx context.Context) (RoleList, *errors.ServiceError)

	FindByIDs(ctx context.Context, ids []string) (RoleList, *errors.ServiceError)

	OnUpsert(ctx context.Context, id string) error
	OnDelete(ctx context.Context, id string) error
}

func NewRoleService

func NewRoleService(lockFactory db.LockFactory, roleDao RoleDao, events services.EventService) RoleService

func Service

func Service(s *environments.Services) RoleService

type ServiceLocator

type ServiceLocator func() RoleService

func NewServiceLocator

func NewServiceLocator(env *environments.Env) ServiceLocator

Jump to

Keyboard shortcuts

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