admin

package
Version: v5.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldUserFIRSTNAME        r.EntityPropertyID = "user$FirstName"
	FieldUserLASTNAME         r.EntityPropertyID = "user$LastName"
	FieldUserPASSWORD         r.EntityPropertyID = "user$Password"
	FieldUserUSERNAME         r.EntityPropertyID = "user$Username"
	LinkUserALLOWEDOPERATIONS r.EntityPropertyID = "user$AllowedOperations"
	LinkUserGROUPS            r.EntityPropertyID = "user$Groups"
	LinkUserRESPONSIBLEFOR    r.EntityPropertyID = "user$ResponsibleFor"
)

Entity property IDs, allowing referencing properties of a given entity kind from another entity kind

View Source
const (
	FieldUserGroupNAME             r.EntityPropertyID = "usergroup$Name"
	FieldUserGroupREFERENCE        r.EntityPropertyID = "usergroup$Reference"
	LinkUserGroupALLOWEDOPERATIONS r.EntityPropertyID = "usergroup$AllowedOperations"
	LinkUserGroupMEMBERS           r.EntityPropertyID = "usergroup$Members"
	LinkUserGroupMAINCONTACT       r.EntityPropertyID = "usergroup$MainContact"
)

Entity property IDs, allowing referencing properties of a given entity kind from another entity kind

View Source
const (
	// UserActionCURRENT : Action used to make a user active and send him a notification email
	UserActionCURRENT = UserActionType(r.ActionLAST + iota)
)

Variables

View Source
var KindUSER = r.RegisterKind(&User{}, "")

KindUSER stores the entity kind associated with 'User' entities

View Source
var KindUSERGROUP = r.RegisterKind(&UserGroup{}, "")

KindUSERGROUP stores the entity kind associated with 'UserGroup' entities

Functions

This section is empty.

Types

type BaseAdminConfig

type BaseAdminConfig struct {
	g.BaseGeenConfig         // helps making this struct implement IRestCustomConfig automatically
	Users            []*User `json:"Users"`
}

BaseAdminConfig a container for all the specific config items for applications using this module

func (*BaseAdminConfig) GetUsers

func (thisConfig *BaseAdminConfig) GetUsers() (users []g.IUser)

GetUsers helps making BaseAdminConfig implement IRestCustomConfig

type User

type User struct {
	r.Entity                           // a User is a particular Entity...
	core.BaseUser                      // ... with BaseUser attributes...
	r.AuthorizationBearer              // ... that bear authorizations
	Comment               string       `db:"comment,255" json:"comment,omitempty"        in:"a comment about this user"`
	Groups                []*UserGroup `db:"-"           json:"groups,omitempty"         o*:"the groups this user is member of"`
	ResponsibleFor        []*UserGroup `db:"-"           json:"responsibleFor,omitempty" o*:"the groups this user is the main contact of"`
}

User defines the structure of a user, i.e. properties & links, plus basic methods

func GetCurrentUserBI

func GetCurrentUserBI(biContext g.BiContext) *User

GetCurrentUserBI returns the user currently in the context, as a *User instance

func GetCurrentUserWS

func GetCurrentUserWS(wsContext g.WsContext) *User

GetCurrentUserWS returns the user currently in the context, as a *User instance

func (*User) BuildLabel

func (thisUser *User) BuildLabel() (label string, persisted bool)

BuildLabel : has to be be used to refresh the entity's label if it depends on other properties

func (*User) ChangeAfterInsert

func (thisUser *User) ChangeAfterInsert(biContext g.BiContext) g.Error

ChangeAfterInsert allows to perform specific treatments on the entity after inserting it

func (*User) ChangeAfterUpdate

func (thisUser *User) ChangeAfterUpdate(biContext g.BiContext) g.Error

ChangeAfterUpdate allows to perform specific treatments on the entity after updating it

func (*User) ChangeBeforeInsert

func (thisUser *User) ChangeBeforeInsert(biContext g.BiContext) g.Error

ChangeBeforeInsert allows to perform specific treatments on the entity before inserting it

func (*User) ChangeBeforeUpdate

func (thisUser *User) ChangeBeforeUpdate(biContext g.BiContext) g.Error

ChangeBeforeUpdate allows to perform specific treatments on the entity before updating it

func (*User) DefineLoadingPlan

func (thisUser *User) DefineLoadingPlan(loadingID g.LoadingID) g.ILoadingPlan

DefineLoadingPlan : build and returns a loading plan for this entity kind and a loading ID

func (*User) GetPassword

func (thisUser *User) GetPassword() string

GetPassword helps implement the IUser interface

func (*User) GetSharedCachePolicy

func (thisUser *User) GetSharedCachePolicy(loadingID g.LoadingID) (duration time.Duration, flushBeforeUpdate bool)

GetSharedCachePolicy allows to indicate, for all the entities of the same kind how to cache them, i.e. - for how long ? A given duration, or one of these values: SharedCacheDurationNEVER, SharedCacheDurationFOREVER, SharedCacheDurationDEFAULT - should a flush be performed before updating the partitioned cache ?

func (*User) GetUsername

func (thisUser *User) GetUsername() string

GetUsername helps implement the IUser interface, so as to be able to use 'User' instances for authentication / authorization purposes

func (*User) HashPassword

func (thisUser *User) HashPassword(biContext g.BiContext) g.Error

HashPassword hashes the given user's password

func (*User) InitSchema

func (thisUser *User) InitSchema() *r.EntitySchema

InitSchema is used to create a schema, to bear all the meta information about this entity kind

func (*User) IsActive

func (thisUser *User) IsActive() bool

IsActive helps implement the IUser interface

func (*User) IsAdmin

func (thisUser *User) IsAdmin() bool

IsAdmin helps implement the IUser interface

func (*User) IsPhysical

func (thisUser *User) IsPhysical() bool

IsPhysical helps implement the IUser interface

func (*User) IsSuperUser

func (thisUser *User) IsSuperUser() bool

IsSuperUser helps implement the IUser interface

func (*User) IsValid

func (thisUser *User) IsValid(biContext g.BiContext) g.Error

IsValid is the method through which an entity checks its own validity

type UserActionType

type UserActionType int

UserActionType is used to define the specific actions on users

func (UserActionType) GetActionName

func (thisActionType UserActionType) GetActionName() string

GetActionName returns a user action label

func (UserActionType) String

func (thisActionType UserActionType) String() string

func (UserActionType) Val

func (thisActionType UserActionType) Val() int

Val helps implement the IEnum interface

func (UserActionType) Values

func (thisActionType UserActionType) Values() map[int]string

Values helps implement the IEnum interface

type UserGroup

type UserGroup struct {
	r.Entity                      // a UserGroup is a particular kind of Entity...
	r.AuthorizationBearer         // ... that bear authorizations
	Name                  string  `db:"name,32"         json:"name"         i*:"the user group's name"`
	Reference             string  `db:"reference,3"     json:"reference"    i*:"a short reference, like DEV, ADM, OPE, etc"`
	Members               []*User `db:"members"         json:"members"      in:"the members of the group"`
	MainContact           *User   `db:"mainContact_id"  json:"mainContact"  in:"the group's main contact"`
}

UserGroup defines the properties of user groups

func (*UserGroup) InitSchema

func (thisUserGroup *UserGroup) InitSchema() *r.EntitySchema

InitSchema is used to create a schema, to bear all the meta information about this entity kind

Jump to

Keyboard shortcuts

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