users

package
v1.83.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: MIT Imports: 21 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 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      `db:"id"`
	Name          string     `db:"name"`
	Deleted       bool       `db:"deleted"`
	Identity      *string    `db:"identity"`
	LastOnline    *time.Time `db:"last_online"`
	Role          string     `db:"role"`
	EMail         *string    `db:"email"`
	Img           *int       `db:"img"`
	SpecsWeight   float64    `db:"specs_weight"`
	SpecsVolume   int64      `db:"specs_volume"`
	PicturesTotal int64      `db:"pictures_total"`
}

DBUser DBUser.

type GetUsersOptions

type GetUsersOptions struct {
	ID          int64
	InContacts  int64
	Order       []exp.OrderedExpression
	Deleted     *bool
	HasSpecs    *bool
	IsOnline    bool
	HasPictures *bool
	Limit       uint64
	Page        uint64
}

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,
	messageInterval int64,
) *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) IncForumMessages added in v1.18.0

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

func (*Repository) IncForumTopics added in v1.23.0

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

func (*Repository) NextMessageTime added in v1.19.0

func (s *Repository) NextMessageTime(ctx context.Context, userID int64) (time.Time, 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) RegisterVisit added in v1.32.0

func (s *Repository) RegisterVisit(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(_ context.Context, r *gin.Engine)

func (*Repository) TouchLastMessage added in v1.18.0

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

func (*Repository) UpdateSpecsVolumes

func (s *Repository) UpdateSpecsVolumes(ctx context.Context) 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(ctx context.Context, options GetUsersOptions) (*DBUser, error)

func (*Repository) UserAvgVote

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

func (*Repository) UserIDByIdentity added in v1.41.0

func (s *Repository) UserIDByIdentity(ctx context.Context, identity string) (int64, 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(ctx context.Context, options GetUsersOptions) ([]DBUser, *util.Pages, error)

type ResourceAccess

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

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