Documentation ¶
Index ¶
- Constants
- Variables
- type AdminCreateUserResponse
- type AnalyticsSettings
- type AuthModuleConversion
- type BatchDisableUsersCommand
- type ChangeUserPasswordCommand
- type CreateUserCommand
- type DeleteUserCommand
- type DisableUserCommand
- type ErrCaseInsensitiveLoginConflict
- type Filter
- type FilterHandler
- type GetSignedInUserQuery
- type GetUserByEmailQuery
- type GetUserByIDQuery
- type GetUserByLoginQuery
- type GetUserProfileQuery
- type HelpFlags1
- type InCondition
- type JoinCondition
- type Password
- type SearchUserFilter
- type SearchUserQueryResult
- type SearchUsersQuery
- type Service
- type SetUserHelpFlagCommand
- type SetUsingOrgCommand
- type SignedInUser
- func (u *SignedInUser) GetCacheKey() (string, error)
- func (u *SignedInUser) HasRole(role roletype.RoleType) bool
- func (u *SignedInUser) HasUniqueId() bool
- func (u *SignedInUser) IsApiKeyUser() bool
- func (u *SignedInUser) IsRealUser() bool
- func (u *SignedInUser) IsServiceAccountUser() bool
- func (u *SignedInUser) NameOrFallback() string
- func (u *SignedInUser) ShouldUpdateLastSeenAt() bool
- func (u *SignedInUser) ToUserDisplayDTO() *UserDisplayDTO
- type UpdateUserCommand
- type UpdateUserLastSeenAtCommand
- type User
- type UserDisplayDTO
- type UserProfileDTO
- type UserSearchHitDTO
- type WhereCondition
Constants ¶
View Source
const ( QuotaTargetSrv string = "user" QuotaTarget string = "user" )
Variables ¶
View Source
var ( ErrCaseInsensitive = errors.New("case insensitive conflict") ErrUserNotFound = errors.New("user not found") ErrUserAlreadyExists = errors.New("user already exists") ErrLastGrafanaAdmin = errors.New("cannot remove last grafana admin") ErrProtectedUser = errors.New("cannot adopt protected user") ErrNoUniqueID = errors.New("identifying id not found") ErrLastSeenUpToDate = errors.New("last seen is already up to date") )
Typed errors
Functions ¶
This section is empty.
Types ¶
type AdminCreateUserResponse ¶
type AnalyticsSettings ¶
type AuthModuleConversion ¶
type AuthModuleConversion []string
implement Conversion interface to define custom field mapping (xorm feature)
func (*AuthModuleConversion) FromDB ¶
func (auth *AuthModuleConversion) FromDB(data []byte) error
func (*AuthModuleConversion) ToDB ¶
func (auth *AuthModuleConversion) ToDB() ([]byte, error)
Just a stub, we don't want to write to database
type CreateUserCommand ¶
type DeleteUserCommand ¶
type DeleteUserCommand struct {
UserID int64
}
type DisableUserCommand ¶
type ErrCaseInsensitiveLoginConflict ¶
type ErrCaseInsensitiveLoginConflict struct {
Users []User
}
func (*ErrCaseInsensitiveLoginConflict) Error ¶
func (e *ErrCaseInsensitiveLoginConflict) Error() string
func (*ErrCaseInsensitiveLoginConflict) Unwrap ¶
func (e *ErrCaseInsensitiveLoginConflict) Unwrap() error
type Filter ¶
type Filter interface { WhereCondition() *WhereCondition InCondition() *InCondition JoinCondition() *JoinCondition }
type FilterHandler ¶
type GetSignedInUserQuery ¶
type GetUserByEmailQuery ¶
type GetUserByEmailQuery struct {
Email string
}
type GetUserByIDQuery ¶
type GetUserByIDQuery struct {
ID int64
}
type GetUserByLoginQuery ¶
type GetUserByLoginQuery struct {
LoginOrEmail string
}
type GetUserProfileQuery ¶
type GetUserProfileQuery struct {
UserID int64
}
type HelpFlags1 ¶
type HelpFlags1 uint64
const ( HelpFlagGettingStartedPanelDismissed HelpFlags1 = 1 << iota HelpFlagDashboardHelp1 )
func (*HelpFlags1) AddFlag ¶
func (f *HelpFlags1) AddFlag(flag HelpFlags1)
func (HelpFlags1) HasFlag ¶
func (f HelpFlags1) HasFlag(flag HelpFlags1) bool
type InCondition ¶
type InCondition struct { Condition string Params interface{} }
type JoinCondition ¶
type SearchUserFilter ¶
type SearchUserFilter interface { GetFilter(filterName string, params []string) Filter GetFilterList() map[string]FilterHandler }
type SearchUserQueryResult ¶
type SearchUserQueryResult struct { TotalCount int64 `json:"totalCount"` Users []*UserSearchHitDTO `json:"users"` Page int `json:"page"` PerPage int `json:"perPage"` }
type SearchUsersQuery ¶
type Service ¶
type Service interface { registry.ProvidesUsageStats Create(context.Context, *CreateUserCommand) (*User, error) CreateServiceAccount(context.Context, *CreateUserCommand) (*User, error) Delete(context.Context, *DeleteUserCommand) error GetByID(context.Context, *GetUserByIDQuery) (*User, error) GetByLogin(context.Context, *GetUserByLoginQuery) (*User, error) GetByEmail(context.Context, *GetUserByEmailQuery) (*User, error) Update(context.Context, *UpdateUserCommand) error ChangePassword(context.Context, *ChangeUserPasswordCommand) error UpdateLastSeenAt(context.Context, *UpdateUserLastSeenAtCommand) error SetUsingOrg(context.Context, *SetUsingOrgCommand) error GetSignedInUserWithCacheCtx(context.Context, *GetSignedInUserQuery) (*SignedInUser, error) GetSignedInUser(context.Context, *GetSignedInUserQuery) (*SignedInUser, error) NewAnonymousSignedInUser(context.Context) (*SignedInUser, error) Search(context.Context, *SearchUsersQuery) (*SearchUserQueryResult, error) Disable(context.Context, *DisableUserCommand) error BatchDisableUsers(context.Context, *BatchDisableUsersCommand) error UpdatePermissions(context.Context, int64, bool) error SetUserHelpFlag(context.Context, *SetUserHelpFlagCommand) error GetProfile(context.Context, *GetUserProfileQuery) (*UserProfileDTO, error) }
type SetUserHelpFlagCommand ¶
type SetUserHelpFlagCommand struct { HelpFlags1 HelpFlags1 UserID int64 `xorm:"user_id"` }
type SetUsingOrgCommand ¶
type SignedInUser ¶
type SignedInUser struct { UserID int64 `xorm:"user_id"` OrgID int64 `xorm:"org_id"` OrgName string OrgRole roletype.RoleType Login string Name string Email string AuthenticatedBy string ApiKeyID int64 `xorm:"api_key_id"` IsServiceAccount bool `xorm:"is_service_account"` OrgCount int IsGrafanaAdmin bool IsAnonymous bool IsDisabled bool HelpFlags1 HelpFlags1 LastSeenAt time.Time Teams []int64 // Permissions grouped by orgID and actions Permissions map[int64]map[string][]string `json:"-"` }
func (*SignedInUser) GetCacheKey ¶
func (u *SignedInUser) GetCacheKey() (string, error)
func (*SignedInUser) HasUniqueId ¶
func (u *SignedInUser) HasUniqueId() bool
func (*SignedInUser) IsApiKeyUser ¶
func (u *SignedInUser) IsApiKeyUser() bool
func (*SignedInUser) IsRealUser ¶
func (u *SignedInUser) IsRealUser() bool
IsRealUser returns true if the user is a real user and not a service account
func (*SignedInUser) IsServiceAccountUser ¶
func (u *SignedInUser) IsServiceAccountUser() bool
IsServiceAccountUser returns true if the user is a service account
func (*SignedInUser) NameOrFallback ¶
func (u *SignedInUser) NameOrFallback() string
func (*SignedInUser) ShouldUpdateLastSeenAt ¶
func (u *SignedInUser) ShouldUpdateLastSeenAt() bool
func (*SignedInUser) ToUserDisplayDTO ¶
func (u *SignedInUser) ToUserDisplayDTO() *UserDisplayDTO
type UpdateUserCommand ¶
type User ¶
type User struct { ID int64 `xorm:"pk autoincr 'id'"` Version int Email string Name string Login string Password string Salt string Rands string Company string EmailVerified bool Theme string HelpFlags1 HelpFlags1 IsDisabled bool IsAdmin bool IsServiceAccount bool OrgID int64 `xorm:"org_id"` Created time.Time Updated time.Time LastSeenAt time.Time }
func (*User) NameOrFallback ¶
type UserDisplayDTO ¶
type UserProfileDTO ¶
type UserProfileDTO struct { ID int64 `json:"id"` Email string `json:"email"` Name string `json:"name"` Login string `json:"login"` Theme string `json:"theme"` OrgID int64 `json:"orgId,omitempty"` IsGrafanaAdmin bool `json:"isGrafanaAdmin"` IsDisabled bool `json:"isDisabled"` IsExternal bool `json:"isExternal"` IsExternallySynced bool `json:"isExternallySynced"` AuthLabels []string `json:"authLabels"` UpdatedAt time.Time `json:"updatedAt"` CreatedAt time.Time `json:"createdAt"` AvatarURL string `json:"avatarUrl"` AccessControl map[string]bool `json:"accessControl,omitempty"` }
type UserSearchHitDTO ¶
type UserSearchHitDTO struct { ID int64 `json:"id" xorm:"id"` Name string `json:"name"` Login string `json:"login"` Email string `json:"email"` AvatarURL string `json:"avatarUrl" xorm:"avatar_url"` IsAdmin bool `json:"isAdmin"` IsDisabled bool `json:"isDisabled"` LastSeenAt time.Time `json:"lastSeenAt"` LastSeenAtAge string `json:"lastSeenAtAge"` AuthLabels []string `json:"authLabels"` AuthModule AuthModuleConversion `json:"-"` }
type WhereCondition ¶
type WhereCondition struct { Condition string Params interface{} }
Click to show internal directories.
Click to hide internal directories.