users

package
v1.54.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 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      []exp.OrderedExpression
	Deleted    *bool
	IsOnline   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(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 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) (*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