role

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package role implements the service layer functionality related to Tharsis roles. Roles allow a Tharsis subject to access resources offered by the API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRoleInput

type CreateRoleInput struct {
	Name        string
	Description string
	Permissions []permissions.Permission
}

CreateRoleInput is the input for creating a Role.

type DeleteRoleInput

type DeleteRoleInput struct {
	Role  *models.Role
	Force bool
}

DeleteRoleInput is the input for deleting a Role.

type GetRolesInput

type GetRolesInput struct {
	// Sort specifies the field to sort on and direction
	Sort *db.RoleSortableField
	// PaginationOptions supports cursor based pagination
	PaginationOptions *pagination.Options
	// RoleNamePrefix filters role list by roleName prefix
	RoleNamePrefix *string
}

GetRolesInput is the input for querying a list of roles.

type Service

type Service interface {
	GetAvailablePermissions(ctx context.Context) ([]string, error)
	GetRoleByID(ctx context.Context, id string) (*models.Role, error)
	GetRoleByName(ctx context.Context, name string) (*models.Role, error)
	GetRolesByIDs(ctx context.Context, idList []string) ([]models.Role, error)
	GetRoles(ctx context.Context, input *GetRolesInput) (*db.RolesResult, error)
	CreateRole(ctx context.Context, input *CreateRoleInput) (*models.Role, error)
	UpdateRole(ctx context.Context, input *UpdateRoleInput) (*models.Role, error)
	DeleteRole(ctx context.Context, input *DeleteRoleInput) error
}

Service implements all the functionality related to Roles.

func NewService

func NewService(
	logger logger.Logger,
	dbClient *db.Client,
	activityService activityevent.Service,
) Service

NewService creates an instance of Service

type UpdateRoleInput

type UpdateRoleInput struct {
	Role *models.Role
}

UpdateRoleInput is the input for updating a Role.

Jump to

Keyboard shortcuts

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