Documentation ¶
Index ¶
- Constants
- Variables
- func Add(ctx context.Context, user *model.User, ug *model.AgentUserGroup) (model.UserID, error)
- func AddSCIMUser(ctx context.Context, suser *model.SCIMUser) (*model.SCIMUser, error)
- func AddUserTx(ctx context.Context, idb bun.IDB, user *model.User) (model.UserID, error)
- func ByID(ctx context.Context, userID model.UserID) (*model.FullUser, error)
- func BySessionID(ctx context.Context, sessionID model.SessionID) (*model.User, error)
- func ByToken(ctx context.Context, token string, ext *model.ExternalSessions) (*model.User, *model.UserSession, error)
- func ByUsername(ctx context.Context, username string) (*model.User, error)
- func DeleteSessionByID(ctx context.Context, sessionID model.SessionID) error
- func DeleteSessionByToken(ctx context.Context, token string) error
- func GetAgentUserGroup(ctx context.Context, userID model.UserID, workspaceID int) (*model.AgentUserGroup, error)
- func GetUserSetting(ctx context.Context, userID model.UserID) ([]*model.UserWebSetting, error)
- func InitService(db *db.PgDB, extConfig *model.ExternalSessions)
- func List(ctx context.Context) (values []model.FullUser, err error)
- func NewCookieFromToken(token string) *http.Cookie
- func ProfileImage(ctx context.Context, username string) (photo []byte, err error)
- func RegisterAPIHandler(echo *echo.Echo, m *Service, middleware ...echo.MiddlewareFunc)
- func ReplicateClientSideSaltAndHash(password string) string
- func ResetUserSetting(ctx context.Context, userID model.UserID) error
- func RetrofitSCIMUser(ctx context.Context, suser *model.SCIMUser, userID model.UserID) (*model.SCIMUser, error)
- func SCIMUserByID(ctx context.Context, tx bun.IDB, id model.UUID) (*model.SCIMUser, error)
- func SCIMUserList(ctx context.Context, startIndex, count int, username string) (*model.SCIMUsers, error)
- func ScimUserByAttribute(ctx context.Context, name string, value string) (*model.SCIMUser, error)
- func SetActive(ctx context.Context, updateIDs []model.UserID, activate bool) error
- func SetSCIMUser(ctx context.Context, id string, user *model.SCIMUser) (*model.SCIMUser, error)
- func SetUserPassword(ctx context.Context, username, password string) error
- func StartSession(ctx context.Context, user *model.User, opts ...UserSessionOption) (string, error)
- func Update(ctx context.Context, updated *model.User, toUpdate []string, ...) error
- func UpdateUserAndDeleteSession(ctx context.Context, id string, user *model.SCIMUser, fields []string) (*model.SCIMUser, error)
- func UpdateUserSetting(ctx context.Context, settings []*model.UserWebSetting) error
- func UpdateUsername(ctx context.Context, userID *model.UserID, newUsername string) error
- func UserBySCIMAttribute(ctx context.Context, name string, value string) (*model.User, error)
- type Service
- type UserAuthZ
- type UserAuthZBasic
- func (a *UserAuthZBasic) CanCreateUser(ctx context.Context, curUser, userToAdd model.User, ...) error
- func (a *UserAuthZBasic) CanCreateUsersOwnSetting(ctx context.Context, curUser model.User, settings []*model.UserWebSetting) error
- func (a *UserAuthZBasic) CanGetUser(ctx context.Context, curUser, targetUser model.User) error
- func (a *UserAuthZBasic) CanGetUsersImage(ctx context.Context, curUser, targetUser model.User) error
- func (a *UserAuthZBasic) CanGetUsersOwnSettings(ctx context.Context, curUser model.User) error
- func (a *UserAuthZBasic) CanResetUsersOwnSettings(ctx context.Context, curUser model.User) error
- func (a *UserAuthZBasic) CanSetUsersActive(ctx context.Context, curUser, targetUser model.User, toActiveVal bool) error
- func (a *UserAuthZBasic) CanSetUsersAdmin(ctx context.Context, curUser, targetUser model.User, toAdminVal bool) error
- func (a *UserAuthZBasic) CanSetUsersAgentUserGroup(ctx context.Context, curUser, targetUser model.User, ...) error
- func (a *UserAuthZBasic) CanSetUsersDisplayName(ctx context.Context, curUser, targetUser model.User) error
- func (a *UserAuthZBasic) CanSetUsersPassword(ctx context.Context, curUser, targetUser model.User) error
- func (a *UserAuthZBasic) CanSetUsersRemote(ctx context.Context, curUser model.User) error
- func (a *UserAuthZBasic) CanSetUsersUsername(ctx context.Context, curUser, targetUser model.User) error
- func (a *UserAuthZBasic) FilterUserList(ctx context.Context, curUser model.User, users []model.FullUser) ([]model.FullUser, error)
- type UserAuthZPermissive
- func (p *UserAuthZPermissive) CanCreateUser(ctx context.Context, curUser, userToAdd model.User, ...) error
- func (p *UserAuthZPermissive) CanCreateUsersOwnSetting(ctx context.Context, curUser model.User, settings []*model.UserWebSetting) error
- func (p *UserAuthZPermissive) CanGetUser(ctx context.Context, curUser, targetUser model.User) error
- func (p *UserAuthZPermissive) CanGetUsersImage(ctx context.Context, curUser, targetUser model.User) error
- func (p *UserAuthZPermissive) CanGetUsersOwnSettings(ctx context.Context, curUser model.User) error
- func (p *UserAuthZPermissive) CanResetUsersOwnSettings(ctx context.Context, curUser model.User) error
- func (p *UserAuthZPermissive) CanSetUsersActive(ctx context.Context, curUser, targetUser model.User, toActiveVal bool) error
- func (p *UserAuthZPermissive) CanSetUsersAdmin(ctx context.Context, curUser, targetUser model.User, toAdminVal bool) error
- func (p *UserAuthZPermissive) CanSetUsersAgentUserGroup(ctx context.Context, curUser, targetUser model.User, ...) error
- func (p *UserAuthZPermissive) CanSetUsersDisplayName(ctx context.Context, curUser, targetUser model.User) error
- func (p *UserAuthZPermissive) CanSetUsersPassword(ctx context.Context, curUser, targetUser model.User) error
- func (p *UserAuthZPermissive) CanSetUsersRemote(ctx context.Context, curUser model.User) error
- func (p *UserAuthZPermissive) CanSetUsersUsername(ctx context.Context, curUser, targetUser model.User) error
- func (p *UserAuthZPermissive) FilterUserList(ctx context.Context, curUser model.User, users []model.FullUser) ([]model.FullUser, error)
- type UserAuthZRBAC
- func (a *UserAuthZRBAC) CanCreateUser(ctx context.Context, curUser, userToAdd model.User, ...) error
- func (a *UserAuthZRBAC) CanCreateUsersOwnSetting(ctx context.Context, curUser model.User, setting []*model.UserWebSetting) error
- func (a *UserAuthZRBAC) CanGetUser(ctx context.Context, curUser, targetUser model.User) error
- func (a *UserAuthZRBAC) CanGetUsersImage(ctx context.Context, curUser, targetUser model.User) error
- func (a *UserAuthZRBAC) CanGetUsersOwnSettings(ctx context.Context, curUser model.User) error
- func (a *UserAuthZRBAC) CanResetUsersOwnSettings(ctx context.Context, curUser model.User) error
- func (a *UserAuthZRBAC) CanSetUsersActive(ctx context.Context, curUser, targetUser model.User, toActiveVal bool) error
- func (a *UserAuthZRBAC) CanSetUsersAdmin(ctx context.Context, curUser, targetUser model.User, toAdminVal bool) error
- func (a *UserAuthZRBAC) CanSetUsersAgentUserGroup(ctx context.Context, curUser, targetUser model.User, ...) error
- func (a *UserAuthZRBAC) CanSetUsersDisplayName(ctx context.Context, curUser, targetUser model.User) (err error)
- func (a *UserAuthZRBAC) CanSetUsersPassword(ctx context.Context, curUser, targetUser model.User) (err error)
- func (a *UserAuthZRBAC) CanSetUsersRemote(ctx context.Context, curUser model.User) error
- func (a *UserAuthZRBAC) CanSetUsersUsername(ctx context.Context, curUser, targetUser model.User) error
- func (a *UserAuthZRBAC) FilterUserList(ctx context.Context, curUser model.User, users []model.FullUser) ([]model.FullUser, error)
- type UserProfileImage
- type UserSessionOption
Constants ¶
const ( // SessionDuration is how long a newly created session is valid. SessionDuration = 7 * 24 * time.Hour // PersonalGroupPostfix is the system postfix appended to the username of all personal groups. PersonalGroupPostfix = "DeterminedPersonalGroup" )
Variables ¶
var AuthZProvider authz.AuthZProviderType[UserAuthZ]
AuthZProvider is the authz registry for `user` package.
var BuiltInUsers = []string{determinedUsername, adminUsername}
BuiltInUsers are created in the DB by the initial migration. They exist on every installation unless the admin has removed them.
var ErrRemoteUserTokenExpired = status.Error(codes.Unauthenticated, "remote user token expired")
ErrRemoteUserTokenExpired notifies that the remote user's token has expired.
Functions ¶
func AddSCIMUser ¶
AddSCIMUser adds a user as well as additional SCIM-specific fields. If the user already exists, this function will return an error.
func AddUserTx ¶
AddUserTx & addAgentUserGroup are helper methods for Add & Update. AddUserTx UPSERT's the existence of a new user.
func BySessionID ¶
BySessionID looks up a user by session ID in the database.
func ByToken ¶
func ByToken(ctx context.Context, token string, ext *model.ExternalSessions) ( *model.User, *model.UserSession, error, )
ByToken returns a user session given an authentication token. If a session belonging to a remote (SSO) user is found but has expired, ErrRemoteUserTokenExpired will be returned.
func ByUsername ¶
ByUsername looks up a user by name in the database.
func DeleteSessionByID ¶
DeleteSessionByID deletes the user session with the given ID.
func DeleteSessionByToken ¶
DeleteSessionByToken deletes user session if found (externally managed sessions are not stored in the DB and will not be found).
func GetAgentUserGroup ¶
func GetAgentUserGroup( ctx context.Context, userID model.UserID, workspaceID int, ) (*model.AgentUserGroup, error)
GetAgentUserGroup returns AgentUserGroup for a user + (optional) workspace.
func GetUserSetting ¶
GetUserSetting gets user setting.
func InitService ¶
func InitService(db *db.PgDB, extConfig *model.ExternalSessions)
InitService creates the user service singleton.
func NewCookieFromToken ¶
NewCookieFromToken creates a new cookie from the given token.
func ProfileImage ¶
ProfileImage returns the profile picture associated with the user.
func RegisterAPIHandler ¶
func RegisterAPIHandler(echo *echo.Echo, m *Service, middleware ...echo.MiddlewareFunc)
RegisterAPIHandler initializes and registers the API handlers for all command related features.
func ReplicateClientSideSaltAndHash ¶
ReplicateClientSideSaltAndHash replicates the password salt and hash done on the client side. We need this because we hash passwords on the client side, but when SCIM posts a user with a password to password sync, it doesn't - so when we try to log in later, we get a weird, unrecognizable sha512 hash from the frontend.
func ResetUserSetting ¶
ResetUserSetting resets user setting.
func RetrofitSCIMUser ¶
func RetrofitSCIMUser(ctx context.Context, suser *model.SCIMUser, userID model.UserID) (*model.SCIMUser, error)
RetrofitSCIMUser "upgrades" an existing user to one tracked in the SCIM table. This is a temporary measure for SaaS clusters to migrate existing users to SCIM users.
func SCIMUserByID ¶
SCIMUserByID returns the SCIM user with the given ID.
func SCIMUserList ¶
func SCIMUserList(ctx context.Context, startIndex, count int, username string) (*model.SCIMUsers, error)
SCIMUserList returns at most count SCIM users starting at startIndex (1-indexed). If username is set, restrict results to users with the matching username.
func ScimUserByAttribute ¶
ScimUserByAttribute returns the SCIM user with the given value for the given attribute.
func SetSCIMUser ¶
SetSCIMUser updates fields on an existing SCIM user.
func SetUserPassword ¶
SetUserPassword sets the password of the user with the given username to the plaintext string provided.
func StartSession ¶
StartSession creates a row in the user_sessions table.
func Update ¶
func Update( ctx context.Context, updated *model.User, toUpdate []string, ug *model.AgentUserGroup, ) error
Update updates an existing user. `toUpdate` names the fields to update.
func UpdateUserAndDeleteSession ¶
func UpdateUserAndDeleteSession( ctx context.Context, id string, user *model.SCIMUser, fields []string, ) (*model.SCIMUser, error)
UpdateUserAndDeleteSession updates some fields on an existing SCIM user and deletes the user session if inactive.
func UpdateUserSetting ¶
func UpdateUserSetting(ctx context.Context, settings []*model.UserWebSetting) error
UpdateUserSetting updates user setting.
func UpdateUsername ¶
UpdateUsername updates an existing user's username.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service describes a user manager.
func GetService ¶
func GetService() *Service
GetService returns a reference to the user service singleton.
func (*Service) ProcessAuthentication ¶
func (s *Service) ProcessAuthentication(next echo.HandlerFunc) echo.HandlerFunc
ProcessAuthentication is a middleware processing function that attempts to authenticate incoming HTTP requests.
func (*Service) UserAndNotebookSessionFromToken ¶
func (s *Service) UserAndNotebookSessionFromToken( token string, ) (*model.User, *model.NotebookSession, error)
UserAndNotebookSessionFromToken gets the user and notebook session for a given token.
func (*Service) UserAndSessionFromRequest ¶
func (s *Service) UserAndSessionFromRequest( r *http.Request, ) (*model.User, *model.UserSession, error)
UserAndSessionFromRequest gets the user and session corresponding to the given request.
type UserAuthZ ¶
type UserAuthZ interface { // GET /api/v1/users/:user_id // Denying a user shouldn't return an error. Only a server error that needs to be // reported to the user should return an errr. CanGetUser(ctx context.Context, curUser, targetUser model.User) error // GET /users // GET /api/v1/users // FilterUserList normally shouldn't return an error. It should just remove // users that the requesting user shouldn't see. It returns an error directly without // indication it occurred during a filtering stage to bubble up a failure to the user. FilterUserList(ctx context.Context, curUser model.User, users []model.FullUser) ( []model.FullUser, error) // POST /user // POST /api/v1/users CanCreateUser( ctx context.Context, curUser, userToAdd model.User, agentUserGroup *model.AgentUserGroup, ) error // PATCH /users/:username // POST /api/v1/users/:user_id/password CanSetUsersPassword(ctx context.Context, curUser, targetUser model.User) error // PATCH /users/:username CanSetUsersActive(ctx context.Context, curUser, targetUser model.User, toActiveVal bool) error // PATCH /users/:username CanSetUsersAdmin(ctx context.Context, curUser, targetUser model.User, toAdminVal bool) error // PATCH /users/:username CanSetUsersRemote(ctx context.Context, curUser model.User) error // PATCH /users/:username CanSetUsersAgentUserGroup( ctx context.Context, curUser, targetUser model.User, agentUserGroup model.AgentUserGroup, ) error // PATCH /users/:username/username CanSetUsersUsername(ctx context.Context, curUser, targetUser model.User) error // PATCH /api/v1/users/:user_id CanSetUsersDisplayName(ctx context.Context, curUser, targetUser model.User) error // GET /users/:username/image CanGetUsersImage(ctx context.Context, curUser, targetUsername model.User) error // GET /api/v1/users/setting CanGetUsersOwnSettings(ctx context.Context, curUser model.User) error // POST /api/v1/users/setting CanCreateUsersOwnSetting( ctx context.Context, curUser model.User, settings []*model.UserWebSetting, ) error // POST /api/v1/users/setting/reset CanResetUsersOwnSettings(ctx context.Context, curUser model.User) error }
UserAuthZ describes authz methods for `user` package.
type UserAuthZBasic ¶
type UserAuthZBasic struct{}
UserAuthZBasic is basic OSS controls.
func (*UserAuthZBasic) CanCreateUser ¶
func (a *UserAuthZBasic) CanCreateUser( ctx context.Context, curUser, userToAdd model.User, agentUserGroup *model.AgentUserGroup, ) error
CanCreateUser returns an error if the user is not an admin.
func (*UserAuthZBasic) CanCreateUsersOwnSetting ¶
func (a *UserAuthZBasic) CanCreateUsersOwnSetting( ctx context.Context, curUser model.User, settings []*model.UserWebSetting, ) error
CanCreateUsersOwnSetting always returns nil.
func (*UserAuthZBasic) CanGetUser ¶
CanGetUser always returns nil.
func (*UserAuthZBasic) CanGetUsersImage ¶
func (a *UserAuthZBasic) CanGetUsersImage( ctx context.Context, curUser, targetUser model.User, ) error
CanGetUsersImage always returns nil.
func (*UserAuthZBasic) CanGetUsersOwnSettings ¶
CanGetUsersOwnSettings always returns nil.
func (*UserAuthZBasic) CanResetUsersOwnSettings ¶
CanResetUsersOwnSettings always returns nil.
func (*UserAuthZBasic) CanSetUsersActive ¶
func (a *UserAuthZBasic) CanSetUsersActive( ctx context.Context, curUser, targetUser model.User, toActiveVal bool, ) error
CanSetUsersActive returns an error if the user is not an admin.
func (*UserAuthZBasic) CanSetUsersAdmin ¶
func (a *UserAuthZBasic) CanSetUsersAdmin( ctx context.Context, curUser, targetUser model.User, toAdminVal bool, ) error
CanSetUsersAdmin returns an error if the user is not an admin.
func (*UserAuthZBasic) CanSetUsersAgentUserGroup ¶
func (a *UserAuthZBasic) CanSetUsersAgentUserGroup( ctx context.Context, curUser, targetUser model.User, agentUserGroup model.AgentUserGroup, ) error
CanSetUsersAgentUserGroup returns an error if the user is not an admin.
func (*UserAuthZBasic) CanSetUsersDisplayName ¶
func (a *UserAuthZBasic) CanSetUsersDisplayName( ctx context.Context, curUser, targetUser model.User, ) error
CanSetUsersDisplayName returns an error if the user is not an admin when trying to set another user's display name.
func (*UserAuthZBasic) CanSetUsersPassword ¶
func (a *UserAuthZBasic) CanSetUsersPassword( ctx context.Context, curUser, targetUser model.User, ) error
CanSetUsersPassword returns an error if the user is not an admin when trying to set another user's password.
func (*UserAuthZBasic) CanSetUsersRemote ¶
CanSetUsersRemote returns an error if the user is not an admin.
func (*UserAuthZBasic) CanSetUsersUsername ¶
func (a *UserAuthZBasic) CanSetUsersUsername( ctx context.Context, curUser, targetUser model.User, ) error
CanSetUsersUsername returns an error if the user is not an admin.
type UserAuthZPermissive ¶
type UserAuthZPermissive struct{}
UserAuthZPermissive is the permission implementation.
func (*UserAuthZPermissive) CanCreateUser ¶
func (p *UserAuthZPermissive) CanCreateUser( ctx context.Context, curUser, userToAdd model.User, agentUserGroup *model.AgentUserGroup, ) error
CanCreateUser calls RBAC authz but enforces basic authz.
func (*UserAuthZPermissive) CanCreateUsersOwnSetting ¶
func (p *UserAuthZPermissive) CanCreateUsersOwnSetting( ctx context.Context, curUser model.User, settings []*model.UserWebSetting, ) error
CanCreateUsersOwnSetting calls RBAC authz but enforces basic authz.
func (*UserAuthZPermissive) CanGetUser ¶
func (p *UserAuthZPermissive) CanGetUser( ctx context.Context, curUser, targetUser model.User, ) error
CanGetUser calls RBAC authz but enforces basic authz.
func (*UserAuthZPermissive) CanGetUsersImage ¶
func (p *UserAuthZPermissive) CanGetUsersImage( ctx context.Context, curUser, targetUser model.User, ) error
CanGetUsersImage calls RBAC authz but enforces basic authz.
func (*UserAuthZPermissive) CanGetUsersOwnSettings ¶
func (p *UserAuthZPermissive) CanGetUsersOwnSettings( ctx context.Context, curUser model.User, ) error
CanGetUsersOwnSettings calls RBAC authz but enforces basic authz.
func (*UserAuthZPermissive) CanResetUsersOwnSettings ¶
func (p *UserAuthZPermissive) CanResetUsersOwnSettings( ctx context.Context, curUser model.User, ) error
CanResetUsersOwnSettings calls RBAC authz but enforces basic authz.
func (*UserAuthZPermissive) CanSetUsersActive ¶
func (p *UserAuthZPermissive) CanSetUsersActive( ctx context.Context, curUser, targetUser model.User, toActiveVal bool, ) error
CanSetUsersActive calls RBAC authz but enforces basic authz.
func (*UserAuthZPermissive) CanSetUsersAdmin ¶
func (p *UserAuthZPermissive) CanSetUsersAdmin( ctx context.Context, curUser, targetUser model.User, toAdminVal bool, ) error
CanSetUsersAdmin calls RBAC authz but enforces basic authz.
func (*UserAuthZPermissive) CanSetUsersAgentUserGroup ¶
func (p *UserAuthZPermissive) CanSetUsersAgentUserGroup( ctx context.Context, curUser, targetUser model.User, agentUserGroup model.AgentUserGroup, ) error
CanSetUsersAgentUserGroup calls RBAC authz but enforces basic authz.
func (*UserAuthZPermissive) CanSetUsersDisplayName ¶
func (p *UserAuthZPermissive) CanSetUsersDisplayName( ctx context.Context, curUser, targetUser model.User, ) error
CanSetUsersDisplayName calls RBAC authz but enforces basic authz.
func (*UserAuthZPermissive) CanSetUsersPassword ¶
func (p *UserAuthZPermissive) CanSetUsersPassword( ctx context.Context, curUser, targetUser model.User, ) error
CanSetUsersPassword calls RBAC authz but enforces basic authz.
func (*UserAuthZPermissive) CanSetUsersRemote ¶
CanSetUsersRemote calls RBAC authz but enforces basic authz.
func (*UserAuthZPermissive) CanSetUsersUsername ¶
func (p *UserAuthZPermissive) CanSetUsersUsername( ctx context.Context, curUser, targetUser model.User, ) error
CanSetUsersUsername calls RBAC authz but enforces basic authz.
type UserAuthZRBAC ¶
type UserAuthZRBAC struct{}
UserAuthZRBAC is the RBAC implementation of user authorization.
func (*UserAuthZRBAC) CanCreateUser ¶
func (a *UserAuthZRBAC) CanCreateUser( ctx context.Context, curUser, userToAdd model.User, agentUserGroup *model.AgentUserGroup, ) error
CanCreateUser returns an error if the user does not have admin permissions or does not have permission to update groups.
func (*UserAuthZRBAC) CanCreateUsersOwnSetting ¶
func (a *UserAuthZRBAC) CanCreateUsersOwnSetting( ctx context.Context, curUser model.User, setting []*model.UserWebSetting, ) error
CanCreateUsersOwnSetting always returns nil.
func (*UserAuthZRBAC) CanGetUser ¶
CanGetUser always returns true.
func (*UserAuthZRBAC) CanGetUsersImage ¶
func (a *UserAuthZRBAC) CanGetUsersImage( ctx context.Context, curUser, targetUser model.User, ) error
CanGetUsersImage always returns nil.
func (*UserAuthZRBAC) CanGetUsersOwnSettings ¶
CanGetUsersOwnSettings always returns nil.
func (*UserAuthZRBAC) CanResetUsersOwnSettings ¶
CanResetUsersOwnSettings always returns nil.
func (*UserAuthZRBAC) CanSetUsersActive ¶
func (a *UserAuthZRBAC) CanSetUsersActive( ctx context.Context, curUser, targetUser model.User, toActiveVal bool, ) error
CanSetUsersActive returns an error if the user does not have admin permissions.
func (*UserAuthZRBAC) CanSetUsersAdmin ¶
func (a *UserAuthZRBAC) CanSetUsersAdmin( ctx context.Context, curUser, targetUser model.User, toAdminVal bool, ) error
CanSetUsersAdmin returns an error if the user does not have admin permissions.
func (*UserAuthZRBAC) CanSetUsersAgentUserGroup ¶
func (a *UserAuthZRBAC) CanSetUsersAgentUserGroup( ctx context.Context, curUser, targetUser model.User, agentUserGroup model.AgentUserGroup, ) error
CanSetUsersAgentUserGroup returns an error if the user does not have admin permissions.
func (*UserAuthZRBAC) CanSetUsersDisplayName ¶
func (a *UserAuthZRBAC) CanSetUsersDisplayName( ctx context.Context, curUser, targetUser model.User, ) (err error)
CanSetUsersDisplayName returns an error if the user is not an admin and does not have admin permissions when trying to set another user's display name.
func (*UserAuthZRBAC) CanSetUsersPassword ¶
func (a *UserAuthZRBAC) CanSetUsersPassword( ctx context.Context, curUser, targetUser model.User, ) (err error)
CanSetUsersPassword returns an error if the user is not the target user and does not have admin permissions when trying to set another user's password.
func (*UserAuthZRBAC) CanSetUsersRemote ¶
CanSetUsersRemote returns an error if the user does not have admin permissions.
func (*UserAuthZRBAC) CanSetUsersUsername ¶
func (a *UserAuthZRBAC) CanSetUsersUsername( ctx context.Context, curUser, targetUser model.User, ) error
CanSetUsersUsername returns an error if the user does not have admin permissions.
type UserProfileImage ¶
type UserProfileImage struct { bun.BaseModel `bun:"table:user_profile_images"` ID int `bun:"id,pk,autoincrement"` UserID model.UserID `bun:"user_id"` FileData []byte `bun:"file_data"` }
A UserProfileImage row just contains the profile image data. It is probably split into another table to avoid medium sized images missing TOAST and slowing scans down, but I'm not sure since I didn't write this code.
type UserSessionOption ¶
type UserSessionOption func(f *model.UserSession)
UserSessionOption is the return type for WithInheritedClaims helper function.
func WithInheritedClaims ¶
func WithInheritedClaims(claims map[string]string) UserSessionOption
WithInheritedClaims function will add the specified inherited claims to the user session.