Documentation
¶
Index ¶
- func NewSystemRoleService(systemRoleRepo port.SystemRoleRepository, userRepo port.UserRepository) accessuc.SystemRoleUseCase
- func NewUserAccessHistoryService(accessHistoryRepo port.UserAccessHistoryRepository) accessuc.UserAccessHistoryUseCase
- type SystemRoleService
- func (s *SystemRoleService) AssignRole(ctx context.Context, cmd accessuc.AssignSystemRoleCommand) (*entity.SystemRoleAssignment, error)
- func (s *SystemRoleService) AssignRoleByEmail(ctx context.Context, cmd accessuc.AssignSystemRoleByEmailCommand) (*entity.SystemRoleWithUser, error)
- func (s *SystemRoleService) GetUserSystemRole(ctx context.Context, userID string) (*entity.SystemRoleAssignment, error)
- func (s *SystemRoleService) ListUsersWithSystemRoles(ctx context.Context) ([]*entity.SystemRoleWithUser, error)
- func (s *SystemRoleService) RevokeRole(ctx context.Context, cmd accessuc.RevokeSystemRoleCommand) error
- type UserAccessHistoryService
- func (s *UserAccessHistoryService) GetRecentTenantIDs(ctx context.Context, userID string) ([]string, error)
- func (s *UserAccessHistoryService) GetRecentWorkspaceIDs(ctx context.Context, userID string) ([]string, error)
- func (s *UserAccessHistoryService) RecordTenantAccess(ctx context.Context, userID, tenantID string) error
- func (s *UserAccessHistoryService) RecordWorkspaceAccess(ctx context.Context, userID, workspaceID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSystemRoleService ¶
func NewSystemRoleService( systemRoleRepo port.SystemRoleRepository, userRepo port.UserRepository, ) accessuc.SystemRoleUseCase
NewSystemRoleService creates a new system role service.
func NewUserAccessHistoryService ¶
func NewUserAccessHistoryService( accessHistoryRepo port.UserAccessHistoryRepository, ) accessuc.UserAccessHistoryUseCase
NewUserAccessHistoryService creates a new user access history service.
Types ¶
type SystemRoleService ¶
type SystemRoleService struct {
// contains filtered or unexported fields
}
SystemRoleService implements the SystemRoleUseCase interface.
func (*SystemRoleService) AssignRole ¶
func (s *SystemRoleService) AssignRole(ctx context.Context, cmd accessuc.AssignSystemRoleCommand) (*entity.SystemRoleAssignment, error)
AssignRole assigns a system role to a user.
func (*SystemRoleService) AssignRoleByEmail ¶
func (s *SystemRoleService) AssignRoleByEmail(ctx context.Context, cmd accessuc.AssignSystemRoleByEmailCommand) (*entity.SystemRoleWithUser, error)
AssignRoleByEmail assigns a system role to a user identified by email. Creates a shadow user if the email doesn't exist.
func (*SystemRoleService) GetUserSystemRole ¶
func (s *SystemRoleService) GetUserSystemRole(ctx context.Context, userID string) (*entity.SystemRoleAssignment, error)
GetUserSystemRole gets a user's system role.
func (*SystemRoleService) ListUsersWithSystemRoles ¶
func (s *SystemRoleService) ListUsersWithSystemRoles(ctx context.Context) ([]*entity.SystemRoleWithUser, error)
ListUsersWithSystemRoles lists all users that have system roles.
func (*SystemRoleService) RevokeRole ¶
func (s *SystemRoleService) RevokeRole(ctx context.Context, cmd accessuc.RevokeSystemRoleCommand) error
RevokeRole revokes a user's system role.
type UserAccessHistoryService ¶
type UserAccessHistoryService struct {
// contains filtered or unexported fields
}
UserAccessHistoryService implements user access history business logic.
func (*UserAccessHistoryService) GetRecentTenantIDs ¶
func (s *UserAccessHistoryService) GetRecentTenantIDs(ctx context.Context, userID string) ([]string, error)
GetRecentTenantIDs returns the IDs of recently accessed tenants.
func (*UserAccessHistoryService) GetRecentWorkspaceIDs ¶
func (s *UserAccessHistoryService) GetRecentWorkspaceIDs(ctx context.Context, userID string) ([]string, error)
GetRecentWorkspaceIDs returns the IDs of recently accessed workspaces.
func (*UserAccessHistoryService) RecordTenantAccess ¶
func (s *UserAccessHistoryService) RecordTenantAccess(ctx context.Context, userID, tenantID string) error
RecordTenantAccess records that a user accessed a tenant. Access is validated in the database: user must have tenant membership OR a system role.
func (*UserAccessHistoryService) RecordWorkspaceAccess ¶
func (s *UserAccessHistoryService) RecordWorkspaceAccess(ctx context.Context, userID, workspaceID string) error
RecordWorkspaceAccess records that a user accessed a workspace. Access is validated in the database: user must have workspace membership OR a system role.