users

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2022 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Decimal   = 10
	BitSize64 = 64
)
View Source
const KeycloakExternalAccountID = "keycloak"

Variables

View Source
var ErrUserNotFound = errors.New("user not found")

Functions

This section is empty.

Types

type APIImage

type APIImage struct {
	ID       int32
	Src      string
	Width    int32
	Height   int32
	Filesize int32
}

func ImageToAPIImage

func ImageToAPIImage(i *storage.Image) *APIImage

type APIUser

type APIUser struct {
	ID          int64      `json:"id"`
	Name        string     `json:"name"`
	Deleted     bool       `json:"deleted"`
	LongAway    bool       `json:"long_away"`
	Green       bool       `json:"green"`
	Route       []string   `json:"route"`
	Identity    string     `json:"identity"`
	Avatar      *APIImage  `json:"avatar,omitempty"`
	Gravatar    string     `json:"gravatar,omitempty"`
	LastOnline  *time.Time `json:"last_online,omitempty"`
	SpecsWeight float64    `json:"specs_weight,omitempty"`
}

APIUser APIUser.

type AutowpResourceAccess

type AutowpResourceAccess struct {
	Roles []string `json:"roles,omitempty"`
}

type Claims

type Claims struct {
	jwx.Claims
	Audience       interface{}    `json:"aud,omitempty"`
	Locale         string         `json:"locale,omitempty"`
	ResourceAccess ResourceAccess `json:"resource_access,omitempty"`
}

type CreateUserOptions

type CreateUserOptions struct {
	UserName        string `json:"user_name"`
	FirstName       string `json:"first_name"`
	LastName        string `json:"last_name"`
	Email           string `json:"email"`
	Timezone        string `json:"timezone"`
	Language        string `json:"language"`
	Password        string `json:"password"`
	PasswordConfirm string `json:"password_confirm"`
	Captcha         string `json:"captcha"`
}

CreateUserOptions CreateUserOptions.

type DBUser

type DBUser struct {
	ID          int64
	Name        string
	Deleted     bool
	Identity    *string
	LastOnline  *time.Time
	Role        string
	EMail       *string
	Img         *int
	SpecsWeight float64
}

DBUser DBUser.

type GetUsersOptions

type GetUsersOptions struct {
	ID         int64
	InContacts int64
	Order      []string
	Fields     map[string]bool
	Deleted    *bool
}

type Repository

type Repository struct {
	// contains filtered or unexported fields
}

Repository Main Object.

func NewRepository

func NewRepository(
	autowpDB *goqu.Database,
	db *goqu.Database,
	usersSalt string,
	languages map[string]config.LanguageConfig,
	keyCloak gocloak.GoCloak,
	keyCloakConfig config.KeycloakConfig,
) *Repository

NewRepository constructor.

func (*Repository) AfterUserCreated

func (s *Repository) AfterUserCreated(ctx context.Context, userID int64) error

func (*Repository) DecVotes

func (s *Repository) DecVotes(ctx context.Context, userID int64) error

func (*Repository) DeleteUser

func (s *Repository) DeleteUser(ctx context.Context, userID int64) (bool, error)

func (*Repository) EnsureUserImported

func (s *Repository) EnsureUserImported(ctx context.Context, claims Claims) (int64, string, error)

func (*Repository) ExportUsersToKeycloak

func (s *Repository) ExportUsersToKeycloak(ctx context.Context) error

func (*Repository) GetVotesLeft

func (s *Repository) GetVotesLeft(ctx context.Context, userID int64) (int, error)

func (*Repository) PasswordMatch

func (s *Repository) PasswordMatch(ctx context.Context, userID int64, password string) (bool, error)

func (*Repository) RefreshUserConflicts

func (s *Repository) RefreshUserConflicts(ctx context.Context, userID int64) error

func (*Repository) RestoreVotes

func (s *Repository) RestoreVotes(ctx context.Context) error

func (*Repository) SetDisableUserCommentsNotifications added in v1.1.0

func (s *Repository) SetDisableUserCommentsNotifications(
	ctx context.Context,
	userID int64,
	toUserID int64,
	disabled bool,
) error

func (*Repository) SetupPrivateRouter added in v1.1.0

func (s *Repository) SetupPrivateRouter(r *gin.Engine)

func (*Repository) UpdateSpecsVolumes

func (s *Repository) UpdateSpecsVolumes() error

func (*Repository) UpdateUserVoteLimit

func (s *Repository) UpdateUserVoteLimit(ctx context.Context, userID int64) error

func (*Repository) UpdateVotesLimits

func (s *Repository) UpdateVotesLimits(ctx context.Context) (int, error)

func (*Repository) User

func (s *Repository) User(options GetUsersOptions) (*DBUser, error)

func (*Repository) UserAvgVote

func (s *Repository) UserAvgVote(ctx context.Context, userID int64) (float64, error)

func (*Repository) UserPreferences added in v1.1.0

func (s *Repository) UserPreferences(ctx context.Context, userID int64, toUserID int64) (*UserPreferences, error)

func (*Repository) Users

func (s *Repository) Users(options GetUsersOptions) ([]DBUser, error)

type ResourceAccess

type ResourceAccess struct {
	Autowp AutowpResourceAccess `json:"autowp,omitempty"`
}

type UserExtractor

type UserExtractor struct {
	// contains filtered or unexported fields
}

func NewUserExtractor

func NewUserExtractor(enforcer *casbin.Enforcer, imageStorage *storage.Storage) *UserExtractor

func (*UserExtractor) Extract

func (s *UserExtractor) Extract(ctx context.Context, row *DBUser, fields map[string]bool) (*APIUser, error)

type UserPreferences added in v1.1.0

type UserPreferences struct {
	DisableCommentsNotifications bool `db:"disable_comments_notifications" json:"disable_comments_notifications"`
}

UserPreferences object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL