Documentation
¶
Index ¶
- type API
- type AggregationResult
- type BulkDeleteRequestItem
- type BulkPatchRequestItem
- type BulkToggleRequestItem
- type BulkUpdateRequestItem
- type CreateRequest
- type EditRequest
- type ListRequest
- type PatchEditRequest
- type PatchRequest
- type Role
- type Store
- type UpdateRequest
- type User
- type Validator
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type AggregationResult ¶
type AggregationResult struct {
Data []User `bson:"data" json:"data"`
TotalCount int64 `bson:"total_count" json:"total_count"`
}
func (*AggregationResult) GetData ¶
func (r *AggregationResult) GetData() any
func (*AggregationResult) GetTotal ¶
func (r *AggregationResult) GetTotal() int64
type BulkDeleteRequestItem ¶
type BulkPatchRequestItem ¶
type BulkPatchRequestItem struct {
ID string `json:"_id" binding:"required"`
PatchEditRequest
}
type BulkToggleRequestItem ¶
type BulkUpdateRequestItem ¶
type BulkUpdateRequestItem struct {
ID string `json:"_id" binding:"required"`
EditRequest
}
type CreateRequest ¶
type CreateRequest struct {
EditRequest
Source string `json:"source"`
ExternalID string `json:"external_id"`
}
type EditRequest ¶
type EditRequest struct {
Password string `json:"password"` //nolint:gosec
Name string `json:"name" binding:"required,max=255"`
Firstname string `json:"firstname" binding:"max=255"`
Lastname string `json:"lastname" binding:"max=255"`
Email string `json:"email" binding:"required,email"`
Roles []string `json:"roles" binding:"required,notblank"`
UILanguage string `json:"ui_language" binding:"max=255"`
UITheme string `json:"ui_theme" binding:"max=255"`
IsEnabled *bool `json:"enabled" binding:"required"`
DefaultView string `json:"defaultview"`
Author string `json:"author" swaggerignore:"true"`
}
type ListRequest ¶
type ListRequest struct {
pagination.FilteredQuery
SortBy string `form:"sort_by" binding:"oneoforempty=_id name display_name lastname firstname enable source"`
Permission string `form:"permission"`
IDs []string `form:"ids[]"`
}
type PatchEditRequest ¶
type PatchEditRequest struct {
Password *string `json:"password"` //nolint:gosec
Name *string `json:"name" binding:"omitempty,max=255"`
Firstname *string `json:"firstname" binding:"omitempty,max=255"`
Lastname *string `json:"lastname" binding:"omitempty,max=255"`
Email *string `json:"email" binding:"omitempty,email"`
Roles []string `json:"roles" binding:"omitempty,notblank"`
UILanguage *string `json:"ui_language" binding:"omitempty,max=255"`
UITheme *string `json:"ui_theme" binding:"omitempty,max=255"`
IsEnabled *bool `json:"enabled"`
DefaultView *string `json:"defaultview"`
Author string `json:"author" swaggerignore:"true"`
}
type PatchRequest ¶
type PatchRequest struct {
ID string `json:"-"`
PatchEditRequest
}
type Role ¶
type Store ¶
type Store interface {
Find(ctx context.Context, r ListRequest, userID string, requestRoles []string) (*AggregationResult, error)
GetOneBy(ctx context.Context, id string) (*User, error)
Insert(ctx context.Context, r CreateRequest, requestRoles []string) (*User, error)
Update(ctx context.Context, r BulkUpdateRequestItem, userID string, requestRoles []string) (*User, error)
Patch(ctx context.Context, r BulkPatchRequestItem, userID string, requestRoles []string) (*User, error)
Delete(ctx context.Context, r BulkDeleteRequestItem, requestRoles []string) (bool, error)
Toggle(ctx context.Context, r BulkToggleRequestItem, enabled bool, requestRoles []string) (bool, error)
}
type UpdateRequest ¶
type UpdateRequest struct {
ID string `json:"-"`
EditRequest
}
type User ¶
type User struct {
ID string `bson:"_id" json:"_id"`
Name string `bson:"name" json:"name"`
DisplayName string `bson:"display_name" json:"display_name"`
Lastname string `bson:"lastname" json:"lastname"`
Firstname string `bson:"firstname" json:"firstname"`
Email string `bson:"email" json:"email"`
Roles []Role `bson:"roles" json:"roles"`
UILanguage string `bson:"ui_language" json:"ui_language"`
UITheme string `bson:"ui_theme" json:"ui_theme"`
Enabled bool `bson:"enabled" json:"enabled"`
DefaultView *View `bson:"defaultview" json:"defaultview"`
ExternalID string `bson:"external_id" json:"external_id"`
Source string `bson:"source" json:"source"`
AuthApiKey string `bson:"authkey" json:"authkey"` //nolint:gosec
Author *author.Author `bson:"author,omitempty" json:"author,omitempty"`
Created *datetime.CpsTime `bson:"created,omitempty" json:"created,omitempty" swaggertype:"integer"`
Updated *datetime.CpsTime `bson:"updated,omitempty" json:"updated,omitempty" swaggertype:"integer"`
ActiveConnects *int64 `bson:"-" json:"active_connects,omitempty"`
Deletable *bool `bson:"-" json:"deletable,omitempty"`
// IdPRoles field shows roles defined in IdP, which shouldn't be modified for a user.
IdPRoles []string `bson:"idp_roles,omitempty" json:"idp_roles,omitempty"`
// IdPFields field shows immutable user fields, because they are defined by IdP.
IdPFields []string `bson:"-" json:"idp_fields,omitempty"`
}
type Validator ¶
type Validator interface {
ValidateCreateRequest(sl validator.StructLevel)
ValidateUpdateRequest(sl validator.StructLevel)
ValidatePatchRequest(sl validator.StructLevel)
ValidateBulkUpdateRequestItem(sl validator.StructLevel)
ValidateBulkPatchRequestItem(sl validator.StructLevel)
}
Source Files
¶
- api.go
- models.go
- store.go
- validator.go
Click to show internal directories.
Click to hide internal directories.