models

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserDoesNotHaveRole = errors.New("user_does_not_have_role")
)

Functions

This section is empty.

Types

type Role

type Role struct {
	Id                string             `json:"id"`
	Name              string             `json:"name"`
	Permissions       []string           `json:"permissions"`
	UnitOrganizations []UnitOrganization `json:"unit_organizations"`
	IsDefault         bool               `json:"is_default"`
}

type UnitOrganization added in v1.6.0

type UnitOrganization struct {
	Id     string `json:"id"`
	Name   string `json:"name"`
	NameEn string `json:"name_en"`
}

type User

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

func NewUser

func NewUser(id string) *User

func (*User) AddRole

func (u *User) AddRole(id string, name string, permissions []string, isDefault bool, unitOrganizations []UnitOrganization)

func (*User) Email

func (u *User) Email() string

func (*User) HasPermission

func (u *User) HasPermission(permission string) bool

func (*User) HasUnitOrganizationPermission added in v1.6.0

func (u *User) HasUnitOrganizationPermission(unitOrgId, permission string) bool

func (*User) HashedPassword

func (u *User) HashedPassword() string

func (*User) Id

func (u *User) Id() string

func (*User) ImpersonatorId added in v1.4.0

func (u *User) ImpersonatorId() *string

func (*User) Name

func (u *User) Name() string

func (*User) Phone added in v1.3.2

func (u *User) Phone() string

func (*User) Picture

func (u *User) Picture() string

func (*User) PreferredUsername

func (u *User) PreferredUsername() string

func (*User) RoleUnitOrganizations added in v1.6.0

func (u *User) RoleUnitOrganizations(roleId string) []UnitOrganization

func (*User) Roles

func (u *User) Roles() []Role

func (*User) SetEmail

func (u *User) SetEmail(email string)

func (*User) SetHashedPassword

func (u *User) SetHashedPassword(hashedPassword string)

func (*User) SetImpersonatorId added in v1.4.0

func (u *User) SetImpersonatorId(impersonatorId *string)

func (*User) SetName

func (u *User) SetName(name string)

func (*User) SetPhone added in v1.3.2

func (u *User) SetPhone(phone string)

func (*User) SetPicture

func (u *User) SetPicture(picture string)

func (*User) SetPreferredUsername

func (u *User) SetPreferredUsername(preferredUsername string)

func (*User) SetRoles added in v1.6.0

func (u *User) SetRoles(roles []Role)

Jump to

Keyboard shortcuts

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