Documentation
¶
Index ¶
- Variables
- type Service
- type ServiceWithLogging
- func (_d ServiceWithLogging) CreateDefaultRoles(ctx context.Context, orgSlug slug.Slug) (err error)
- func (_d ServiceWithLogging) CreateRoleWithPermissions(ctx context.Context, orgSlug slug.Slug, actor model.EventActor, ...) (op1 *model.OrgRole, err error)
- func (_d ServiceWithLogging) DeleteRole(ctx context.Context, orgSlug slug.Slug, roleSlug slug.Slug, ...) (err error)
- func (_d ServiceWithLogging) GetRole(ctx context.Context, orgSlug slug.Slug, roleSlug slug.Slug) (op1 *model.OrgRole, err error)
- func (_d ServiceWithLogging) GetUserPermissionsInOrg(ctx context.Context, orgSlug slug.Slug, userSlug slug.Slug) (ra1 []model.RolePermission, err error)
- func (_d ServiceWithLogging) ListRolePermissions(ctx context.Context, orgSlug slug.Slug, roleSlug slug.Slug) (ra1 []model.RolePermission, err error)
- func (_d ServiceWithLogging) ListRoles(ctx context.Context, orgSlug slug.Slug, req model.ListRequest, ...) (p1 model.ListResponse[model.OrgRole], err error)
- func (_d ServiceWithLogging) RestoreRole(ctx context.Context, orgSlug slug.Slug, roleSlug slug.Slug, ...) (err error)
- func (_d ServiceWithLogging) UpdateRoleWithPermissions(ctx context.Context, orgSlug slug.Slug, roleSlug slug.Slug, ...) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRoleNotFound = roles.ErrNotFound ErrRoleSlugAlreadyExists = roles.ErrSlugAlreadyExists ErrCannotDeleteDefaultRole = roles.ErrCannotDeleteSystemRole ErrUserNotMember = roles.ErrUserNotMember )
Re-exported from repository layer — single source of truth.
View Source
var ( ErrInvalidOrgSlug = xerror.InvalidInput(xerror.Organization) ErrInvalidRoleSlug = xerror.InvalidInput(xerror.Role) ErrCannotUpdateDefaultRole = xerror.CannotUpdateDefault(xerror.Role) ErrPermissionNotFound = xerror.NotFound(xerror.Permission) ErrPermissionAlreadyGranted = xerror.AlreadyExists(xerror.Permission) ErrInvalidInput = xerror.ValidationFailed() )
Service-only errors.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service interface {
CreateRoleWithPermissions(
ctx context.Context,
orgSlug slug.Slug,
actor model.EventActor,
newRole model.NewRole,
permissions []model.RolePermission,
) (*model.OrgRole, error)
CreateDefaultRoles(ctx context.Context, orgSlug slug.Slug) error
UpdateRoleWithPermissions(
ctx context.Context,
orgSlug, roleSlug slug.Slug,
actor model.EventActor,
update model.UpdateRole,
permissions []model.RolePermission,
) error
DeleteRole(ctx context.Context, orgSlug, roleSlug slug.Slug, actor model.EventActor) error
RestoreRole(ctx context.Context, orgSlug, roleSlug slug.Slug, actor model.EventActor) error
GetRole(ctx context.Context, orgSlug, roleSlug slug.Slug) (*model.OrgRole, error)
ListRoles(
ctx context.Context,
orgSlug slug.Slug,
req model.ListRequest,
includeDeleted bool,
onlyDeleted bool,
) (model.ListResponse[model.OrgRole], error)
GetUserPermissionsInOrg(
ctx context.Context,
orgSlug, userSlug slug.Slug,
) ([]model.RolePermission, error)
ListRolePermissions(
ctx context.Context,
orgSlug, roleSlug slug.Slug,
) ([]model.RolePermission, error)
}
func New ¶
func New( txm postgres.TransactionManager, rolesRepo roles.Repository, permissionsRepo permissions.Repository, eventProducer workerproducer.EventProducer, ) Service
New creates a new roles service.
type ServiceWithLogging ¶
type ServiceWithLogging struct {
// contains filtered or unexported fields
}
ServiceWithLogging implements Service with method completion logging.
func (ServiceWithLogging) CreateDefaultRoles ¶
CreateDefaultRoles implements Service.
func (ServiceWithLogging) CreateRoleWithPermissions ¶
func (_d ServiceWithLogging) CreateRoleWithPermissions(ctx context.Context, orgSlug slug.Slug, actor model.EventActor, newRole model.NewRole, permissions []model.RolePermission) (op1 *model.OrgRole, err error)
CreateRoleWithPermissions implements Service.
func (ServiceWithLogging) DeleteRole ¶
func (_d ServiceWithLogging) DeleteRole(ctx context.Context, orgSlug slug.Slug, roleSlug slug.Slug, actor model.EventActor) (err error)
DeleteRole implements Service.
func (ServiceWithLogging) GetRole ¶
func (_d ServiceWithLogging) GetRole(ctx context.Context, orgSlug slug.Slug, roleSlug slug.Slug) (op1 *model.OrgRole, err error)
GetRole implements Service.
func (ServiceWithLogging) GetUserPermissionsInOrg ¶
func (_d ServiceWithLogging) GetUserPermissionsInOrg(ctx context.Context, orgSlug slug.Slug, userSlug slug.Slug) (ra1 []model.RolePermission, err error)
GetUserPermissionsInOrg implements Service.
func (ServiceWithLogging) ListRolePermissions ¶
func (_d ServiceWithLogging) ListRolePermissions(ctx context.Context, orgSlug slug.Slug, roleSlug slug.Slug) (ra1 []model.RolePermission, err error)
ListRolePermissions implements Service.
func (ServiceWithLogging) ListRoles ¶
func (_d ServiceWithLogging) ListRoles(ctx context.Context, orgSlug slug.Slug, req model.ListRequest, includeDeleted bool, onlyDeleted bool) (p1 model.ListResponse[model.OrgRole], err error)
ListRoles implements Service.
func (ServiceWithLogging) RestoreRole ¶
func (_d ServiceWithLogging) RestoreRole(ctx context.Context, orgSlug slug.Slug, roleSlug slug.Slug, actor model.EventActor) (err error)
RestoreRole implements Service.
func (ServiceWithLogging) UpdateRoleWithPermissions ¶
func (_d ServiceWithLogging) UpdateRoleWithPermissions(ctx context.Context, orgSlug slug.Slug, roleSlug slug.Slug, actor model.EventActor, update model.UpdateRole, permissions []model.RolePermission) (err error)
UpdateRoleWithPermissions implements Service.
Click to show internal directories.
Click to hide internal directories.