Documentation
¶
Index ¶
- Constants
- func MapEvercoreErrorToStatus(err error) ubstatus.StatusCode
- func Must(condition bool, message string)
- func NewUserRolesAggregate() evercore.Aggregate
- type ApiKey
- type ApiKeyData
- type GenerateTwoFactorSharedSecretCommand
- type GenerateTwoFactorSharedSecretResponse
- type GroupPermissions
- type IdValue
- type ManagementImpl
- func (m *ManagementImpl) GenerateTwoFactorSharedSecret(ctx context.Context, command GenerateTwoFactorSharedSecretCommand) (r.Response[GenerateTwoFactorSharedSecretResponse], error)
- func (m *ManagementImpl) OrganizationAdd(ctx context.Context, command OrganizationCreateCommand, agent string) (r.Response[IdValue], error)
- func (m *ManagementImpl) OrganizationGet(ctx context.Context, organizationID int64) (r.Response[OrganizationAggregate], error)
- func (m *ManagementImpl) OrganizationGetBySystemName(ctx context.Context, systemName string) (r.Response[OrganizationAggregate], error)
- func (m *ManagementImpl) OrganizationList(ctx context.Context) (r.Response[[]ubdata.Organization], error)
- func (m *ManagementImpl) OrganizationRolesWithUserCount(ctx context.Context, organizationId int64) (r.Response[[]ubdata.ListRolesWithUserCountsRow], error)
- func (m *ManagementImpl) OrganizationUpdate(ctx context.Context, command OrganizationUpdateCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) OrganizationsCount(ctx context.Context) (r.Response[int64], error)
- func (m *ManagementImpl) RoleAdd(ctx context.Context, command RoleCreateCommand, agent string) (r.Response[IdValue], error)
- func (m *ManagementImpl) RoleDelete(ctx context.Context, command RoleDeleteCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) RoleGetById(ctx context.Context, roleId int64) (r.Response[RoleAggregate], error)
- func (m *ManagementImpl) RoleGetBySystemName(ctx context.Context, systemName string) (r.Response[RoleAggregate], error)
- func (m *ManagementImpl) RoleList(ctx context.Context, OrganizationId int64) (r.Response[[]ubdata.RoleRow], error)
- func (m *ManagementImpl) RolePermissionAdd(ctx context.Context, command RolePermissionAddCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) RolePermissionRemove(ctx context.Context, command RolePermissionRemoveCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) RoleUndelete(ctx context.Context, command RoleUndeleteCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) RoleUpdate(ctx context.Context, command RoleUpdateCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) UserAdd(ctx context.Context, command UserCreateCommand, agent string) (r.Response[UserCreatedResponse], error)
- func (m *ManagementImpl) UserAddToRole(ctx context.Context, command UserAddToRoleCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) UserAuthenticate(ctx context.Context, command UserLoginCommand, agent string) (r.Response[*UserAuthenticationResponse], error)
- func (m *ManagementImpl) UserDeleteApiKey(ctx context.Context, command UserDeleteApiKeyCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) UserDisable(ctx context.Context, command UserDisableCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) UserEnable(ctx context.Context, command UserEnableCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) UserGenerateApiKey(ctx context.Context, command UserGenerateApiKeyCommand, agent string) (r.Response[string], error)
- func (m *ManagementImpl) UserGenerateVerificationToken(ctx context.Context, command UserGenerateVerificationTokenCommand, ...) (r.Response[UserGenerateVerificationTokenResponse], error)
- func (m *ManagementImpl) UserGetAllOrganizationRoles(ctx context.Context, userId int64) (r.Response[[]ubdata.ListUserOrganizationRolesRow], error)
- func (m *ManagementImpl) UserGetByApiKey(ctx context.Context, apiKey string) (r.Response[UserAggregate], error)
- func (m *ManagementImpl) UserGetByEmail(ctx context.Context, email string) (r.Response[UserAggregate], error)
- func (m *ManagementImpl) UserGetById(ctx context.Context, userId int64) (r.Response[UserAggregate], error)
- func (m *ManagementImpl) UserGetOrganizationRoles(ctx context.Context, userId int64, organizationId int64) (r.Response[[]ubdata.RoleRow], error)
- func (m *ManagementImpl) UserRemoveFromRole(ctx context.Context, command UserRemoveFromRoleCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) UserSetTwoFactorSharedSecret(ctx context.Context, command UserSetTwoFactorSharedSecretCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) UserUpdate(ctx context.Context, command UserUpdateCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) UserVerify(ctx context.Context, command UserVerifyCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) UserVerifyTwoFactorCode(ctx context.Context, command UserVerifyTwoFactorLoginCommand, agent string) (r.Response[any], error)
- func (m *ManagementImpl) UsersCount(ctx context.Context) (r.Response[int64], error)
- type ManagementService
- type OrganizationAddedEvent
- type OrganizationAggregate
- type OrganizationCreateCommand
- type OrganizationState
- type OrganizationUpdateCommand
- type OrganizationUpdatedEvent
- type PrefectService
- type PrefectServiceImpl
- func (p *PrefectServiceImpl) ApiKeyToUser(ctx context.Context, apiKey string) (ApiKeyData, error)
- func (p *PrefectServiceImpl) GroupInvalidation(ctx context.Context, groupId int64) error
- func (p *PrefectServiceImpl) UserBelongsToRole(ctx context.Context, userId int64, groupId int64) (bool, error)
- func (p *PrefectServiceImpl) UserHasPermission(ctx context.Context, userId int64, orgId int64, permission string) (bool, error)
- func (p *PrefectServiceImpl) UserInvalidation(ctx context.Context, userId int64) error
- type RoleAggregate
- type RoleCreateCommand
- type RoleCreatedEvent
- type RoleDeleteCommand
- type RoleDeletedEvent
- type RolePermissionAddCommand
- type RolePermissionAddedEvent
- type RolePermissionRemoveCommand
- type RolePermissionRemovedEvent
- type RoleState
- type RoleUndeleteCommand
- type RoleUndeletedEvent
- type RoleUpdateCommand
- type RoleUpdatedEvent
- type UserAddToRoleCommand
- type UserAddedEvent
- type UserAddedToRoleEvent
- type UserAggregate
- type UserApiKeyAddedEvent
- type UserApiKeyDeletedEvent
- type UserAuthenticationResponse
- type UserCreateCommand
- type UserCreatedResponse
- type UserData
- type UserDeleteApiKeyCommand
- type UserDisableCommand
- type UserDisabledEvent
- type UserEnableCommand
- type UserEnabledEvent
- type UserGenerateApiKeyCommand
- type UserGenerateVerificationTokenCommand
- type UserGenerateVerificationTokenResponse
- type UserLoginCommand
- type UserLoginFailedEvent
- type UserLoginPartiallySucceededEvent
- type UserLoginSucceededEvent
- type UserRemoveFromRoleCommand
- type UserRemovedFromRoleEvent
- type UserRolesAggregate
- func (t *UserRolesAggregate) ApplyEventState(eventState evercore.EventState, eventTime time.Time, reference string) error
- func (t *UserRolesAggregate) ApplySnapshot(snapshot *evercore.Snapshot) error
- func (t *UserRolesAggregate) GetAggregateType() string
- func (t *UserRolesAggregate) GetId() int64
- func (t *UserRolesAggregate) GetSequence() int64
- func (t *UserRolesAggregate) GetSnapshotFrequency() int64
- func (t *UserRolesAggregate) GetSnapshotState() (*string, error)
- func (t *UserRolesAggregate) SetId(id int64)
- func (t *UserRolesAggregate) SetSequence(seq int64)
- type UserSetTwoFactorSharedSecretCommand
- type UserState
- type UserTwoFactorAuthenticatedEvent
- type UserTwoFactorDisabledEvent
- type UserTwoFactorEnabledEvent
- type UserUpdateCommand
- type UserUpdatedEvent
- type UserVerificationTokenGeneratedEvent
- type UserVerificationTokenVerifiedEvent
- type UserVerifyCommand
- type UserVerifyTwoFactorLoginCommand
Constants ¶
const ApiKeyIdLength = 10
const ApiKeyLength = 40
const VerificationTokenLength = 10
Variables ¶
This section is empty.
Functions ¶
func MapEvercoreErrorToStatus ¶ added in v0.0.14
func MapEvercoreErrorToStatus(err error) ubstatus.StatusCode
func NewUserRolesAggregate ¶
Note the UserRolesAggregsate is just a receiver for the related events. It does not record state.
Types ¶
type ApiKeyData ¶ added in v0.0.21
type GenerateTwoFactorSharedSecretCommand ¶ added in v0.0.11
type GenerateTwoFactorSharedSecretCommand struct {}
type GenerateTwoFactorSharedSecretResponse ¶ added in v0.0.11
type GenerateTwoFactorSharedSecretResponse struct {
}type GroupPermissions ¶ added in v0.0.16
type ManagementImpl ¶
type ManagementImpl struct {
// contains filtered or unexported fields
}
func (*ManagementImpl) GenerateTwoFactorSharedSecret ¶ added in v0.0.11
func (m *ManagementImpl) GenerateTwoFactorSharedSecret(ctx context.Context, command GenerateTwoFactorSharedSecretCommand) (r.Response[GenerateTwoFactorSharedSecretResponse], error)
func (*ManagementImpl) OrganizationAdd ¶
func (m *ManagementImpl) OrganizationAdd(ctx context.Context, command OrganizationCreateCommand, agent string) (r.Response[IdValue], error)
func (*ManagementImpl) OrganizationGet ¶ added in v0.0.16
func (m *ManagementImpl) OrganizationGet(ctx context.Context, organizationID int64) (r.Response[OrganizationAggregate], error)
func (*ManagementImpl) OrganizationGetBySystemName ¶
func (m *ManagementImpl) OrganizationGetBySystemName( ctx context.Context, systemName string) (r.Response[OrganizationAggregate], error)
func (*ManagementImpl) OrganizationList ¶
func (m *ManagementImpl) OrganizationList(ctx context.Context) (r.Response[[]ubdata.Organization], error)
func (*ManagementImpl) OrganizationRolesWithUserCount ¶ added in v0.0.16
func (m *ManagementImpl) OrganizationRolesWithUserCount(ctx context.Context, organizationId int64) (r.Response[[]ubdata.ListRolesWithUserCountsRow], error)
func (*ManagementImpl) OrganizationUpdate ¶
func (m *ManagementImpl) OrganizationUpdate(ctx context.Context, command OrganizationUpdateCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) OrganizationsCount ¶ added in v0.0.16
func (*ManagementImpl) RoleAdd ¶
func (m *ManagementImpl) RoleAdd(ctx context.Context, command RoleCreateCommand, agent string) (r.Response[IdValue], error)
func (*ManagementImpl) RoleDelete ¶
func (m *ManagementImpl) RoleDelete(ctx context.Context, command RoleDeleteCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) RoleGetById ¶
func (m *ManagementImpl) RoleGetById(ctx context.Context, roleId int64) (r.Response[RoleAggregate], error)
func (*ManagementImpl) RoleGetBySystemName ¶
func (m *ManagementImpl) RoleGetBySystemName(ctx context.Context, systemName string) (r.Response[RoleAggregate], error)
func (*ManagementImpl) RolePermissionAdd ¶
func (m *ManagementImpl) RolePermissionAdd(ctx context.Context, command RolePermissionAddCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) RolePermissionRemove ¶
func (m *ManagementImpl) RolePermissionRemove(ctx context.Context, command RolePermissionRemoveCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) RoleUndelete ¶
func (m *ManagementImpl) RoleUndelete(ctx context.Context, command RoleUndeleteCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) RoleUpdate ¶
func (m *ManagementImpl) RoleUpdate(ctx context.Context, command RoleUpdateCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) UserAdd ¶
func (m *ManagementImpl) UserAdd(ctx context.Context, command UserCreateCommand, agent string) (r.Response[UserCreatedResponse], error)
func (*ManagementImpl) UserAddToRole ¶
func (m *ManagementImpl) UserAddToRole(ctx context.Context, command UserAddToRoleCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) UserAuthenticate ¶
func (m *ManagementImpl) UserAuthenticate(ctx context.Context, command UserLoginCommand, agent string) (r.Response[*UserAuthenticationResponse], error)
func (*ManagementImpl) UserDeleteApiKey ¶ added in v0.0.18
func (m *ManagementImpl) UserDeleteApiKey(ctx context.Context, command UserDeleteApiKeyCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) UserDisable ¶
func (m *ManagementImpl) UserDisable(ctx context.Context, command UserDisableCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) UserEnable ¶
func (m *ManagementImpl) UserEnable(ctx context.Context, command UserEnableCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) UserGenerateApiKey ¶ added in v0.0.18
func (m *ManagementImpl) UserGenerateApiKey(ctx context.Context, command UserGenerateApiKeyCommand, agent string) (r.Response[string], error)
func (*ManagementImpl) UserGenerateVerificationToken ¶
func (m *ManagementImpl) UserGenerateVerificationToken(ctx context.Context, command UserGenerateVerificationTokenCommand, agent string) (r.Response[UserGenerateVerificationTokenResponse], error)
func (*ManagementImpl) UserGetAllOrganizationRoles ¶ added in v0.0.16
func (m *ManagementImpl) UserGetAllOrganizationRoles(ctx context.Context, userId int64) (r.Response[[]ubdata.ListUserOrganizationRolesRow], error)
func (*ManagementImpl) UserGetByApiKey ¶ added in v0.0.18
func (m *ManagementImpl) UserGetByApiKey(ctx context.Context, apiKey string) (r.Response[UserAggregate], error)
func (*ManagementImpl) UserGetByEmail ¶
func (m *ManagementImpl) UserGetByEmail(ctx context.Context, email string) (r.Response[UserAggregate], error)
func (*ManagementImpl) UserGetById ¶
func (m *ManagementImpl) UserGetById(ctx context.Context, userId int64) (r.Response[UserAggregate], error)
func (*ManagementImpl) UserGetOrganizationRoles ¶
func (*ManagementImpl) UserRemoveFromRole ¶
func (m *ManagementImpl) UserRemoveFromRole(ctx context.Context, command UserRemoveFromRoleCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) UserSetTwoFactorSharedSecret ¶ added in v0.0.11
func (m *ManagementImpl) UserSetTwoFactorSharedSecret(ctx context.Context, command UserSetTwoFactorSharedSecretCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) UserUpdate ¶
func (m *ManagementImpl) UserUpdate(ctx context.Context, command UserUpdateCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) UserVerify ¶
func (m *ManagementImpl) UserVerify(ctx context.Context, command UserVerifyCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) UserVerifyTwoFactorCode ¶
func (m *ManagementImpl) UserVerifyTwoFactorCode(ctx context.Context, command UserVerifyTwoFactorLoginCommand, agent string) (r.Response[any], error)
func (*ManagementImpl) UsersCount ¶ added in v0.0.16
type ManagementService ¶
type ManagementService interface { // OrganizationList lists all organizations OrganizationList(ctx context.Context) (r.Response[[]ubdata.Organization], error) // OrganizationAdd creates a new organization with the given details // Returns the ID of the newly created organization or an error OrganizationAdd(ctx context.Context, command OrganizationCreateCommand, agent string) (r.Response[IdValue], error) OrganizationGet(ctx context.Context, organizationID int64) (r.Response[OrganizationAggregate], error) // OrganizationGetBySystemName retrieves an organization by its system name // Returns the organization details or an error if not found OrganizationGetBySystemName( ctx context.Context, systemName string) (r.Response[OrganizationAggregate], error) // OrganizationUpdate modifies an existing organization's details // Returns success/failure status or an error OrganizationUpdate(ctx context.Context, command OrganizationUpdateCommand, agent string) (r.Response[any], error) // RoleAdd creates a new role with the given details // Returns the ID of the newly created role or an error RoleAdd(ctx context.Context, command RoleCreateCommand, agent string) (r.Response[IdValue], error) // RoleUpdate modifies an existing role's details // Returns success/failure status or an error RoleUpdate(ctx context.Context, command RoleUpdateCommand, agent string) (r.Response[any], error) // RoleList lists all roles for a given organization RoleList(ctx context.Context, OrganizationId int64) (r.Response[[]ubdata.RoleRow], error) // RoleGetById retrieves a role by its ID // Returns the role details or an error if not found RoleGetById(ctx context.Context, roleId int64) (r.Response[RoleAggregate], error) // RoleGetBySystemName retrieves a role by its system name // Returns the role details or an error if not found RoleGetBySystemName(ctx context.Context, systemName string) (r.Response[RoleAggregate], error) // RoleDelete marks a role as deleted (soft delete) // Returns success/failure status or an error RoleDelete(ctx context.Context, command RoleDeleteCommand, agent string) (r.Response[any], error) // RoleUndelete restores a previously deleted role // Returns success/failure status or an error RoleUndelete(ctx context.Context, command RoleUndeleteCommand, agent string) (r.Response[any], error) // RolePermissionAdd grants a permission to a role // Returns success/failure status or an error RolePermissionAdd(ctx context.Context, command RolePermissionAddCommand, agent string) (r.Response[any], error) // RolePermissionRemove revokes a permission from a role // Returns success/failure status or an error RolePermissionRemove(ctx context.Context, command RolePermissionRemoveCommand, agent string) (r.Response[any], error) // UserAdd creates a new user with the given details // Returns the ID of the newly created user or an error UserAdd(ctx context.Context, command UserCreateCommand, agent string) (r.Response[UserCreatedResponse], error) // UserGetById retrieves a user by their ID // Returns the user details or an error if not found UserGetById(ctx context.Context, userId int64) (r.Response[UserAggregate], error) // UserGetByEmail retrieves a user by email address // Returns the user details or an error if not found UserGetByEmail(ctx context.Context, email string) (r.Response[UserAggregate], error) // UserUpdate modifies an existing user's details // Returns success/failure status or an error UserUpdate(ctx context.Context, command UserUpdateCommand, agent string) (r.Response[any], error) // UserAuthenticate verifies user credentials and authenticates the user // Returns authentication status and user details if successful UserAuthenticate(ctx context.Context, command UserLoginCommand, agent string) (r.Response[*UserAuthenticationResponse], error) // UserVerifyTwoFactorCode verifies a 2FA code for an authenticated user // Returns success/failure status or an error UserVerifyTwoFactorCode(ctx context.Context, command UserVerifyTwoFactorLoginCommand, agent string) (r.Response[any], error) // UserGenerateVerificationToken creates a verification token for the user // Returns the generated token or an error UserGenerateVerificationToken(ctx context.Context, command UserGenerateVerificationTokenCommand, agent string) (r.Response[UserGenerateVerificationTokenResponse], error) // UserVerify verifies a user's account using a verification token // Returns success/failure status or an error UserVerify(ctx context.Context, command UserVerifyCommand, agent string) (r.Response[any], error) // Returns the secret and setup details or an error GenerateTwoFactorSharedSecret( ctx context.Context, command GenerateTwoFactorSharedSecretCommand) (r.Response[GenerateTwoFactorSharedSecretResponse], error) UserSetTwoFactorSharedSecret(ctx context.Context, command UserSetTwoFactorSharedSecretCommand, agent string) (r.Response[any], error) // UserDisable deactivates a user account // Returns success/failure status or an error UserDisable(ctx context.Context, command UserDisableCommand, agent string) (r.Response[any], error) // UserEnable reactivates a previously disabled user account // Returns success/failure status or an error UserEnable(ctx context.Context, command UserEnableCommand, agent string) (r.Response[any], error) // UserAddToRole assigns a role to a user // Returns success/failure status or an error UserAddToRole(ctx context.Context, command UserAddToRoleCommand, agent string) (r.Response[any], error) // UserGetOrganizationRoles retrieves all roles a user has in a specific organization // Returns the list of roles or an error UserGetOrganizationRoles(ctx context.Context, userId int64, organizationId int64) (r.Response[[]ubdata.RoleRow], error) UserGetAllOrganizationRoles(ctx context.Context, userId int64) (r.Response[[]ubdata.ListUserOrganizationRolesRow], error) // UserRemoveFromRole revokes a role from a user // Returns success/failure status or an error UserRemoveFromRole(ctx context.Context, command UserRemoveFromRoleCommand, agent string) (r.Response[any], error) // UsersCount returns the total number of users in the system UsersCount(ctx context.Context) (r.Response[int64], error) UserGenerateApiKey(ctx context.Context, command UserGenerateApiKeyCommand, agent string) (r.Response[string], error) UserGetByApiKey(ctx context.Context, apiKey string) (r.Response[UserAggregate], error) UserDeleteApiKey(ctx context.Context, command UserDeleteApiKeyCommand, agent string) (r.Response[any], error) // OrganizationsCount returns the total number of organizations in the system OrganizationsCount(ctx context.Context) (r.Response[int64], error) // ListOrganizationsWithUserCounts lists all organizations along with the count of users in each OrganizationRolesWithUserCount(ctx context.Context, organizationId int64) (r.Response[[]ubdata.ListRolesWithUserCountsRow], error) }
ManagementService defines the interface for user, organization and role management operations
func NewManagement ¶
func NewManagement( store *evercore.EventStore, dbadapter ubdata.DataAdapter, hashingService ubsecurity.HashGenerator, encryptionService ubsecurity.EncryptionService, twoFactorService ub2fa.TotpService, ) ManagementService
type OrganizationAddedEvent ¶
type OrganizationAddedEvent struct { Id int64 `json:"id"` Name string `json:"name"` SystemName string `json:"systemName"` Status string `json:"status"` }
evercore:state-event
type OrganizationAggregate ¶
type OrganizationAggregate struct { evercore.StateAggregate[OrganizationState] }
evercore:aggregate
type OrganizationCreateCommand ¶
type OrganizationCreateCommand struct { Name string `json:"name"` SystemName string `json:"systemName"` Status string `json:"status"` }
OrganizationCreateCommand is a command to create an organization.
func (OrganizationCreateCommand) Validate ¶
func (c OrganizationCreateCommand) Validate() (bool, []ubvalidation.ValidationIssue)
type OrganizationState ¶
type OrganizationState struct { Name string `json:"name"` SystemName string `json:"systemName"` Status string `json:"status"` }
evercore:aggregate
type OrganizationUpdateCommand ¶
type OrganizationUpdateCommand struct { Id int64 `json:"id"` Name *string `json:"name"` SystemName *string `json:"systemName"` Status *string `json:"status"` }
func (OrganizationUpdateCommand) Validate ¶
func (c OrganizationUpdateCommand) Validate() (bool, []ubvalidation.ValidationIssue)
type OrganizationUpdatedEvent ¶
type OrganizationUpdatedEvent struct { Id int64 `json:"id"` Name *string `json:"name"` SystemName *string `json:"systemName"` Status *string `json:"status"` }
evercore:state-event
type PrefectService ¶ added in v0.0.16
type PrefectService interface { UserBelongsToRole(ctx context.Context, userId int64, roleId int64) (bool, error) UserHasPermission(ctx context.Context, userId int64, orgId int64, permission string) (bool, error) GroupInvalidation(ctx context.Context, roleId int64) error UserInvalidation(ctx context.Context, userId int64) error ApiKeyToUser(ctx context.Context, apiKey string) (ApiKeyData, error) }
func NewPrefectService ¶ added in v0.0.16
func NewPrefectService( managementService ManagementService, userCacheSize int, groupCacheSize int, ) PrefectService
type PrefectServiceImpl ¶ added in v0.0.16
type PrefectServiceImpl struct {
// contains filtered or unexported fields
}
func (*PrefectServiceImpl) ApiKeyToUser ¶ added in v0.0.21
func (p *PrefectServiceImpl) ApiKeyToUser(ctx context.Context, apiKey string) (ApiKeyData, error)
func (*PrefectServiceImpl) GroupInvalidation ¶ added in v0.0.16
func (p *PrefectServiceImpl) GroupInvalidation(ctx context.Context, groupId int64) error
func (*PrefectServiceImpl) UserBelongsToRole ¶ added in v0.0.16
func (*PrefectServiceImpl) UserHasPermission ¶ added in v0.0.16
func (*PrefectServiceImpl) UserInvalidation ¶ added in v0.0.16
func (p *PrefectServiceImpl) UserInvalidation(ctx context.Context, userId int64) error
type RoleAggregate ¶
type RoleAggregate struct { evercore.StateAggregate[RoleState] }
func (*RoleAggregate) ApplyEventState ¶
func (t *RoleAggregate) ApplyEventState(eventState evercore.EventState, eventTime time.Time, reference string) error
type RoleCreateCommand ¶
type RoleCreateCommand struct { Name string `json:"name"` SystemName string `json:"systemName"` OrganizationId int64 `json:"organizationId"` }
RoleCreateCommand is a command to create a role.
func (RoleCreateCommand) Validate ¶
func (c RoleCreateCommand) Validate() (bool, []ubvalidation.ValidationIssue)
type RoleCreatedEvent ¶
type RoleCreatedEvent struct { Id int64 `json:"id"` OrganizationId int64 `json:"organizationId"` Name string `json:"name"` SystemName string `json:"systemName"` }
evercore:state-event
type RoleDeleteCommand ¶
type RoleDeleteCommand struct {
Id int64 `json:"id"`
}
type RoleDeletedEvent ¶
type RoleDeletedEvent struct { }
evercore:event
func (RoleDeletedEvent) GetEventType ¶
func (a RoleDeletedEvent) GetEventType() string
func (RoleDeletedEvent) Serialize ¶
func (a RoleDeletedEvent) Serialize() string
type RolePermissionAddCommand ¶
func (RolePermissionAddCommand) Validate ¶
func (c RolePermissionAddCommand) Validate() (bool, []ubvalidation.ValidationIssue)
type RolePermissionAddedEvent ¶
type RolePermissionAddedEvent struct {
Permission string `json:"permission"`
}
evercore:event
func (RolePermissionAddedEvent) GetEventType ¶
func (a RolePermissionAddedEvent) GetEventType() string
func (RolePermissionAddedEvent) Serialize ¶
func (a RolePermissionAddedEvent) Serialize() string
type RolePermissionRemoveCommand ¶
type RolePermissionRemoveCommand struct { Id int64 `json:"id"` Permission string `json:"permission"` }
func (RolePermissionRemoveCommand) Validate ¶
func (c RolePermissionRemoveCommand) Validate() (bool, []ubvalidation.ValidationIssue)
type RolePermissionRemovedEvent ¶
type RolePermissionRemovedEvent struct {
Permission string `json:"permission"`
}
evercore:event
func (RolePermissionRemovedEvent) GetEventType ¶
func (a RolePermissionRemovedEvent) GetEventType() string
func (RolePermissionRemovedEvent) Serialize ¶
func (a RolePermissionRemovedEvent) Serialize() string
type RoleUndeleteCommand ¶
type RoleUndeleteCommand struct {
Id int64 `json:"id"`
}
type RoleUndeletedEvent ¶
type RoleUndeletedEvent struct { }
evercore:event
func (RoleUndeletedEvent) GetEventType ¶
func (a RoleUndeletedEvent) GetEventType() string
func (RoleUndeletedEvent) Serialize ¶
func (a RoleUndeletedEvent) Serialize() string
type RoleUpdateCommand ¶
type RoleUpdateCommand struct { Id int64 `json:"id"` Name *string `json:"name"` SystemName *string `json:"systemName"` }
func (RoleUpdateCommand) Validate ¶
func (c RoleUpdateCommand) Validate() (bool, []ubvalidation.ValidationIssue)
type RoleUpdatedEvent ¶
type RoleUpdatedEvent struct { Id int64 `json:"id"` Name *string `json:"name"` SystemName *string `json:"systemName"` }
evercore:state-event
type UserAddToRoleCommand ¶
func (UserAddToRoleCommand) Validate ¶
func (c UserAddToRoleCommand) Validate() (bool, []ubvalidation.ValidationIssue)
type UserAddedEvent ¶
type UserAddedEvent struct { Email string `json:"email"` PasswordHash string `json:"passwordHash"` FirstName string `json:"firstName"` LastName string `json:"lastName"` DisplayName string `json:"displayName"` Verified bool `json:"verified"` }
evercore:state-event
type UserAddedToRoleEvent ¶
evercore:event
func (UserAddedToRoleEvent) GetEventType ¶
func (a UserAddedToRoleEvent) GetEventType() string
func (UserAddedToRoleEvent) Serialize ¶
func (a UserAddedToRoleEvent) Serialize() string
type UserAggregate ¶
type UserAggregate struct { evercore.StateAggregate[UserState] }
evercore:aggregate
func (*UserAggregate) ApplyEventState ¶
func (t *UserAggregate) ApplyEventState(eventState evercore.EventState, eventTime time.Time, reference string) error
type UserApiKeyAddedEvent ¶ added in v0.0.18
type UserApiKeyAddedEvent struct { Id string `json:"id"` OrganizationId int64 `json:"organizationId"` SecretHash string `json:"secretHash"` Name string `json:"name"` CreatedAt int64 `json:"createdAt"` ExpiresAt int64 `json:"expiresAt"` }
evercore:event
func (UserApiKeyAddedEvent) GetEventType ¶ added in v0.0.18
func (a UserApiKeyAddedEvent) GetEventType() string
func (UserApiKeyAddedEvent) Serialize ¶ added in v0.0.18
func (a UserApiKeyAddedEvent) Serialize() string
type UserApiKeyDeletedEvent ¶ added in v0.0.18
type UserApiKeyDeletedEvent struct {
Id string `json:"apiKeyHash"`
}
evercore:event
func (UserApiKeyDeletedEvent) GetEventType ¶ added in v0.0.18
func (a UserApiKeyDeletedEvent) GetEventType() string
func (UserApiKeyDeletedEvent) Serialize ¶ added in v0.0.18
func (a UserApiKeyDeletedEvent) Serialize() string
type UserCreateCommand ¶
type UserCreateCommand struct { Email string `json:"email"` Password string `json:"password"` FirstName string `json:"firstName"` LastName string `json:"lastName"` DisplayName string `json:"displayName"` Verified bool `json:"verified"` GenerateVerificationToken bool `json:"verificationRequired"` }
func (UserCreateCommand) Validate ¶
func (c UserCreateCommand) Validate() (bool, []ubvalidation.ValidationIssue)
type UserCreatedResponse ¶ added in v0.0.11
type UserDeleteApiKeyCommand ¶ added in v0.0.18
type UserDisableCommand ¶
type UserDisableCommand struct {
Id int64 `json:"id"`
}
type UserDisabledEvent ¶
type UserDisabledEvent struct { }
evercore:event
func (UserDisabledEvent) GetEventType ¶
func (a UserDisabledEvent) GetEventType() string
func (UserDisabledEvent) Serialize ¶
func (a UserDisabledEvent) Serialize() string
type UserEnableCommand ¶
type UserEnableCommand struct {
Id int64 `json:"id"`
}
type UserEnabledEvent ¶
type UserEnabledEvent struct { }
evercore:event
func (UserEnabledEvent) GetEventType ¶
func (a UserEnabledEvent) GetEventType() string
func (UserEnabledEvent) Serialize ¶
func (a UserEnabledEvent) Serialize() string
type UserGenerateApiKeyCommand ¶ added in v0.0.18
type UserGenerateApiKeyCommand struct { UserId int64 `json:"userId"` Name string `json:"name"` OrganizationId int64 `json:"organizationId,omitempty"` ExpiresAt time.Time `json:"expiresAt"` }
func (UserGenerateApiKeyCommand) Validate ¶ added in v0.0.21
func (c UserGenerateApiKeyCommand) Validate() (bool, []ubvalidation.ValidationIssue)
type UserGenerateVerificationTokenCommand ¶
type UserGenerateVerificationTokenCommand struct { Id int64 `json:"id"` Regenerate bool `json:"regenerate"` }
func (UserGenerateVerificationTokenCommand) Validate ¶
func (c UserGenerateVerificationTokenCommand) Validate() (bool, []ubvalidation.ValidationIssue)
type UserGenerateVerificationTokenResponse ¶
type UserGenerateVerificationTokenResponse struct {
Token string `json:"token"`
}
type UserLoginCommand ¶
type UserLoginFailedEvent ¶
type UserLoginFailedEvent struct {
Reason string `json:"reason,omitempty"`
}
evercore:event
func (UserLoginFailedEvent) GetEventType ¶
func (a UserLoginFailedEvent) GetEventType() string
func (UserLoginFailedEvent) Serialize ¶
func (a UserLoginFailedEvent) Serialize() string
type UserLoginPartiallySucceededEvent ¶ added in v0.0.16
type UserLoginPartiallySucceededEvent struct { RequiresTwoFactor bool `json:"requiresTwoFactor,omitempty"` RequiresVerification bool `json:"requiresVerify,omitempty"` }
evercore:event
func (UserLoginPartiallySucceededEvent) GetEventType ¶ added in v0.0.16
func (a UserLoginPartiallySucceededEvent) GetEventType() string
func (UserLoginPartiallySucceededEvent) Serialize ¶ added in v0.0.16
func (a UserLoginPartiallySucceededEvent) Serialize() string
type UserLoginSucceededEvent ¶
type UserLoginSucceededEvent struct { }
evercore:event
func (UserLoginSucceededEvent) GetEventType ¶
func (a UserLoginSucceededEvent) GetEventType() string
func (UserLoginSucceededEvent) Serialize ¶
func (a UserLoginSucceededEvent) Serialize() string
type UserRemoveFromRoleCommand ¶
func (UserRemoveFromRoleCommand) Validate ¶
func (c UserRemoveFromRoleCommand) Validate() (bool, []ubvalidation.ValidationIssue)
type UserRemovedFromRoleEvent ¶
evercore:event
func (UserRemovedFromRoleEvent) GetEventType ¶
func (a UserRemovedFromRoleEvent) GetEventType() string
func (UserRemovedFromRoleEvent) Serialize ¶
func (a UserRemovedFromRoleEvent) Serialize() string
type UserRolesAggregate ¶
evercore:aggregate
func (*UserRolesAggregate) ApplyEventState ¶
func (t *UserRolesAggregate) ApplyEventState(eventState evercore.EventState, eventTime time.Time, reference string) error
func (*UserRolesAggregate) ApplySnapshot ¶
func (t *UserRolesAggregate) ApplySnapshot(snapshot *evercore.Snapshot) error
func (*UserRolesAggregate) GetAggregateType ¶
func (t *UserRolesAggregate) GetAggregateType() string
func (*UserRolesAggregate) GetId ¶
func (t *UserRolesAggregate) GetId() int64
func (*UserRolesAggregate) GetSequence ¶
func (t *UserRolesAggregate) GetSequence() int64
func (*UserRolesAggregate) GetSnapshotFrequency ¶
func (t *UserRolesAggregate) GetSnapshotFrequency() int64
func (*UserRolesAggregate) GetSnapshotState ¶
func (t *UserRolesAggregate) GetSnapshotState() (*string, error)
func (*UserRolesAggregate) SetId ¶
func (t *UserRolesAggregate) SetId(id int64)
func (*UserRolesAggregate) SetSequence ¶
func (t *UserRolesAggregate) SetSequence(seq int64)
type UserSetTwoFactorSharedSecretCommand ¶ added in v0.0.11
type UserSetTwoFactorSharedSecretCommand struct {}
type UserState ¶
type UserState struct { Email string `json:"email"` PasswordHash string `json:"passwordHash"` FirstName string `json:"firstName"` LastName string `json:"lastName"` VerificationToken *string `json:"verificationToken,omitempty"` Verified bool `json:"verified"` Disabled bool `json:"disabled"` DisplayName string `json:"displayName"` ResetToken *string `json:"resetToken,omitempty"` LastLogin int64 `json:"lastLogin,omitempty"` LastLoginAttempt int64 `json:"lastLoginAttempt,omitempty"` FailedLoginAttempts int64 `json:"failedLoginAttempts,omitempty"` LoginCount int64 `json:"loginCount,omitempty"` CreatedAt int64 `json:"createdAt,omitempty"` UpdatedAt int64 `json:"updatedAt,omitempty"` ApiKeys []ApiKey `json:"apiKeys,omitempty"` }
type UserTwoFactorAuthenticatedEvent ¶
type UserTwoFactorAuthenticatedEvent struct { }
evercore:event
func (UserTwoFactorAuthenticatedEvent) GetEventType ¶
func (a UserTwoFactorAuthenticatedEvent) GetEventType() string
func (UserTwoFactorAuthenticatedEvent) Serialize ¶
func (a UserTwoFactorAuthenticatedEvent) Serialize() string
type UserTwoFactorDisabledEvent ¶
type UserTwoFactorDisabledEvent struct { }
evercore:event
func (UserTwoFactorDisabledEvent) GetEventType ¶
func (a UserTwoFactorDisabledEvent) GetEventType() string
func (UserTwoFactorDisabledEvent) Serialize ¶
func (a UserTwoFactorDisabledEvent) Serialize() string
type UserTwoFactorEnabledEvent ¶
type UserTwoFactorEnabledEvent struct {
}evercore:event
func (UserTwoFactorEnabledEvent) GetEventType ¶
func (a UserTwoFactorEnabledEvent) GetEventType() string
func (UserTwoFactorEnabledEvent) Serialize ¶
func (a UserTwoFactorEnabledEvent) Serialize() string
type UserUpdateCommand ¶
type UserUpdateCommand struct { Id int64 `json:"id"` Email *string `json:"email"` Password *string `json:"password"` FirstName *string `json:"firstName"` LastName *string `json:"lastName"` DisplayName *string `json:"displayName"` Verified *bool `json:"verified"` }
func (UserUpdateCommand) Validate ¶
func (c UserUpdateCommand) Validate() (bool, []ubvalidation.ValidationIssue)
type UserUpdatedEvent ¶
type UserUpdatedEvent struct { Id int64 `json:"id"` Email *string `json:"email"` PasswordHash *string `json:"passwordHash"` FirstName *string `json:"firstName"` LastName *string `json:"lastName"` DisplayName *string `json:"displayName"` Verified *bool `json:"verified"` }
evercore:state-event
type UserVerificationTokenGeneratedEvent ¶
type UserVerificationTokenGeneratedEvent struct { Token string `json:"token"` Regenerated bool `json:"regenerated"` }
evercore:event
func (UserVerificationTokenGeneratedEvent) GetEventType ¶
func (a UserVerificationTokenGeneratedEvent) GetEventType() string
func (UserVerificationTokenGeneratedEvent) Serialize ¶
func (a UserVerificationTokenGeneratedEvent) Serialize() string
type UserVerificationTokenVerifiedEvent ¶
type UserVerificationTokenVerifiedEvent struct { }
evercore:event
func (UserVerificationTokenVerifiedEvent) GetEventType ¶
func (a UserVerificationTokenVerifiedEvent) GetEventType() string
func (UserVerificationTokenVerifiedEvent) Serialize ¶
func (a UserVerificationTokenVerifiedEvent) Serialize() string