Documentation
¶
Index ¶
- Variables
- type AuditRecordRepository
- type Filter
- type PermissionService
- type RelationService
- type Repository
- type Role
- type Service
- func (s Service) Delete(ctx context.Context, id string) error
- func (s Service) Get(ctx context.Context, id string) (Role, error)
- func (s Service) List(ctx context.Context, f Filter) ([]Role, error)
- func (s Service) RemovePermissionFromRoles(ctx context.Context, slug string) error
- func (s Service) Update(ctx context.Context, toUpdate Role) (Role, error)
- func (s Service) Upsert(ctx context.Context, toCreate Role) (Role, error)
- type State
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AuditRecordRepository ¶ added in v0.78.0
type AuditRecordRepository interface {
Create(ctx context.Context, auditRecord models.AuditRecord) (models.AuditRecord, error)
}
type PermissionService ¶
type PermissionService interface {
Get(ctx context.Context, id string) (permission.Permission, error)
}
type RelationService ¶
type Repository ¶
type Repository interface {
Get(ctx context.Context, id string) (Role, error)
GetByName(ctx context.Context, orgID, name string) (Role, error)
List(ctx context.Context, f Filter) ([]Role, error)
Upsert(ctx context.Context, role Role) (Role, error)
Update(ctx context.Context, toUpdate Role) (Role, error)
Delete(ctx context.Context, roleID string) error
RemovePermissionFromRoles(ctx context.Context, slug string) error
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repository Repository, relationService RelationService, permissionService PermissionService, auditRecordRepository AuditRecordRepository, patDeniedPerms map[string]struct{}) *Service
func (Service) RemovePermissionFromRoles ¶ added in v0.107.0
RemovePermissionFromRoles removes a permission from every role's list. Called when a permission is deleted so no role keeps a permission that no longer exists.
It deliberately does not go through Update. Update deletes and recreates a role's entire set of permission tuples in SpiceDB (and writes an audit record), so every other permission the role keeps would get its tuples rewritten for no reason. All we need here is to drop one name from the list — a single small DB update that touches no SpiceDB tuples.
Click to show internal directories.
Click to hide internal directories.