Documentation
¶
Index ¶
- func ValidateTenantAccess(actorUser *model.User, targetTenant *model.Tenant) error
- func ValidateTenantAccessByID(actorUser *model.User, targetTenantID int64) error
- type APIKeyAPIServiceDataResult
- type APIKeyAPIServicePaginatedResult
- type APIKeyService
- type APIKeyServiceDataResult
- type APIKeyServiceGetFilter
- type APIKeyServiceGetResult
- type APIService
- type APIServiceDataResult
- type APIServiceGetFilter
- type APIServiceGetResult
- type AuthEventInput
- type AuthEventService
- type AuthEventServiceDataResult
- type BrandingService
- type BrandingServiceDataResult
- type ClientAPIServiceDataResult
- type ClientSecretServiceDataResult
- type ClientService
- type ClientServiceDataResult
- type ClientServiceGetFilter
- type ClientServiceGetResult
- type ClientURIServiceDataResult
- type EmailConfigService
- type EmailConfigServiceDataResult
- type EmailTemplateService
- type EmailTemplateServiceDataResult
- type EmailTemplateServiceListResult
- type ForgotPasswordService
- type IPRestrictionRuleService
- type IPRestrictionRuleServiceDataResult
- type IPRestrictionRuleServiceListResult
- type IdentityProviderService
- type IdentityProviderServiceDataResult
- type IdentityProviderServiceGetFilter
- type IdentityProviderServiceGetResult
- type InviteService
- type LoginService
- type LoginTemplateService
- type LoginTemplateServiceDataResult
- type LoginTemplateServiceListResult
- type OAuthAuthorizeService
- type OAuthConsentService
- type OAuthTokenService
- type PermissionService
- type PermissionServiceDataResult
- type PermissionServiceGetFilter
- type PermissionServiceGetResult
- type PolicyService
- type PolicyServiceDataResult
- type PolicyServiceGetFilter
- type PolicyServiceGetResult
- type PolicyServiceServiceDataResult
- type PolicyServiceServicesFilter
- type PolicyServiceServicesResult
- type ProfileService
- type ProfileServiceDataResult
- type ProfileServiceListResult
- type RegisterService
- type ResetPasswordService
- type RoleService
- type RoleServiceDataResult
- type RoleServiceGetFilter
- type RoleServiceGetPermissionsFilter
- type RoleServiceGetPermissionsResult
- type RoleServiceGetResult
- type SMSConfigService
- type SMSConfigServiceDataResult
- type SMSTemplateService
- type SMSTemplateServiceDataResult
- type SMSTemplateServiceListResult
- type SecuritySettingService
- type SecuritySettingServiceDataResult
- type ServiceService
- type ServiceServiceDataResult
- type ServiceServiceGetFilter
- type ServiceServiceGetResult
- type SetupService
- type SignupFlowRoleServiceDataResult
- type SignupFlowRoleServiceListResult
- type SignupFlowService
- type SignupFlowServiceDataResult
- type SignupFlowServiceListResult
- type TenantMemberService
- type TenantMemberServiceDataResult
- type TenantService
- type TenantServiceDataResult
- type TenantServiceGetFilter
- type TenantServiceGetResult
- type TenantSettingService
- type TenantSettingServiceDataResult
- type UserIdentityServiceDataResult
- type UserService
- type UserServiceDataResult
- type UserServiceGetFilter
- type UserServiceGetResult
- type UserSettingService
- type UserSettingServiceDataResult
- type WebhookEndpointService
- type WebhookEndpointServiceDataResult
- type WebhookEndpointServiceListResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateTenantAccess ¶
ValidateTenantAccess validates if a user can access the target tenant Rules: - Users from default tenant can access any tenant - Users from non-default tenant can only access their own tenant - User must have at least one identity to validate access
func ValidateTenantAccessByID ¶
ValidateTenantAccessByID validates tenant access using tenant ID Rules: - Users from default tenant can access any tenant - Users from non-default tenant can only access their own tenant - User must have at least one identity to validate access
Types ¶
type APIKeyAPIServiceDataResult ¶
type APIKeyAPIServiceDataResult struct {
APIKeyAPIUUID uuid.UUID
Api APIServiceDataResult
Permissions []PermissionServiceDataResult
CreatedAt time.Time
}
type APIKeyAPIServicePaginatedResult ¶
type APIKeyAPIServicePaginatedResult struct {
Data []APIKeyAPIServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
Paginated result for API Key APIs
type APIKeyService ¶
type APIKeyService interface {
Get(ctx context.Context, filter APIKeyServiceGetFilter, requestingUserUUID uuid.UUID) (*APIKeyServiceGetResult, error)
GetByUUID(ctx context.Context, apiKeyUUID uuid.UUID, tenantID int64, requestingUserUUID uuid.UUID) (*APIKeyServiceDataResult, error)
GetConfigByUUID(ctx context.Context, apiKeyUUID uuid.UUID, tenantID int64) (datatypes.JSON, error)
Create(ctx context.Context, tenantID int64, name, description string, config datatypes.JSON, expiresAt *time.Time, rateLimit *int, status string) (*APIKeyServiceDataResult, string, error)
Update(ctx context.Context, apiKeyUUID uuid.UUID, tenantID int64, name, description *string, config datatypes.JSON, expiresAt *time.Time, rateLimit *int, status *string, updaterUserUUID uuid.UUID) (*APIKeyServiceDataResult, error)
SetStatusByUUID(ctx context.Context, apiKeyUUID uuid.UUID, tenantID int64, status string) (*APIKeyServiceDataResult, error)
Delete(ctx context.Context, apiKeyUUID uuid.UUID, tenantID int64, deleterUserUUID uuid.UUID) (*APIKeyServiceDataResult, error)
ValidateAPIKey(ctx context.Context, keyHash string) (*APIKeyServiceDataResult, error)
// API Key API methods
GetAPIKeyAPIs(ctx context.Context, apiKeyUUID uuid.UUID, page, limit int, sortBy, sortOrder string) (*APIKeyAPIServicePaginatedResult, error)
AddAPIKeyAPIs(ctx context.Context, apiKeyUUID uuid.UUID, apiUUIDs []uuid.UUID) error
RemoveAPIKeyAPI(ctx context.Context, apiKeyUUID uuid.UUID, apiUUID uuid.UUID) error
// API Key API Permission methods
GetAPIKeyAPIPermissions(ctx context.Context, apiKeyUUID uuid.UUID, apiUUID uuid.UUID) ([]PermissionServiceDataResult, error)
AddAPIKeyAPIPermissions(ctx context.Context, apiKeyUUID uuid.UUID, apiUUID uuid.UUID, permissionUUIDs []uuid.UUID) error
RemoveAPIKeyAPIPermission(ctx context.Context, apiKeyUUID uuid.UUID, apiUUID uuid.UUID, permissionUUID uuid.UUID) error
}
func NewAPIKeyService ¶
func NewAPIKeyService( db *gorm.DB, apiKeyRepo repository.APIKeyRepository, apiKeyAPIRepo repository.APIKeyAPIRepository, apiKeyPermissionRepo repository.APIKeyPermissionRepository, apiRepo repository.APIRepository, userRepo repository.UserRepository, permissionRepo repository.PermissionRepository, ) APIKeyService
type APIKeyServiceDataResult ¶
type APIKeyServiceGetFilter ¶
type APIKeyServiceGetResult ¶
type APIKeyServiceGetResult struct {
Data []APIKeyServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type APIService ¶
type APIService interface {
Get(ctx context.Context, filter APIServiceGetFilter) (*APIServiceGetResult, error)
GetByUUID(ctx context.Context, apiUUID uuid.UUID, tenantID int64) (*APIServiceDataResult, error)
GetServiceIDByUUID(ctx context.Context, serviceUUID uuid.UUID) (int64, error)
Create(ctx context.Context, tenantID int64, name string, displayName string, description string, apiType string, status string, isSystem bool, serviceUUID string) (*APIServiceDataResult, error)
Update(ctx context.Context, apiUUID uuid.UUID, tenantID int64, name string, displayName string, description string, apiType string, status string, serviceUUID string) (*APIServiceDataResult, error)
SetStatusByUUID(ctx context.Context, apiUUID uuid.UUID, tenantID int64, status string) (*APIServiceDataResult, error)
DeleteByUUID(ctx context.Context, apiUUID uuid.UUID, tenantID int64) (*APIServiceDataResult, error)
}
func NewAPIService ¶
func NewAPIService( db *gorm.DB, apiRepo repository.APIRepository, serviceRepo repository.ServiceRepository, tenantServiceRepo repository.TenantServiceRepository, ) APIService
type APIServiceDataResult ¶
type APIServiceGetFilter ¶
type APIServiceGetResult ¶
type APIServiceGetResult struct {
Data []APIServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type AuthEventInput ¶
type AuthEventInput struct {
TenantID int64
ActorUserID *int64
TargetUserID *int64
IPAddress string
UserAgent *string
Category string
EventType string
Severity string
Result string
Description *string
ErrorReason *string
Metadata datatypes.JSON
}
AuthEventInput groups the parameters for recording a single auth event.
type AuthEventService ¶
type AuthEventService interface {
// Log records a new auth event. The trace ID is extracted from the context
// automatically. Errors are logged but never propagated — callers should
// fire-and-forget so event logging cannot break business flows.
Log(ctx context.Context, input AuthEventInput)
// FindPaginated returns a page of events filtered by the supplied criteria.
FindPaginated(ctx context.Context, filter repository.AuthEventRepositoryGetFilter) (*repository.PaginationResult[AuthEventServiceDataResult], error)
// FindByUUID returns a single event by UUID scoped to a tenant.
FindByUUID(ctx context.Context, tenantID int64, eventUUID uuid.UUID) (*AuthEventServiceDataResult, error)
// CountByEventType returns the count of events matching the type within a tenant.
CountByEventType(ctx context.Context, eventType string, tenantID int64) (int64, error)
// DeleteOlderThan removes events older than the cutoff. Returns the number
// of rows deleted. Used by the retention background job.
DeleteOlderThan(ctx context.Context, cutoff time.Time) (int64, error)
}
AuthEventService defines business operations on security auth events.
func NewAuthEventService ¶
func NewAuthEventService(authEventRepo repository.AuthEventRepository) AuthEventService
NewAuthEventService creates a new AuthEventService.
type AuthEventServiceDataResult ¶
type AuthEventServiceDataResult struct {
AuthEventUUID uuid.UUID
TenantID int64
ActorUserID *int64
TargetUserID *int64
IPAddress string
UserAgent *string
Category string
EventType string
Severity string
Result string
Description *string
ErrorReason *string
TraceID *string
Metadata datatypes.JSON
CreatedAt time.Time
}
AuthEventServiceDataResult is the service-layer representation of an auth event, decoupled from the persistence model.
type BrandingService ¶
type BrandingService interface {
Get(ctx context.Context, tenantID int64) (*BrandingServiceDataResult, error)
Update(ctx context.Context, tenantID int64, companyName, logoURL, faviconURL, primaryColor, secondaryColor, accentColor, fontFamily, customCSS, supportURL, privacyPolicyURL, termsOfServiceURL string) (*BrandingServiceDataResult, error)
}
BrandingService defines business operations on tenant branding.
func NewBrandingService ¶
func NewBrandingService(brandingRepo repository.BrandingRepository) BrandingService
NewBrandingService creates a new BrandingService.
type BrandingServiceDataResult ¶
type BrandingServiceDataResult struct {
BrandingUUID uuid.UUID
CompanyName string
LogoURL string
FaviconURL string
PrimaryColor string
SecondaryColor string
AccentColor string
FontFamily string
CustomCSS string
SupportURL string
PrivacyPolicyURL string
TermsOfServiceURL string
CreatedAt time.Time
UpdatedAt time.Time
}
BrandingServiceDataResult is the service-layer representation of a branding record, decoupled from the persistence model.
type ClientAPIServiceDataResult ¶
type ClientAPIServiceDataResult struct {
ClientAPIUUID uuid.UUID
Api APIServiceDataResult
Permissions []PermissionServiceDataResult
CreatedAt time.Time
}
type ClientService ¶
type ClientService interface {
Get(ctx context.Context, filter ClientServiceGetFilter) (*ClientServiceGetResult, error)
GetByUUID(ctx context.Context, ClientUUID uuid.UUID, tenantID int64) (*ClientServiceDataResult, error)
GetSecretByUUID(ctx context.Context, ClientUUID uuid.UUID, tenantID int64) (*ClientSecretServiceDataResult, error)
GetConfigByUUID(ctx context.Context, ClientUUID uuid.UUID, tenantID int64) (datatypes.JSON, error)
Create(ctx context.Context, tenantID int64, name string, displayName string, clientType string, domain string, config datatypes.JSON, status string, isDefault bool, identityProviderUUID string, actorUserUUID uuid.UUID) (*ClientServiceDataResult, error)
Update(ctx context.Context, ClientUUID uuid.UUID, tenantID int64, name string, displayName string, clientType string, domain string, config datatypes.JSON, status string, isDefault bool, actorUserUUID uuid.UUID) (*ClientServiceDataResult, error)
SetStatusByUUID(ctx context.Context, ClientUUID uuid.UUID, tenantID int64, status string, actorUserUUID uuid.UUID) (*ClientServiceDataResult, error)
DeleteByUUID(ctx context.Context, ClientUUID uuid.UUID, tenantID int64, actorUserUUID uuid.UUID) (*ClientServiceDataResult, error)
CreateURI(ctx context.Context, ClientUUID uuid.UUID, tenantID int64, uri string, uriType string, actorUserUUID uuid.UUID) (*ClientServiceDataResult, error)
UpdateURI(ctx context.Context, ClientUUID uuid.UUID, tenantID int64, ClientURIUUID uuid.UUID, uri string, uriType string, actorUserUUID uuid.UUID) (*ClientServiceDataResult, error)
DeleteURI(ctx context.Context, ClientUUID uuid.UUID, tenantID int64, ClientURIUUID uuid.UUID, actorUserUUID uuid.UUID) (*ClientServiceDataResult, error)
// Auth Client API methods
GetClientAPIs(ctx context.Context, tenantID int64, ClientUUID uuid.UUID) ([]ClientAPIServiceDataResult, error)
AddClientAPIs(ctx context.Context, tenantID int64, ClientUUID uuid.UUID, apiUUIDs []uuid.UUID) error
RemoveClientAPI(ctx context.Context, tenantID int64, ClientUUID uuid.UUID, apiUUID uuid.UUID) error
// Auth Client API Permission methods
GetClientAPIPermissions(ctx context.Context, tenantID int64, ClientUUID uuid.UUID, apiUUID uuid.UUID) ([]PermissionServiceDataResult, error)
AddClientAPIPermissions(ctx context.Context, tenantID int64, ClientUUID uuid.UUID, apiUUID uuid.UUID, permissionUUIDs []uuid.UUID) error
RemoveClientAPIPermission(ctx context.Context, tenantID int64, ClientUUID uuid.UUID, apiUUID uuid.UUID, permissionUUID uuid.UUID) error
}
func NewClientService ¶
func NewClientService( db *gorm.DB, clientRepo repository.ClientRepository, clientURIRepo repository.ClientURIRepository, idpRepo repository.IdentityProviderRepository, permissionRepo repository.PermissionRepository, clientPermissionRepo repository.ClientPermissionRepository, clientAPIRepo repository.ClientAPIRepository, apiRepo repository.APIRepository, userRepo repository.UserRepository, tenantRepo repository.TenantRepository, ) ClientService
type ClientServiceDataResult ¶
type ClientServiceDataResult struct {
ClientUUID uuid.UUID
Name string
DisplayName string
ClientType string
Domain *string
ClientURIs *[]ClientURIServiceDataResult
IdentityProvider *IdentityProviderServiceDataResult
Permissions *[]PermissionServiceDataResult
Status string
IsDefault bool
IsSystem bool
CreatedAt time.Time
UpdatedAt time.Time
}
func ToClientServiceDataResult ¶
func ToClientServiceDataResult(Client *model.Client) *ClientServiceDataResult
Response builder - made public for use in other services
type ClientServiceGetFilter ¶
type ClientServiceGetResult ¶
type ClientServiceGetResult struct {
Data []ClientServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type EmailConfigService ¶
type EmailConfigService interface {
Get(ctx context.Context, tenantID int64) (*EmailConfigServiceDataResult, error)
Update(ctx context.Context, tenantID int64, provider, host string, port int, username, password, fromAddress, fromName, replyTo, encryption string, testMode *bool) (*EmailConfigServiceDataResult, error)
}
EmailConfigService defines business operations on the tenant email delivery configuration.
func NewEmailConfigService ¶
func NewEmailConfigService(emailConfigRepo repository.EmailConfigRepository) EmailConfigService
NewEmailConfigService creates a new EmailConfigService.
type EmailConfigServiceDataResult ¶
type EmailConfigServiceDataResult struct {
EmailConfigUUID uuid.UUID
Provider string
Host string
Port int
Username string
FromAddress string
FromName string
ReplyTo string
Encryption string
TestMode bool
Status string
CreatedAt time.Time
UpdatedAt time.Time
}
EmailConfigServiceDataResult is the service-layer representation of an email_config record.
type EmailTemplateService ¶
type EmailTemplateService interface {
GetAll(ctx context.Context, tenantID int64, name *string, status []string, isDefault, isSystem *bool, page, limit int, sortBy, sortOrder string) (*EmailTemplateServiceListResult, error)
GetByUUID(ctx context.Context, emailTemplateUUID uuid.UUID, tenantID int64) (*EmailTemplateServiceDataResult, error)
Create(ctx context.Context, tenantID int64, name, subject, bodyHTML string, bodyPlain *string, status string, isDefault bool) (*EmailTemplateServiceDataResult, error)
Update(ctx context.Context, emailTemplateUUID uuid.UUID, tenantID int64, name, subject, bodyHTML string, bodyPlain *string, status string) (*EmailTemplateServiceDataResult, error)
UpdateStatus(ctx context.Context, emailTemplateUUID uuid.UUID, tenantID int64, status string) (*EmailTemplateServiceDataResult, error)
Delete(ctx context.Context, emailTemplateUUID uuid.UUID, tenantID int64) (*EmailTemplateServiceDataResult, error)
}
func NewEmailTemplateService ¶
func NewEmailTemplateService( db *gorm.DB, emailTemplateRepo repository.EmailTemplateRepository, ) EmailTemplateService
type EmailTemplateServiceListResult ¶
type EmailTemplateServiceListResult struct {
Data []EmailTemplateServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type ForgotPasswordService ¶
type ForgotPasswordService interface {
SendPasswordResetEmail(ctx context.Context, email string, clientID, providerID *string, isInternal bool) (*dto.ForgotPasswordResponseDTO, error)
}
func NewForgotPasswordService ¶
func NewForgotPasswordService( db *gorm.DB, userRepo repository.UserRepository, userTokenRepo repository.UserTokenRepository, clientRepo repository.ClientRepository, emailTemplateRepo repository.EmailTemplateRepository, ) ForgotPasswordService
type IPRestrictionRuleService ¶
type IPRestrictionRuleService interface {
GetAll(ctx context.Context, tenantID int64, ruleType *string, status []string, ipAddress, description *string, page, limit int, sortBy, sortOrder string) (*IPRestrictionRuleServiceListResult, error)
GetByUUID(ctx context.Context, tenantID int64, ipRestrictionRuleUUID uuid.UUID) (*IPRestrictionRuleServiceDataResult, error)
Create(ctx context.Context, tenantID int64, description, ruleType, ipAddress, status string, createdBy int64) (*IPRestrictionRuleServiceDataResult, error)
Update(ctx context.Context, tenantID int64, ipRestrictionRuleUUID uuid.UUID, description, ruleType, ipAddress, status string, updatedBy int64) (*IPRestrictionRuleServiceDataResult, error)
UpdateStatus(ctx context.Context, tenantID int64, ipRestrictionRuleUUID uuid.UUID, status string, updatedBy int64) (*IPRestrictionRuleServiceDataResult, error)
Delete(ctx context.Context, tenantID int64, ipRestrictionRuleUUID uuid.UUID) (*IPRestrictionRuleServiceDataResult, error)
}
IPRestrictionRuleService defines business operations on IP restriction rules.
func NewIPRestrictionRuleService ¶
func NewIPRestrictionRuleService( db *gorm.DB, ipRestrictionRuleRepo repository.IPRestrictionRuleRepository, ) IPRestrictionRuleService
NewIPRestrictionRuleService creates a new IPRestrictionRuleService.
type IPRestrictionRuleServiceDataResult ¶
type IPRestrictionRuleServiceDataResult struct {
IPRestrictionRuleUUID uuid.UUID
TenantID int64
Description string
Type string
IPAddress string
Status string
CreatedAt time.Time
UpdatedAt time.Time
}
IPRestrictionRuleServiceDataResult is the service-layer representation of a single IP restriction rule.
type IPRestrictionRuleServiceListResult ¶
type IPRestrictionRuleServiceListResult struct {
Data []IPRestrictionRuleServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
IPRestrictionRuleServiceListResult is the paginated result returned by listing IP restriction rules.
type IdentityProviderService ¶
type IdentityProviderService interface {
Get(ctx context.Context, filter IdentityProviderServiceGetFilter) (*IdentityProviderServiceGetResult, error)
GetByUUID(ctx context.Context, idpUUID uuid.UUID, tenantID int64) (*IdentityProviderServiceDataResult, error)
Create(ctx context.Context, name string, displayName string, provider string, providerType string, config datatypes.JSON, status string, tenantUUID string, tenantID int64, actorUserUUID uuid.UUID) (*IdentityProviderServiceDataResult, error)
Update(ctx context.Context, idpUUID uuid.UUID, name string, displayName string, provider string, providerType string, config datatypes.JSON, status string, tenantID int64, actorUserUUID uuid.UUID) (*IdentityProviderServiceDataResult, error)
SetStatusByUUID(ctx context.Context, idpUUID uuid.UUID, status string, tenantID int64, actorUserUUID uuid.UUID) (*IdentityProviderServiceDataResult, error)
DeleteByUUID(ctx context.Context, idpUUID uuid.UUID, tenantID int64, actorUserUUID uuid.UUID) (*IdentityProviderServiceDataResult, error)
}
func NewIdentityProviderService ¶
func NewIdentityProviderService( db *gorm.DB, idpRepo repository.IdentityProviderRepository, tenantRepo repository.TenantRepository, userRepo repository.UserRepository, ) IdentityProviderService
type IdentityProviderServiceDataResult ¶
type IdentityProviderServiceDataResult struct {
IdentityProviderUUID uuid.UUID
Name string
DisplayName string
Provider string
ProviderType string
Identifier string
Config *datatypes.JSON
Tenant *TenantServiceDataResult
Status string
IsDefault bool
IsSystem bool
CreatedAt time.Time
UpdatedAt time.Time
}
type IdentityProviderServiceGetResult ¶
type IdentityProviderServiceGetResult struct {
Data []IdentityProviderServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type InviteService ¶
type InviteService interface {
SendInvite(ctx context.Context, tenantID int64, email string, userID int64, roleUUIDs []string) (*model.Invite, error)
}
func NewInviteService ¶
func NewInviteService( db *gorm.DB, inviteRepo repository.InviteRepository, clientRepo repository.ClientRepository, roleRepo repository.RoleRepository, emailTemplateRepo repository.EmailTemplateRepository, ) InviteService
type LoginService ¶
type LoginService interface {
LoginPublic(ctx context.Context, usernameOrEmail, password, clientID, providerID string) (*dto.LoginResponseDTO, error)
Login(ctx context.Context, usernameOrEmail, password string, clientID, providerID *string) (*dto.LoginResponseDTO, error)
GetUserByEmail(ctx context.Context, email string, tenantID int64) (*model.User, error)
}
func NewLoginService ¶
func NewLoginService( db *gorm.DB, clientRepo repository.ClientRepository, userRepo repository.UserRepository, userTokenRepo repository.UserTokenRepository, userIdentityRepo repository.UserIdentityRepository, identityProviderRepo repository.IdentityProviderRepository, authEventService AuthEventService, ) LoginService
type LoginTemplateService ¶
type LoginTemplateService interface {
GetAll(ctx context.Context, tenantID int64, name *string, status []string, template *string, isDefault, isSystem *bool, page, limit int, sortBy, sortOrder string) (*LoginTemplateServiceListResult, error)
GetByUUID(ctx context.Context, loginTemplateUUID uuid.UUID, tenantID int64) (*LoginTemplateServiceDataResult, error)
Create(ctx context.Context, tenantID int64, name string, description *string, template string, metadata map[string]any, status string) (*LoginTemplateServiceDataResult, error)
Update(ctx context.Context, loginTemplateUUID uuid.UUID, tenantID int64, name string, description *string, template string, metadata map[string]any, status string) (*LoginTemplateServiceDataResult, error)
UpdateStatus(ctx context.Context, loginTemplateUUID uuid.UUID, tenantID int64, status string) (*LoginTemplateServiceDataResult, error)
Delete(ctx context.Context, loginTemplateUUID uuid.UUID, tenantID int64) (*LoginTemplateServiceDataResult, error)
}
func NewLoginTemplateService ¶
func NewLoginTemplateService(loginTemplateRepo repository.LoginTemplateRepository) LoginTemplateService
type LoginTemplateServiceListResult ¶
type LoginTemplateServiceListResult struct {
Data []LoginTemplateServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type OAuthAuthorizeService ¶
type OAuthAuthorizeService interface {
// Authorize processes an authorization request. It validates the client,
// redirect URI, and PKCE parameters. Depending on whether consent is needed,
// it either issues an authorization code immediately or creates a consent
// challenge for the frontend to resolve.
Authorize(ctx context.Context, req dto.OAuthAuthorizeRequestDTO, userID int64) (*dto.OAuthAuthorizeResult, *apperror.OAuthError)
// GetConsentChallenge retrieves a pending consent challenge by its UUID.
GetConsentChallenge(ctx context.Context, challengeUUID uuid.UUID, userID int64) (*dto.OAuthConsentChallengeResponseDTO, error)
// HandleConsent processes the user's consent decision. On approval, it
// persists the consent grant and issues an authorization code. On denial,
// it returns a redirect with an error.
HandleConsent(ctx context.Context, decision dto.OAuthConsentDecisionDTO, userID int64) (*dto.OAuthConsentDecisionResult, *apperror.OAuthError)
}
OAuthAuthorizeService handles the OAuth 2.0 authorization endpoint logic.
func NewOAuthAuthorizeService ¶
func NewOAuthAuthorizeService( db *gorm.DB, clientRepo repository.ClientRepository, clientURIRepo repository.ClientURIRepository, authCodeRepo repository.OAuthAuthorizationCodeRepository, consentGrantRepo repository.OAuthConsentGrantRepository, consentChallRepo repository.OAuthConsentChallengeRepository, authEventService AuthEventService, ) OAuthAuthorizeService
NewOAuthAuthorizeService creates a new OAuthAuthorizeService.
type OAuthConsentService ¶
type OAuthConsentService interface {
// ListGrants returns all consent grants for the authenticated user.
ListGrants(ctx context.Context, userID int64) ([]dto.OAuthConsentGrantResponseDTO, error)
// RevokeGrant removes a consent grant, forcing the user to re-consent on
// the next authorization request.
RevokeGrant(ctx context.Context, grantUUID uuid.UUID, userID int64) error
}
OAuthConsentService manages user consent grants (the persisted records of which scopes a user has approved for a client).
func NewOAuthConsentService ¶
func NewOAuthConsentService( consentGrantRepo repository.OAuthConsentGrantRepository, ) OAuthConsentService
NewOAuthConsentService creates a new OAuthConsentService.
type OAuthTokenService ¶
type OAuthTokenService interface {
// Exchange processes a token request. It routes to the appropriate grant
// handler (authorization_code, refresh_token, client_credentials).
Exchange(ctx context.Context, req dto.OAuthTokenRequestDTO, creds dto.OAuthClientCredentials) (*dto.OAuthTokenResult, *apperror.OAuthError)
// Revoke revokes a token (access or refresh) per RFC 7009. The server
// always responds 200 OK regardless of whether the token was found, to
// prevent information leakage.
Revoke(ctx context.Context, req dto.OAuthRevokeRequestDTO, creds dto.OAuthClientCredentials) *apperror.OAuthError
// Introspect inspects a token per RFC 7662. Returns active=false for
// invalid, expired, or revoked tokens without revealing the reason.
Introspect(ctx context.Context, req dto.OAuthIntrospectRequestDTO) (*dto.OAuthIntrospectResponseDTO, *apperror.OAuthError)
}
OAuthTokenService handles the OAuth 2.0 token endpoint logic.
func NewOAuthTokenService ¶
func NewOAuthTokenService( db *gorm.DB, clientRepo repository.ClientRepository, authCodeRepo repository.OAuthAuthorizationCodeRepository, refreshTokenRepo repository.OAuthRefreshTokenRepository, userRepo repository.UserRepository, userIdentityRepo repository.UserIdentityRepository, authEventService AuthEventService, ) OAuthTokenService
NewOAuthTokenService creates a new OAuthTokenService.
type PermissionService ¶
type PermissionService interface {
Get(ctx context.Context, filter PermissionServiceGetFilter) (*PermissionServiceGetResult, error)
GetByUUID(ctx context.Context, permissionUUID uuid.UUID, tenantID int64) (*PermissionServiceDataResult, error)
Create(ctx context.Context, tenantID int64, name string, description string, status string, isSystem bool, apiUUID string) (*PermissionServiceDataResult, error)
Update(ctx context.Context, permissionUUID uuid.UUID, tenantID int64, name string, description string, status string) (*PermissionServiceDataResult, error)
SetActiveStatusByUUID(ctx context.Context, permissionUUID uuid.UUID, tenantID int64) (*PermissionServiceDataResult, error)
SetStatus(ctx context.Context, permissionUUID uuid.UUID, tenantID int64, status string) (*PermissionServiceDataResult, error)
DeleteByUUID(ctx context.Context, permissionUUID uuid.UUID, tenantID int64) (*PermissionServiceDataResult, error)
}
func NewPermissionService ¶
func NewPermissionService( db *gorm.DB, permissionRepo repository.PermissionRepository, apiRepo repository.APIRepository, roleRepo repository.RoleRepository, clientRepo repository.ClientRepository, cacheInvalidator cache.Invalidator, ) PermissionService
type PermissionServiceGetResult ¶
type PermissionServiceGetResult struct {
Data []PermissionServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type PolicyService ¶
type PolicyService interface {
Get(ctx context.Context, filter PolicyServiceGetFilter) (*PolicyServiceGetResult, error)
GetByUUID(ctx context.Context, policyUUID uuid.UUID, tenantID int64) (*PolicyServiceDataResult, error)
GetServicesByPolicyUUID(ctx context.Context, policyUUID uuid.UUID, tenantID int64, filter PolicyServiceServicesFilter) (*PolicyServiceServicesResult, error)
Create(ctx context.Context, tenantID int64, name string, description *string, document datatypes.JSON, version string, status string, isSystem bool) (*PolicyServiceDataResult, error)
Update(ctx context.Context, policyUUID uuid.UUID, tenantID int64, name string, description *string, document datatypes.JSON, version string, status string) (*PolicyServiceDataResult, error)
SetStatusByUUID(ctx context.Context, policyUUID uuid.UUID, tenantID int64, status string) (*PolicyServiceDataResult, error)
DeleteByUUID(ctx context.Context, policyUUID uuid.UUID, tenantID int64) (*PolicyServiceDataResult, error)
}
func NewPolicyService ¶
func NewPolicyService( db *gorm.DB, policyRepo repository.PolicyRepository, serviceRepo repository.ServiceRepository, apiRepo repository.APIRepository, ) PolicyService
type PolicyServiceDataResult ¶
type PolicyServiceGetFilter ¶
type PolicyServiceGetResult ¶
type PolicyServiceGetResult struct {
Data []PolicyServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type PolicyServiceServicesResult ¶
type PolicyServiceServicesResult struct {
Data []PolicyServiceServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type ProfileService ¶
type ProfileService interface {
CreateOrUpdateProfile(
ctx context.Context,
userUUID uuid.UUID,
firstName string,
middleName, lastName, suffix, displayName, bio *string,
birthdate *time.Time,
gender *string,
phone, email, address *string,
city, country *string,
timezone, language *string,
profileURL *string,
metadata map[string]any,
) (*ProfileServiceDataResult, error)
CreateOrUpdateSpecificProfile(
ctx context.Context,
profileUUID uuid.UUID,
userUUID uuid.UUID,
firstName string,
middleName, lastName, suffix, displayName, bio *string,
birthdate *time.Time,
gender *string,
phone, email, address *string,
city, country *string,
timezone, language *string,
profileURL *string,
metadata map[string]any,
) (*ProfileServiceDataResult, error)
GetByUUID(ctx context.Context, profileUUID uuid.UUID, userUUID uuid.UUID) (*ProfileServiceDataResult, error)
GetByUserUUID(ctx context.Context, userUUID uuid.UUID) (*ProfileServiceDataResult, error)
GetAll(ctx context.Context, userUUID uuid.UUID, firstName, lastName, email, phone, city, country *string, isDefault *bool, page, limit int, sortBy, sortOrder string) (*ProfileServiceListResult, error)
SetDefaultProfile(ctx context.Context, profileUUID uuid.UUID, userUUID uuid.UUID) (*ProfileServiceDataResult, error)
DeleteByUUID(ctx context.Context, profileUUID uuid.UUID, userUUID uuid.UUID) (*ProfileServiceDataResult, error)
}
func NewProfileService ¶
func NewProfileService( db *gorm.DB, profileRepo repository.ProfileRepository, userRepo repository.UserRepository, ) ProfileService
type ProfileServiceDataResult ¶
type ProfileServiceDataResult struct {
ProfileUUID uuid.UUID
// Basic Identity Information
FirstName string
MiddleName *string
LastName *string
Suffix *string
DisplayName *string
Bio *string
// Profile Flags
IsDefault bool
// Personal Information
Birthdate *time.Time
Gender *string
// Contact Information
Phone *string
Email *string
Address *string
// Location Information
City *string
Country *string
// Preference
Timezone *string
Language *string
// Media & Assets (auth-centric)
ProfileURL *string
// Extended data
Metadata map[string]any
// System Fields
CreatedAt time.Time
UpdatedAt time.Time
}
type ProfileServiceListResult ¶
type ProfileServiceListResult struct {
Data []ProfileServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type RegisterService ¶
type RegisterService interface {
RegisterPublic(ctx context.Context, username, fullname, password string, email, phone *string, clientID, providerID string) (*dto.RegisterResponseDTO, error)
RegisterInvitePublic(ctx context.Context, username, password, clientID, providerID, inviteToken string) (*dto.RegisterResponseDTO, error)
Register(ctx context.Context, username, fullname, password string, email, phone *string, clientID, providerID *string) (*dto.RegisterResponseDTO, error)
RegisterInvite(ctx context.Context, username, password, inviteToken string, clientID, providerID *string) (*dto.RegisterResponseDTO, error)
}
func NewRegistrationService ¶
func NewRegistrationService( db *gorm.DB, clientRepo repository.ClientRepository, userRepo repository.UserRepository, userRoleRepo repository.UserRoleRepository, userTokenRepo repository.UserTokenRepository, userIdentityRepo repository.UserIdentityRepository, roleRepo repository.RoleRepository, inviteRepo repository.InviteRepository, identityProviderRepo repository.IdentityProviderRepository, ) RegisterService
type ResetPasswordService ¶
type ResetPasswordService interface {
ResetPassword(ctx context.Context, token, newPassword string, clientID, providerID *string) (*dto.ResetPasswordResponseDTO, error)
}
func NewResetPasswordService ¶
func NewResetPasswordService( db *gorm.DB, userRepo repository.UserRepository, userTokenRepo repository.UserTokenRepository, clientRepo repository.ClientRepository, ) ResetPasswordService
type RoleService ¶
type RoleService interface {
Get(ctx context.Context, filter RoleServiceGetFilter) (*RoleServiceGetResult, error)
GetByUUID(ctx context.Context, roleUUID uuid.UUID, tenantID int64) (*RoleServiceDataResult, error)
GetRolePermissions(ctx context.Context, filter RoleServiceGetPermissionsFilter) (*RoleServiceGetPermissionsResult, error)
Create(ctx context.Context, name string, description string, isDefault bool, isSystem bool, status string, tenantUUID string, actorUserUUID uuid.UUID) (*RoleServiceDataResult, error)
Update(ctx context.Context, roleUUID uuid.UUID, tenantID int64, name string, description string, isDefault bool, isSystem bool, status string, actorUserUUID uuid.UUID) (*RoleServiceDataResult, error)
SetStatusByUUID(ctx context.Context, roleUUID uuid.UUID, tenantID int64, status string, actorUserUUID uuid.UUID) (*RoleServiceDataResult, error)
DeleteByUUID(ctx context.Context, roleUUID uuid.UUID, tenantID int64, actorUserUUID uuid.UUID) (*RoleServiceDataResult, error)
AddRolePermissions(ctx context.Context, roleUUID uuid.UUID, tenantID int64, permissionUUIDs []uuid.UUID, actorUserUUID uuid.UUID) (*RoleServiceDataResult, error)
RemoveRolePermissions(ctx context.Context, roleUUID uuid.UUID, tenantID int64, permissionUUID uuid.UUID, actorUserUUID uuid.UUID) (*RoleServiceDataResult, error)
}
func NewRoleService ¶
func NewRoleService( db *gorm.DB, roleRepo repository.RoleRepository, permissionRepo repository.PermissionRepository, rolePermissionRepo repository.RolePermissionRepository, userRepo repository.UserRepository, tenantRepo repository.TenantRepository, cacheInvalidator cache.Invalidator, ) RoleService
type RoleServiceDataResult ¶
type RoleServiceGetFilter ¶
type RoleServiceGetPermissionsResult ¶
type RoleServiceGetPermissionsResult struct {
Data []PermissionServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type RoleServiceGetResult ¶
type RoleServiceGetResult struct {
Data []RoleServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type SMSConfigService ¶
type SMSConfigService interface {
Get(ctx context.Context, tenantID int64) (*SMSConfigServiceDataResult, error)
Update(ctx context.Context, tenantID int64, provider, accountSID, authToken, fromNumber, senderID string, testMode *bool) (*SMSConfigServiceDataResult, error)
}
SMSConfigService defines business operations on the tenant SMS delivery configuration.
func NewSMSConfigService ¶
func NewSMSConfigService(smsConfigRepo repository.SMSConfigRepository) SMSConfigService
NewSMSConfigService creates a new SMSConfigService.
type SMSConfigServiceDataResult ¶
type SMSConfigServiceDataResult struct {
SMSConfigUUID uuid.UUID
Provider string
AccountSID string
FromNumber string
SenderID string
TestMode bool
Status string
CreatedAt time.Time
UpdatedAt time.Time
}
SMSConfigServiceDataResult is the service-layer representation of an sms_config record.
type SMSTemplateService ¶
type SMSTemplateService interface {
GetAll(ctx context.Context, tenantID int64, name *string, status []string, isDefault, isSystem *bool, page, limit int, sortBy, sortOrder string) (*SMSTemplateServiceListResult, error)
GetByUUID(ctx context.Context, uuid uuid.UUID, tenantID int64) (*SMSTemplateServiceDataResult, error)
Create(ctx context.Context, tenantID int64, name string, description *string, message string, senderID *string, status string) (*SMSTemplateServiceDataResult, error)
Update(ctx context.Context, uuid uuid.UUID, tenantID int64, name string, description *string, message string, senderID *string, status string) (*SMSTemplateServiceDataResult, error)
UpdateStatus(ctx context.Context, uuid uuid.UUID, tenantID int64, status string) (*SMSTemplateServiceDataResult, error)
Delete(ctx context.Context, uuid uuid.UUID, tenantID int64) (*SMSTemplateServiceDataResult, error)
}
func NewSMSTemplateService ¶
func NewSMSTemplateService( db *gorm.DB, smsTemplateRepo repository.SMSTemplateRepository, ) SMSTemplateService
type SMSTemplateServiceListResult ¶
type SMSTemplateServiceListResult struct {
Data []SMSTemplateServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type SecuritySettingService ¶
type SecuritySettingService interface {
GetByUserPoolID(ctx context.Context, userPoolID int64) (*SecuritySettingServiceDataResult, error)
GetMFAConfig(ctx context.Context, userPoolID int64) (map[string]any, error)
GetPasswordConfig(ctx context.Context, userPoolID int64) (map[string]any, error)
GetSessionConfig(ctx context.Context, userPoolID int64) (map[string]any, error)
GetThreatConfig(ctx context.Context, userPoolID int64) (map[string]any, error)
GetLockoutConfig(ctx context.Context, userPoolID int64) (map[string]any, error)
GetRegistrationConfig(ctx context.Context, userPoolID int64) (map[string]any, error)
GetTokenConfig(ctx context.Context, userPoolID int64) (map[string]any, error)
UpdateMFAConfig(ctx context.Context, userPoolID int64, config map[string]any, updatedBy int64, ipAddress, userAgent string) (*SecuritySettingServiceDataResult, error)
UpdatePasswordConfig(ctx context.Context, userPoolID int64, config map[string]any, updatedBy int64, ipAddress, userAgent string) (*SecuritySettingServiceDataResult, error)
UpdateSessionConfig(ctx context.Context, userPoolID int64, config map[string]any, updatedBy int64, ipAddress, userAgent string) (*SecuritySettingServiceDataResult, error)
UpdateThreatConfig(ctx context.Context, userPoolID int64, config map[string]any, updatedBy int64, ipAddress, userAgent string) (*SecuritySettingServiceDataResult, error)
UpdateLockoutConfig(ctx context.Context, userPoolID int64, config map[string]any, updatedBy int64, ipAddress, userAgent string) (*SecuritySettingServiceDataResult, error)
UpdateRegistrationConfig(ctx context.Context, userPoolID int64, config map[string]any, updatedBy int64, ipAddress, userAgent string) (*SecuritySettingServiceDataResult, error)
UpdateTokenConfig(ctx context.Context, userPoolID int64, config map[string]any, updatedBy int64, ipAddress, userAgent string) (*SecuritySettingServiceDataResult, error)
}
func NewSecuritySettingService ¶
func NewSecuritySettingService( db *gorm.DB, securitySettingRepo repository.SecuritySettingRepository, securitySettingsAuditRepo repository.SecuritySettingsAuditRepository, ) SecuritySettingService
type SecuritySettingServiceDataResult ¶
type SecuritySettingServiceDataResult struct {
SecuritySettingUUID uuid.UUID
UserPoolID int64
MFAConfig map[string]any
PasswordConfig map[string]any
SessionConfig map[string]any
ThreatConfig map[string]any
LockoutConfig map[string]any
RegistrationConfig map[string]any
TokenConfig map[string]any
Version int
CreatedBy *int64
UpdatedBy *int64
CreatedAt time.Time
UpdatedAt time.Time
}
type ServiceService ¶
type ServiceService interface {
Get(ctx context.Context, filter ServiceServiceGetFilter) (*ServiceServiceGetResult, error)
GetByUUID(ctx context.Context, serviceUUID uuid.UUID, tenantID int64) (*ServiceServiceDataResult, error)
Create(ctx context.Context, name string, displayName string, description string, version string, isSystem bool, status string, tenantID int64) (*ServiceServiceDataResult, error)
Update(ctx context.Context, serviceUUID uuid.UUID, tenantID int64, name string, displayName string, description string, version string, isSystem bool, status string) (*ServiceServiceDataResult, error)
SetStatusByUUID(ctx context.Context, serviceUUID uuid.UUID, tenantID int64, status string) (*ServiceServiceDataResult, error)
DeleteByUUID(ctx context.Context, serviceUUID uuid.UUID, tenantID int64) (*ServiceServiceDataResult, error)
AssignPolicy(ctx context.Context, serviceUUID uuid.UUID, policyUUID uuid.UUID, tenantID int64) error
RemovePolicy(ctx context.Context, serviceUUID uuid.UUID, policyUUID uuid.UUID, tenantID int64) error
}
func NewServiceService ¶
func NewServiceService( db *gorm.DB, serviceRepo repository.ServiceRepository, tenantServiceRepo repository.TenantServiceRepository, apiRepo repository.APIRepository, servicePolicyRepo repository.ServicePolicyRepository, policyRepo repository.PolicyRepository, ) ServiceService
type ServiceServiceGetFilter ¶
type ServiceServiceGetResult ¶
type ServiceServiceGetResult struct {
Data []ServiceServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type SetupService ¶
type SetupService interface {
GetSetupStatus(ctx context.Context) (*dto.SetupStatusResponseDTO, error)
CreateTenant(ctx context.Context, req dto.CreateTenantRequestDTO) (*dto.CreateTenantResponseDTO, error)
CreateAdmin(ctx context.Context, req dto.CreateAdminRequestDTO) (*dto.CreateAdminResponseDTO, error)
CreateProfile(ctx context.Context, req dto.CreateProfileRequestDTO) (*dto.CreateProfileResponseDTO, error)
}
func NewSetupService ¶
func NewSetupService( db *gorm.DB, userRepo repository.UserRepository, tenantRepo repository.TenantRepository, tenantMemberRepo repository.TenantMemberRepository, clientRepo repository.ClientRepository, identityProviderRepo repository.IdentityProviderRepository, roleRepo repository.RoleRepository, userRoleRepo repository.UserRoleRepository, userTokenRepo repository.UserTokenRepository, userIdentityRepo repository.UserIdentityRepository, profileRepo repository.ProfileRepository, ) SetupService
type SignupFlowRoleServiceListResult ¶
type SignupFlowRoleServiceListResult struct {
Data []SignupFlowRoleServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type SignupFlowService ¶
type SignupFlowService interface {
GetAll(ctx context.Context, tenantID int64, name, identifier *string, status []string, ClientUUID *uuid.UUID, page, limit int, sortBy, sortOrder string) (*SignupFlowServiceListResult, error)
GetByUUID(ctx context.Context, signupFlowUUID uuid.UUID, tenantID int64) (*SignupFlowServiceDataResult, error)
Create(ctx context.Context, tenantID int64, name, description string, config map[string]any, status string, ClientUUID uuid.UUID) (*SignupFlowServiceDataResult, error)
Update(ctx context.Context, signupFlowUUID uuid.UUID, tenantID int64, name, description string, config map[string]any, status string) (*SignupFlowServiceDataResult, error)
UpdateStatus(ctx context.Context, signupFlowUUID uuid.UUID, tenantID int64, status string) (*SignupFlowServiceDataResult, error)
Delete(ctx context.Context, signupFlowUUID uuid.UUID, tenantID int64) (*SignupFlowServiceDataResult, error)
AssignRoles(ctx context.Context, signupFlowUUID uuid.UUID, tenantID int64, roleUUIDs []uuid.UUID) ([]SignupFlowRoleServiceDataResult, error)
GetRoles(ctx context.Context, signupFlowUUID uuid.UUID, tenantID int64, page, limit int) (*SignupFlowRoleServiceListResult, error)
RemoveRole(ctx context.Context, signupFlowUUID uuid.UUID, tenantID int64, roleUUID uuid.UUID) error
}
func NewSignupFlowService ¶
func NewSignupFlowService( db *gorm.DB, signupFlowRepo repository.SignupFlowRepository, signupFlowRoleRepo repository.SignupFlowRoleRepository, roleRepo repository.RoleRepository, clientRepo repository.ClientRepository, ) SignupFlowService
type SignupFlowServiceListResult ¶
type SignupFlowServiceListResult struct {
Data []SignupFlowServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type TenantMemberService ¶
type TenantMemberService interface {
Create(ctx context.Context, tenantID int64, userID int64, role string) (*TenantMemberServiceDataResult, error)
CreateByUserUUID(ctx context.Context, tenantID int64, userUUID uuid.UUID, role string) (*TenantMemberServiceDataResult, error)
GetByUUID(ctx context.Context, tenantMemberUUID uuid.UUID) (*TenantMemberServiceDataResult, error)
GetByTenantAndUser(ctx context.Context, tenantID int64, userID int64) (*TenantMemberServiceDataResult, error)
ListByTenant(ctx context.Context, tenantID int64) ([]TenantMemberServiceDataResult, error)
ListByUser(ctx context.Context, userID int64) ([]TenantMemberServiceDataResult, error)
UpdateRole(ctx context.Context, tenantMemberUUID uuid.UUID, role string) (*TenantMemberServiceDataResult, error)
DeleteByUUID(ctx context.Context, tenantMemberUUID uuid.UUID) error
IsUserInTenant(ctx context.Context, userID int64, tenantUUID uuid.UUID) (bool, error)
}
func NewTenantMemberService ¶
func NewTenantMemberService(db *gorm.DB, tenantMemberRepo repository.TenantMemberRepository, userRepo repository.UserRepository, tenantRepo repository.TenantRepository) TenantMemberService
type TenantService ¶
type TenantService interface {
Get(ctx context.Context, filter TenantServiceGetFilter) (*TenantServiceGetResult, error)
GetByUUID(ctx context.Context, tenantUUID uuid.UUID) (*TenantServiceDataResult, error)
GetSystem(ctx context.Context) (*TenantServiceDataResult, error)
GetByIdentifier(ctx context.Context, identifier string) (*TenantServiceDataResult, error)
Create(ctx context.Context, name string, displayName string, description string, status string, isPublic bool) (*TenantServiceDataResult, error)
Update(ctx context.Context, tenantUUID uuid.UUID, name string, displayName string, description string, status string, isPublic bool) (*TenantServiceDataResult, error)
SetStatusByUUID(ctx context.Context, tenantUUID uuid.UUID, status string) (*TenantServiceDataResult, error)
SetActivePublicByUUID(ctx context.Context, tenantUUID uuid.UUID) (*TenantServiceDataResult, error)
DeleteByUUID(ctx context.Context, tenantUUID uuid.UUID) (*TenantServiceDataResult, error)
}
func NewTenantService ¶
func NewTenantService(db *gorm.DB, tenantRepo repository.TenantRepository) TenantService
type TenantServiceDataResult ¶
type TenantServiceGetFilter ¶
type TenantServiceGetResult ¶
type TenantServiceGetResult struct {
Data []TenantServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type TenantSettingService ¶
type TenantSettingService interface {
Get(ctx context.Context, tenantID int64) (*TenantSettingServiceDataResult, error)
GetRateLimitConfig(ctx context.Context, tenantID int64) (map[string]any, error)
GetAuditConfig(ctx context.Context, tenantID int64) (map[string]any, error)
GetMaintenanceConfig(ctx context.Context, tenantID int64) (map[string]any, error)
GetFeatureFlags(ctx context.Context, tenantID int64) (map[string]any, error)
UpdateRateLimitConfig(ctx context.Context, tenantID int64, config map[string]any) (*TenantSettingServiceDataResult, error)
UpdateAuditConfig(ctx context.Context, tenantID int64, config map[string]any) (*TenantSettingServiceDataResult, error)
UpdateMaintenanceConfig(ctx context.Context, tenantID int64, config map[string]any) (*TenantSettingServiceDataResult, error)
UpdateFeatureFlags(ctx context.Context, tenantID int64, config map[string]any) (*TenantSettingServiceDataResult, error)
}
TenantSettingService defines business operations on tenant settings.
func NewTenantSettingService ¶
func NewTenantSettingService(tenantSettingRepo repository.TenantSettingRepository) TenantSettingService
NewTenantSettingService creates a new TenantSettingService.
type TenantSettingServiceDataResult ¶
type TenantSettingServiceDataResult struct {
TenantSettingUUID uuid.UUID
RateLimitConfig map[string]any
AuditConfig map[string]any
MaintenanceConfig map[string]any
FeatureFlags map[string]any
CreatedAt time.Time
UpdatedAt time.Time
}
TenantSettingServiceDataResult is the service-layer representation of a tenant_settings record.
type UserService ¶
type UserService interface {
Get(ctx context.Context, filter UserServiceGetFilter) (*UserServiceGetResult, error)
GetByUUID(ctx context.Context, userUUID uuid.UUID, tenantID int64) (*UserServiceDataResult, error)
Create(ctx context.Context, username string, fullname string, email *string, phone *string, password string, status string, metadata datatypes.JSON, tenantUUID string, creatorUserUUID uuid.UUID) (*UserServiceDataResult, error)
Update(ctx context.Context, userUUID uuid.UUID, tenantID int64, username string, fullname string, email *string, phone *string, status string, metadata datatypes.JSON, updaterUserUUID uuid.UUID) (*UserServiceDataResult, error)
SetStatus(ctx context.Context, userUUID uuid.UUID, tenantID int64, status string, updaterUserUUID uuid.UUID) (*UserServiceDataResult, error)
VerifyEmail(ctx context.Context, userUUID uuid.UUID, tenantID int64) (*UserServiceDataResult, error)
VerifyPhone(ctx context.Context, userUUID uuid.UUID, tenantID int64) (*UserServiceDataResult, error)
CompleteAccount(ctx context.Context, userUUID uuid.UUID, tenantID int64) (*UserServiceDataResult, error)
DeleteByUUID(ctx context.Context, userUUID uuid.UUID, tenantID int64, deleterUserUUID uuid.UUID) (*UserServiceDataResult, error)
AssignUserRoles(ctx context.Context, userUUID uuid.UUID, roleUUIDs []uuid.UUID, tenantID int64) (*UserServiceDataResult, error)
RemoveUserRole(ctx context.Context, userUUID uuid.UUID, roleUUID uuid.UUID, tenantID int64) (*UserServiceDataResult, error)
GetUserRoles(ctx context.Context, userUUID uuid.UUID) ([]RoleServiceDataResult, error)
GetUserIdentities(ctx context.Context, userUUID uuid.UUID) ([]UserIdentityServiceDataResult, error)
// FindBySubAndClientID resolves a user from a JWT sub claim and client ID.
// Used by UserContextMiddleware to populate the request context.
FindBySubAndClientID(ctx context.Context, sub string, clientID string) (*model.User, error)
}
func NewUserService ¶
func NewUserService( db *gorm.DB, userRepo repository.UserRepository, userIdentityRepo repository.UserIdentityRepository, userRoleRepo repository.UserRoleRepository, roleRepo repository.RoleRepository, tenantRepo repository.TenantRepository, identityProviderRepo repository.IdentityProviderRepository, clientRepo repository.ClientRepository, userPoolRepo repository.UserPoolRepository, cacheInvalidator cache.Invalidator, ) UserService
type UserServiceDataResult ¶
type UserServiceDataResult struct {
UserUUID uuid.UUID
Username string
Fullname string
Email string
Phone string
IsEmailVerified bool
IsPhoneVerified bool
IsProfileCompleted bool
IsAccountCompleted bool
Status string
Metadata datatypes.JSON
Tenant *TenantServiceDataResult
UserIdentities *[]UserIdentityServiceDataResult
Roles *[]RoleServiceDataResult
CreatedAt time.Time
UpdatedAt time.Time
}
type UserServiceGetFilter ¶
type UserServiceGetResult ¶
type UserServiceGetResult struct {
Data []UserServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
type UserSettingService ¶
type UserSettingService interface {
CreateOrUpdateUserSetting(
ctx context.Context,
userUUID uuid.UUID,
timezone, preferredLanguage, locale *string,
socialLinks map[string]any,
preferredContactMethod *string,
marketingEmailConsent, smsNotificationsConsent, pushNotificationsConsent *bool,
profileVisibility *string,
dataProcessingConsent *bool,
termsAcceptedAt, privacyPolicyAcceptedAt *time.Time,
emergencyContactName, emergencyContactPhone, emergencyContactEmail, emergencyContactRelation *string,
) (*UserSettingServiceDataResult, error)
GetByUUID(ctx context.Context, userSettingUUID uuid.UUID) (*UserSettingServiceDataResult, error)
GetByUserUUID(ctx context.Context, userUUID uuid.UUID) (*UserSettingServiceDataResult, error)
DeleteByUUID(ctx context.Context, userSettingUUID uuid.UUID) (*UserSettingServiceDataResult, error)
}
func NewUserSettingService ¶
func NewUserSettingService( db *gorm.DB, userSettingRepo repository.UserSettingRepository, userRepo repository.UserRepository, ) UserSettingService
type UserSettingServiceDataResult ¶
type UserSettingServiceDataResult struct {
UserSettingUUID uuid.UUID
Timezone *string
PreferredLanguage *string
Locale *string
SocialLinks datatypes.JSON
PreferredContactMethod *string
MarketingEmailConsent bool
SMSNotificationsConsent bool
PushNotificationsConsent bool
ProfileVisibility *string
DataProcessingConsent bool
TermsAcceptedAt *time.Time
PrivacyPolicyAcceptedAt *time.Time
EmergencyContactName *string
EmergencyContactPhone *string
EmergencyContactEmail *string
EmergencyContactRelation *string
CreatedAt time.Time
UpdatedAt time.Time
}
type WebhookEndpointService ¶
type WebhookEndpointService interface {
GetAll(ctx context.Context, tenantID int64, status []string, page, limit int, sortBy, sortOrder string) (*WebhookEndpointServiceListResult, error)
GetByUUID(ctx context.Context, tenantID int64, webhookEndpointUUID uuid.UUID) (*WebhookEndpointServiceDataResult, error)
Create(ctx context.Context, tenantID int64, url, secret string, events []string, maxRetries, timeoutSeconds *int, description, status string) (*WebhookEndpointServiceDataResult, error)
Update(ctx context.Context, tenantID int64, webhookEndpointUUID uuid.UUID, url, secret string, events []string, maxRetries, timeoutSeconds *int, description, status string) (*WebhookEndpointServiceDataResult, error)
UpdateStatus(ctx context.Context, tenantID int64, webhookEndpointUUID uuid.UUID, status string) (*WebhookEndpointServiceDataResult, error)
Delete(ctx context.Context, tenantID int64, webhookEndpointUUID uuid.UUID) (*WebhookEndpointServiceDataResult, error)
}
WebhookEndpointService defines business operations on webhook endpoints.
func NewWebhookEndpointService ¶
func NewWebhookEndpointService(webhookEndpointRepo repository.WebhookEndpointRepository) WebhookEndpointService
NewWebhookEndpointService creates a new WebhookEndpointService.
type WebhookEndpointServiceDataResult ¶
type WebhookEndpointServiceDataResult struct {
WebhookEndpointUUID uuid.UUID
TenantID int64
URL string
Events any
MaxRetries int
TimeoutSeconds int
Status string
Description string
LastTriggeredAt *time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
WebhookEndpointServiceDataResult is the service-layer representation of a webhook_endpoints record.
type WebhookEndpointServiceListResult ¶
type WebhookEndpointServiceListResult struct {
Data []WebhookEndpointServiceDataResult
Total int64
Page int
Limit int
TotalPages int
}
WebhookEndpointServiceListResult holds a paginated list of webhook endpoints.
Source Files
¶
- api.go
- api_key.go
- auth_event.go
- branding.go
- client.go
- email_config.go
- email_template.go
- forgot_password.go
- identity_provider.go
- invite.go
- ip_restriction_rule.go
- login.go
- login_template.go
- oauth_authorize.go
- oauth_consent.go
- oauth_token.go
- permission.go
- policy.go
- profile.go
- register.go
- reset_password.go
- role.go
- security_setting.go
- service.go
- setup.go
- signup_flow.go
- sms_config.go
- sms_template.go
- tenant.go
- tenant_access.go
- tenant_member.go
- tenant_setting.go
- user.go
- user_setting.go
- webhook_endpoint.go