Documentation
¶
Index ¶
- type ConvertToLocalParams
- type CreateUserParams
- type DBTX
- type DeleteOIDCCheckParams
- type EndSessionsOfUserParams
- type GetPasswordSetupParams
- type GetPasswordSetupRow
- type GetUserByLoginParams
- type GetUserByLoginRow
- type GetUserByPublicIDParams
- type GetUserByPublicIDRow
- type GetUserParams
- type GetUserRow
- type InsertPasswordSetupParams
- type ListUserDirectoryParams
- type ListUserDirectoryRow
- type ListUsersParams
- type ListUsersRow
- type LockUserParams
- type MarkPasswordSetupUsedParams
- type PrunePasswordSetupsParams
- type PseudonymizeUserParams
- type Queries
- func (q *Queries) ConvertToLocal(ctx context.Context, arg ConvertToLocalParams) (int64, error)
- func (q *Queries) CountAdmins(ctx context.Context, orgID int64) (int64, error)
- func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (int64, error)
- func (q *Queries) DeleteOIDCCheck(ctx context.Context, arg DeleteOIDCCheckParams) error
- func (q *Queries) EndSessionsOfUser(ctx context.Context, arg EndSessionsOfUserParams) (int64, error)
- func (q *Queries) GetPasswordSetup(ctx context.Context, arg GetPasswordSetupParams) (GetPasswordSetupRow, error)
- func (q *Queries) GetUser(ctx context.Context, arg GetUserParams) (GetUserRow, error)
- func (q *Queries) GetUserByLogin(ctx context.Context, arg GetUserByLoginParams) (GetUserByLoginRow, error)
- func (q *Queries) GetUserByPublicID(ctx context.Context, arg GetUserByPublicIDParams) (GetUserByPublicIDRow, error)
- func (q *Queries) InsertPasswordSetup(ctx context.Context, arg InsertPasswordSetupParams) error
- func (q *Queries) ListUserDirectory(ctx context.Context, arg ListUserDirectoryParams) ([]ListUserDirectoryRow, error)
- func (q *Queries) ListUsers(ctx context.Context, arg ListUsersParams) ([]ListUsersRow, error)
- func (q *Queries) LockActiveAdmins(ctx context.Context, orgID int64) ([]int64, error)
- func (q *Queries) LockUser(ctx context.Context, arg LockUserParams) (int64, error)
- func (q *Queries) MarkPasswordSetupUsed(ctx context.Context, arg MarkPasswordSetupUsedParams) (int64, error)
- func (q *Queries) PrunePasswordSetups(ctx context.Context, arg PrunePasswordSetupsParams) (int64, error)
- func (q *Queries) PseudonymizeUser(ctx context.Context, arg PseudonymizeUserParams) (int64, error)
- func (q *Queries) ResetUserPassword(ctx context.Context, arg ResetUserPasswordParams) (int64, error)
- func (q *Queries) RevokeTokensOfUser(ctx context.Context, arg RevokeTokensOfUserParams) (int64, error)
- func (q *Queries) RoleSyncOn(ctx context.Context, orgID int64) (bool, error)
- func (q *Queries) SetUserPassword(ctx context.Context, arg SetUserPasswordParams) (int64, error)
- func (q *Queries) SetUserStatus(ctx context.Context, arg SetUserStatusParams) (int64, error)
- func (q *Queries) SupersedePasswordSetups(ctx context.Context, arg SupersedePasswordSetupsParams) (int64, error)
- func (q *Queries) UpdateProfile(ctx context.Context, arg UpdateProfileParams) (int64, error)
- func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) (int64, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type ResetUserPasswordParams
- type RevokeTokensOfUserParams
- type SetUserPasswordParams
- type SetUserStatusParams
- type SupersedePasswordSetupsParams
- type UpdateProfileParams
- type UpdateUserParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateUserParams ¶
type DeleteOIDCCheckParams ¶
type EndSessionsOfUserParams ¶
type GetPasswordSetupParams ¶
type GetPasswordSetupRow ¶
type GetPasswordSetupRow struct {
ID int64
UserID int64
ExpiresAt time.Time
UsedAt pgtype.Timestamptz
SupersededAt pgtype.Timestamptz
UserPublicID string
UserName string
}
type GetUserByLoginParams ¶
type GetUserByLoginRow ¶
type GetUserByPublicIDParams ¶
type GetUserByPublicIDRow ¶
type GetUserByPublicIDRow struct {
ID int64
PublicID string
Login string
Name string
Email pgtype.Text
Role string
Source string
Status string
HasPassword bool
HasOidcIdentity bool
HasOfflineToken bool
TimeZone pgtype.Text
Language pgtype.Text
LastSignInAt pgtype.Timestamptz
CreatedAt time.Time
Version int64
TotpEnabled bool
RoleLocked bool
}
type GetUserParams ¶
type GetUserRow ¶
type GetUserRow struct {
ID int64
PublicID string
Login string
Name string
Email pgtype.Text
Role string
Source string
Status string
HasPassword bool
HasOidcIdentity bool
HasOfflineToken bool
TimeZone pgtype.Text
Language pgtype.Text
LastSignInAt pgtype.Timestamptz
CreatedAt time.Time
Version int64
TotpEnabled bool
RoleLocked bool
}
type ListUserDirectoryParams ¶
type ListUserDirectoryRow ¶
type ListUsersParams ¶
type ListUsersRow ¶
type ListUsersRow struct {
ID int64
PublicID string
Login string
Name string
Email pgtype.Text
Role string
Source string
Status string
HasPassword bool
HasOidcIdentity bool
HasOfflineToken bool
TimeZone pgtype.Text
Language pgtype.Text
LastSignInAt pgtype.Timestamptz
CreatedAt time.Time
Version int64
TotpEnabled bool
RoleLocked bool
SortName string
}
type LockUserParams ¶
type PseudonymizeUserParams ¶
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) ConvertToLocal ¶
ConvertToLocal removes the OIDC identity of an account that is not deleted, with its offline token, so that the account signs in with a password once one is set.
func (*Queries) CountAdmins ¶
CountAdmins counts the Admins that are not deleted; a disabled Admin still counts.
func (*Queries) CreateUser ¶
func (*Queries) DeleteOIDCCheck ¶
func (q *Queries) DeleteOIDCCheck(ctx context.Context, arg DeleteOIDCCheckParams) error
DeleteOIDCCheck removes the background re-check of a user whose offline token was wiped: disabled, deleted or converted to local.
func (*Queries) EndSessionsOfUser ¶
func (q *Queries) EndSessionsOfUser(ctx context.Context, arg EndSessionsOfUserParams) (int64, error)
EndSessionsOfUser ends every session of a user that has not ended, with the reason of the administrative action.
func (*Queries) GetPasswordSetup ¶
func (q *Queries) GetPasswordSetup(ctx context.Context, arg GetPasswordSetupParams) (GetPasswordSetupRow, error)
GetPasswordSetup finds a link by the hash of its token and, inside a transaction, locks it, so that it is used once. The transaction locks the user first (LockUser), as every change of a user and its links does.
func (*Queries) GetUser ¶
func (q *Queries) GetUser(ctx context.Context, arg GetUserParams) (GetUserRow, error)
SPDX-License-Identifier: AGPL-3.0-only Copyright The Muster Authors
func (*Queries) GetUserByLogin ¶
func (q *Queries) GetUserByLogin(ctx context.Context, arg GetUserByLoginParams) (GetUserByLoginRow, error)
GetUserByLogin finds an account by its login, compared lowercased.
func (*Queries) GetUserByPublicID ¶
func (q *Queries) GetUserByPublicID(ctx context.Context, arg GetUserByPublicIDParams) (GetUserByPublicIDRow, error)
GetUserByPublicID reads a user by the public_id of the API, deleted users included.
func (*Queries) InsertPasswordSetup ¶
func (q *Queries) InsertPasswordSetup(ctx context.Context, arg InsertPasswordSetupParams) error
func (*Queries) ListUserDirectory ¶
func (q *Queries) ListUserDirectory(ctx context.Context, arg ListUserDirectoryParams) ([]ListUserDirectoryRow, error)
ListUserDirectory is a page of the user directory (C-10.FR-13): every user, deleted ones included, with only what pickers and filters show, in the order of the lowercased name, then id, after the cursor (after_name, after_id) when one is given; q matches the name and the login case-insensitively, never the email.
func (*Queries) ListUsers ¶
func (q *Queries) ListUsers(ctx context.Context, arg ListUsersParams) ([]ListUsersRow, error)
ListUsers is a page of users in the order of their lowercased name, then id, after the cursor (after_name, after_id) when one is given; q matches the name, the login and the email case-insensitively.
func (*Queries) LockActiveAdmins ¶
LockActiveAdmins locks the rows of the active Admins, so that a change that could remove the last of them is decided by one transaction at a time; a row that stopped matching while waiting is left out. Every change that locks them does so before it locks its own user, so that two changes never wait for each other.
func (*Queries) LockUser ¶
LockUser locks the user an administrative change is about, so that it reads the row it changes.
func (*Queries) MarkPasswordSetupUsed ¶
func (*Queries) PrunePasswordSetups ¶
func (q *Queries) PrunePasswordSetups(ctx context.Context, arg PrunePasswordSetupsParams) (int64, error)
PrunePasswordSetups deletes up to batch_size links that expired before @before, used and superseded ones included. A link being used is skipped and taken at the next run.
func (*Queries) PseudonymizeUser ¶
PseudonymizeUser deletes a user: the row stays with the status deleted, name and login become the pseudonym, and the email, the password and the offline token are erased.
func (*Queries) ResetUserPassword ¶
func (q *Queries) ResetUserPassword(ctx context.Context, arg ResetUserPasswordParams) (int64, error)
ResetUserPassword is the emergency reset of the CLI: it sets the password of any account that is not deleted and removes an OIDC identity and its offline token in the same update, so that the account never holds both.
func (*Queries) RevokeTokensOfUser ¶
func (q *Queries) RevokeTokensOfUser(ctx context.Context, arg RevokeTokensOfUserParams) (int64, error)
RevokeTokensOfUser revokes the Personal access tokens of a deleted user with the reason owner_deleted (C-04.FR-1).
func (*Queries) RoleSyncOn ¶
RoleSyncOn reports whether the identity provider decides the Role of OIDC accounts: OIDC and oidc.sync_role are both on.
func (*Queries) SetUserPassword ¶
SetUserPassword sets the password of a local account that is not deleted.
func (*Queries) SetUserStatus ¶
SetUserStatus disables or enables a user that is not deleted; disabling wipes the offline token of an OIDC account.
func (*Queries) SupersedePasswordSetups ¶
func (q *Queries) SupersedePasswordSetups(ctx context.Context, arg SupersedePasswordSetupsParams) (int64, error)
SupersedePasswordSetups marks the open links of a user as replaced, before a newer one is issued or the user is deleted.
func (*Queries) UpdateProfile ¶
UpdateProfile changes what the user edits in the profile: the display name, the time zone and the language.
func (*Queries) UpdateUser ¶
UpdateUser changes what an Admin edits: the name, the email and the Role, at the version that was read.