permissions

package
v0.2.0-rc.24-linux-arm64 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: Apache-2.0 Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidInput = xerror.ValidationFailed()

Functions

This section is empty.

Types

type AddToRoleParams

type AddToRoleParams struct {
	OrgSlug  slug.Slug
	RoleSlug slug.Slug
	Resource string
	Action   string
}

type ClearRolePermissionsParams

type ClearRolePermissionsParams struct {
	OrgSlug  slug.Slug
	RoleSlug slug.Slug
}

type CreateParams

type CreateParams struct {
	Resource string
	Action   string
}

type Permission

type Permission struct {
	Resource string
	Action   string
}

type RemoveFromRoleParams

type RemoveFromRoleParams struct {
	OrgSlug  slug.Slug
	RoleSlug slug.Slug
	Resource string
	Action   string
}

type Repository

type Repository interface {
	Create(ctx context.Context, tx postgres.DBTX, params *CreateParams) (*Permission, error)
	FindOrCreate(
		ctx context.Context,
		tx postgres.DBTX,
		resources, actions []string,
	) ([]*Permission, error)
	ListAll(ctx context.Context, tx postgres.DBTX) ([]*Permission, error)
	ListForRole(
		ctx context.Context,
		tx postgres.DBTX,
		orgSlug, roleSlug slug.Slug,
	) ([]*Permission, error)
	AddToRole(ctx context.Context, tx postgres.DBTX, params *AddToRoleParams) error
	RemoveFromRole(ctx context.Context, tx postgres.DBTX, params *RemoveFromRoleParams) error
	ClearRolePermissions(
		ctx context.Context,
		tx postgres.DBTX,
		params *ClearRolePermissionsParams,
	) error
}

func NewRepository

func NewRepository() Repository

func NewRepositoryWithLogging

func NewRepositoryWithLogging(base Repository, logger *slog.Logger) Repository

NewRepositoryWithLogging wraps base with method completion logging.

type RepositoryWithLogging

type RepositoryWithLogging struct {
	// contains filtered or unexported fields
}

RepositoryWithLogging implements Repository with method completion logging.

func (RepositoryWithLogging) AddToRole

func (_d RepositoryWithLogging) AddToRole(ctx context.Context, tx postgres.DBTX, params *AddToRoleParams) (err error)

AddToRole implements Repository.

func (RepositoryWithLogging) ClearRolePermissions

func (_d RepositoryWithLogging) ClearRolePermissions(ctx context.Context, tx postgres.DBTX, params *ClearRolePermissionsParams) (err error)

ClearRolePermissions implements Repository.

func (RepositoryWithLogging) Create

func (_d RepositoryWithLogging) Create(ctx context.Context, tx postgres.DBTX, params *CreateParams) (pp1 *Permission, err error)

Create implements Repository.

func (RepositoryWithLogging) FindOrCreate

func (_d RepositoryWithLogging) FindOrCreate(ctx context.Context, tx postgres.DBTX, resources []string, actions []string) (ppa1 []*Permission, err error)

FindOrCreate implements Repository.

func (RepositoryWithLogging) ListAll

func (_d RepositoryWithLogging) ListAll(ctx context.Context, tx postgres.DBTX) (ppa1 []*Permission, err error)

ListAll implements Repository.

func (RepositoryWithLogging) ListForRole

func (_d RepositoryWithLogging) ListForRole(ctx context.Context, tx postgres.DBTX, orgSlug slug.Slug, roleSlug slug.Slug) (ppa1 []*Permission, err error)

ListForRole implements Repository.

func (RepositoryWithLogging) RemoveFromRole

func (_d RepositoryWithLogging) RemoveFromRole(ctx context.Context, tx postgres.DBTX, params *RemoveFromRoleParams) (err error)

RemoveFromRole implements Repository.

Jump to

Keyboard shortcuts

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