role

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository interface {
	Count(ctx context.Context) (int64, error)
	GetAll(ctx context.Context) ([]*Role, error)
	GetPaginated(ctx context.Context, limit, offset int, sortBy []string) ([]*Role, error)
	GetByID(ctx context.Context, id int64) (*Role, error)
	CreateOrUpdate(ctx context.Context, role *Role) error
	Create(ctx context.Context, upload *Role) error
	Update(ctx context.Context, upload *Role) error
	Delete(ctx context.Context, id int64) error
}

type Role

type Role struct {
	ID          uint
	Name        string
	Description string
	Permissions []permission.Permission
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (*Role) AddPermission

func (r *Role) AddPermission(p permission.Permission) *Role

func (*Role) Can

func (r *Role) Can(perm permission.Permission) bool

func (*Role) ToGraph

func (r *Role) ToGraph() *model.Role

Jump to

Keyboard shortcuts

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