Documentation
¶
Overview ¶
Package assignment 赋权命令应用服务
Package assignment 赋权查询应用服务
Index ¶
- type AssignmentCommandService
- func (s *AssignmentCommandService) Grant(ctx context.Context, cmd assignmentDomain.GrantCommand) (*assignmentDomain.Assignment, error)
- func (s *AssignmentCommandService) Revoke(ctx context.Context, cmd assignmentDomain.RevokeCommand) error
- func (s *AssignmentCommandService) RevokeByID(ctx context.Context, cmd assignmentDomain.RevokeByIDCommand) error
- type AssignmentQueryService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssignmentCommandService ¶
type AssignmentCommandService struct {
// contains filtered or unexported fields
}
AssignmentCommandService 赋权命令服务(实现 AssignmentCommander 接口) 负责协调领域服务、仓储和外部端口,处理赋权的写操作 核心职责:管理数据库和 Casbin 的双写事务一致性
func NewAssignmentCommandService ¶
func NewAssignmentCommandService( assignmentValidator assignmentDomain.Validator, uow authzuow.UnitOfWork, casbinAdapter policyDomain.CasbinAdapter, versionNotifier policyDomain.VersionNotifier, ) *AssignmentCommandService
NewAssignmentCommandService 创建赋权命令服务
func (*AssignmentCommandService) Grant ¶
func (s *AssignmentCommandService) Grant(ctx context.Context, cmd assignmentDomain.GrantCommand) (*assignmentDomain.Assignment, error)
Grant 授权(赋予角色)
func (*AssignmentCommandService) Revoke ¶
func (s *AssignmentCommandService) Revoke(ctx context.Context, cmd assignmentDomain.RevokeCommand) error
Revoke 撤销授权(移除角色)
func (*AssignmentCommandService) RevokeByID ¶
func (s *AssignmentCommandService) RevokeByID(ctx context.Context, cmd assignmentDomain.RevokeByIDCommand) error
RevokeByID 根据ID撤销授权
type AssignmentQueryService ¶
type AssignmentQueryService struct {
// contains filtered or unexported fields
}
AssignmentQueryService 赋权查询服务(实现 AssignmentQueryer 接口) 负责赋权的读操作,遵循 CQRS 原则
func NewAssignmentQueryService ¶
func NewAssignmentQueryService( assignmentValidator assignmentDomain.Validator, assignmentRepo assignmentDomain.Repository, ) *AssignmentQueryService
NewAssignmentQueryService 创建赋权查询服务
func (*AssignmentQueryService) ListByRole ¶
func (s *AssignmentQueryService) ListByRole(ctx context.Context, query assignmentDomain.ListByRoleQuery) ([]*assignmentDomain.Assignment, error)
ListByRole 根据角色列出赋权
func (*AssignmentQueryService) ListBySubject ¶
func (s *AssignmentQueryService) ListBySubject(ctx context.Context, query assignmentDomain.ListBySubjectQuery) ([]*assignmentDomain.Assignment, error)
ListBySubject 根据主体列出赋权
Click to show internal directories.
Click to hide internal directories.