Documentation
¶
Index ¶
- Constants
- Variables
- type ActionAvailability
- type Actor
- type AllowedEmailPage
- type AuditEventPage
- type AuthProviderSummary
- type Config
- type DashboardStats
- type Page
- type PasskeySummary
- type RecentFailures
- type RequestMeta
- type Service
- func (s *Service) AddAllowedEmail(ctx context.Context, actor Actor, email string, meta RequestMeta) error
- func (s *Service) CanRevokeAllSessions(actorID uuid.UUID, targetID uuid.UUID) ActionAvailability
- func (s *Service) CleanupExpiredAuditEvents(ctx context.Context, now time.Time) (int64, error)
- func (s *Service) DashboardStats(ctx context.Context) (DashboardStats, error)
- func (s *Service) DisableUser(ctx context.Context, actor Actor, userID uuid.UUID, meta RequestMeta) error
- func (s *Service) EnableUser(ctx context.Context, actor Actor, userID uuid.UUID, meta RequestMeta) error
- func (s *Service) GetUserDetail(ctx context.Context, actor Actor, userID uuid.UUID) (UserDetail, error)
- func (s *Service) GrantAdmin(ctx context.Context, actor Actor, userID uuid.UUID, meta RequestMeta) error
- func (s *Service) ListAllowedEmails(ctx context.Context, query string, page Page) (AllowedEmailPage, error)
- func (s *Service) ListAuditEvents(ctx context.Context, page Page) (AuditEventPage, error)
- func (s *Service) RecentFailures(ctx context.Context, page Page) (RecentFailures, error)
- func (s *Service) RemoveAllowedEmail(ctx context.Context, actor Actor, allowedEmailID uuid.UUID, meta RequestMeta) error
- func (s *Service) RevokeAdmin(ctx context.Context, actor Actor, userID uuid.UUID, meta RequestMeta) error
- func (s *Service) RevokeAllUserSessions(ctx context.Context, actor Actor, userID uuid.UUID, meta RequestMeta) error
- func (s *Service) RevokeUserSession(ctx context.Context, actor Actor, userID, sessionID uuid.UUID, ...) error
- func (s *Service) SearchUser(ctx context.Context, query string) (UserSummary, error)
- func (s *Service) StartAuditCleanupWorker(ctx context.Context, logger *slog.Logger, interval time.Duration)
- type SessionSummary
- type UserDetail
- type UserDetailActions
- type UserSummary
Constants ¶
View Source
const ( ActionUserDisabled = "user.disabled" ActionUserEnabled = "user.enabled" ActionUserAdminGranted = "user.admin_granted" ActionUserAdminRevoked = "user.admin_revoked" ActionUserSessionRevoked = "user.session_revoked" ActionUserSessionsRevoked = "user.sessions_revoked" ActionAllowlistEmailAdded = "allowlist.email_added" ActionAllowlistEmailRemoved = "allowlist.email_removed" )
View Source
const ( ReasonSelfDisable = "You cannot disable your own account." ReasonSelfRevokeAdmin = "You cannot remove your own admin role." ReasonSelfRevokeSessions = "You cannot revoke all sessions for your own account from here." ReasonLastAdmin = "You cannot remove the last admin." )
Variables ¶
View Source
var ( ErrSelfDisable = errors.New("admin cannot disable themselves") ErrSelfRevokeAdmin = errors.New("admin cannot remove their own admin role") ErrSelfRevokeSessions = errors.New("admin cannot revoke all sessions for themselves") ErrLastAdmin = errors.New("operation would leave no active admins") ErrAllowlistDisabled = errors.New("allowlist feature disabled") ErrAllowedEmailAlreadyAdded = errors.New("allowed email already exists") ErrInvalidEmail = errors.New("invalid email") )
Functions ¶
This section is empty.
Types ¶
type ActionAvailability ¶
type AllowedEmailPage ¶
type AllowedEmailPage struct {
Emails []domain.AllowedEmail
Query string
Page int
Size int
Total int
Message string
}
func (AllowedEmailPage) HasNext ¶
func (p AllowedEmailPage) HasNext() bool
func (AllowedEmailPage) HasPrevious ¶
func (p AllowedEmailPage) HasPrevious() bool
type AuditEventPage ¶
type AuditEventPage struct {
Events []domain.AdminAuditEvent
Page int
Size int
}
type AuthProviderSummary ¶
type DashboardStats ¶
type PasskeySummary ¶
type RecentFailures ¶
type RequestMeta ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) AddAllowedEmail ¶
func (*Service) CanRevokeAllSessions ¶
func (*Service) CleanupExpiredAuditEvents ¶
func (*Service) DashboardStats ¶
func (s *Service) DashboardStats(ctx context.Context) (DashboardStats, error)
func (*Service) DisableUser ¶
func (*Service) EnableUser ¶
func (*Service) GetUserDetail ¶
func (*Service) GrantAdmin ¶
func (*Service) ListAllowedEmails ¶
func (*Service) ListAuditEvents ¶
func (*Service) RecentFailures ¶
func (*Service) RemoveAllowedEmail ¶
func (*Service) RevokeAdmin ¶
func (*Service) RevokeAllUserSessions ¶
func (*Service) RevokeUserSession ¶
func (*Service) SearchUser ¶
type SessionSummary ¶
type UserDetail ¶
type UserDetail struct {
User UserSummary
AuthProviders []AuthProviderSummary
Passkeys []PasskeySummary
Sessions []SessionSummary
Actions UserDetailActions
}
type UserDetailActions ¶
type UserDetailActions struct {
Disable ActionAvailability
Enable ActionAvailability
GrantAdmin ActionAvailability
RevokeAdmin ActionAvailability
RevokeAllSessions ActionAvailability
}
type UserSummary ¶
type UserSummary struct {
ID uuid.UUID
CreatedAt time.Time
UpdatedAt time.Time
DisabledAt *time.Time
Username string
Email string
Roles []string
AuthProviderCount int
ActiveSessionCount int
}
func (UserSummary) Disabled ¶
func (u UserSummary) Disabled() bool
func (UserSummary) HasRole ¶
func (u UserSummary) HasRole(roleName string) bool
Click to show internal directories.
Click to hide internal directories.