permission

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Permission

type Permission struct {
	PermissionID int    `db:"permission_id" json:"id"`
	Name         string `db:"name" json:"name"`
	Description  string `db:"description" json:"description"`
	Roles        int    `db:"roles" json:"roles"`
}

Permission represents relevant permission fields

type Repo added in v1.1.0

type Repo interface {
	GetPermissions(context.Context) ([]Permission, error)
	GetPermission(context.Context, Permission) (Permission, error)
	AddPermission(context.Context, Permission) (Permission, error)
	EditPermission(context.Context, Permission) (Permission, error)
	DeletePermission(context.Context, Permission) error
	RemovePermissionForRoles(context.Context, Permission) error
}

type Store

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

Store stores the dependencies

func NewPermissionRepo

func NewPermissionRepo(db *sqlx.DB) *Store

NewPermissionRepo stores our dependency

func (*Store) AddPermission

func (s *Store) AddPermission(ctx context.Context, p Permission) (Permission, error)

AddPermission returns all permissions of a user

func (*Store) DeletePermission

func (s *Store) DeletePermission(ctx context.Context, p Permission) error

DeletePermission deletes a permission

func (*Store) EditPermission

func (s *Store) EditPermission(ctx context.Context, p Permission) (Permission, error)

EditPermission returns all permissions of a user

func (*Store) GetPermission

func (s *Store) GetPermission(ctx context.Context, p Permission) (Permission, error)

GetPermission returns all permissions of a user

func (*Store) GetPermissions

func (s *Store) GetPermissions(ctx context.Context) ([]Permission, error)

GetPermissions returns all permissions of a user

func (*Store) RemovePermissionForRoles added in v1.0.0

func (s *Store) RemovePermissionForRoles(ctx context.Context, p Permission) error

RemovePermissionForRoles deletes a rolePermission

Directories

Path Synopsis
Package mock_permission is a generated GoMock package.
Package mock_permission is a generated GoMock package.

Jump to

Keyboard shortcuts

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