Documentation ¶
Index ¶
- Constants
- Variables
- func GetCurrentUserWS(wsContext g.WsContext) g.IUser
- type BaseAdminConfig
- type User
- func (thisUser *User) BuildLabel() (label string, persisted bool)
- func (thisUser *User) ChangeAfterInsert(biContext g.BiContext) g.Error
- func (thisUser *User) ChangeAfterUpdate(biContext g.BiContext) g.Error
- func (thisUser *User) ChangeBeforeInsert(biContext g.BiContext) g.Error
- func (thisUser *User) ChangeBeforeUpdate(biContext g.BiContext, instore g.IEntity) g.Error
- func (thisUser *User) DefineLoadingPlan(loadingID g.LoadingID) g.ILoadingPlan
- func (thisUser *User) GetLabel() string
- func (thisUser *User) GetPassword() string
- func (thisUser *User) GetSharedCachePolicy(loadingID g.LoadingID) (duration time.Duration, flushBeforeUpdate bool)
- func (thisUser *User) GetUsername() string
- func (thisUser *User) HashPassword(biContext g.BiContext) g.Error
- func (thisUser *User) InitSchema() *g.EntitySchema
- func (thisUser *User) IsActive() bool
- func (thisUser *User) IsAdmin() bool
- func (thisUser *User) IsPhysical() bool
- func (thisUser *User) IsSuperUser() bool
- func (thisUser *User) IsValid(biContext g.BiContext) g.Error
- type UserActionType
- type UserGroup
Constants ¶
const ( FieldUserFIRSTNAME g.EntityPropertyID = "user$FirstName" FieldUserLASTNAME g.EntityPropertyID = "user$LastName" FieldUserPASSWORD g.EntityPropertyID = "user$Password" FieldUserUSERNAME g.EntityPropertyID = "user$Username" LinkUserALLOWEDOPERATIONS g.EntityPropertyID = "user$AllowedOperations" LinkUserGROUPS g.EntityPropertyID = "user$Groups" LinkUserRESPONSIBLEFOR g.EntityPropertyID = "user$ResponsibleFor" )
Entity property IDs, allowing referencing properties of a given entity kind from another entity kind
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
const ( // UserActionCURRENT : Action used to make a user active and send him a notification email UserActionCURRENT = UserActionType(r.ActionLAST + iota) )
Variables ¶
var KindUSER = g.RegisterKind(&User{}, "")
KindUSER stores the entity kind associated with 'User' entities
var KindUSERGROUP = r.RegisterKind(&UserGroup{}, "")
KindUSERGROUP stores the entity kind associated with 'UserGroup' entities
Functions ¶
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 { g.Entity // a User is a particular Entity... core.BaseUser // ... with BaseUser attributes... g.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 ¶
GetCurrentUserBI returns the user currently in the context, as a *User instance
func NewServerUser ¶
NewServerUser can be as a ServerUser when starting a Geen app
func (*User) BuildLabel ¶
BuildLabel : has to be be used to refresh the entity's label if it depends on other properties
func (*User) ChangeAfterInsert ¶
ChangeAfterInsert allows to perform specific treatments on the entity after inserting it
func (*User) ChangeAfterUpdate ¶
ChangeAfterUpdate allows to perform specific treatments on the entity after updating it
func (*User) ChangeBeforeInsert ¶
ChangeBeforeInsert allows to perform specific treatments on the entity before inserting it
func (*User) ChangeBeforeUpdate ¶
ChangeBeforeUpdate allows to perform specific treatments on the entity before updating it; The instore entity can help report information on the entity to be updated
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 ¶
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 ¶
GetUsername helps implement the IUser interface, so as to be able to use 'User' instances for authentication / authorization purposes
func (*User) HashPassword ¶
HashPassword hashes the given user's password
func (*User) InitSchema ¶
func (thisUser *User) InitSchema() *g.EntitySchema
InitSchema is used to create a schema, to bear all the meta information about this entity kind
func (*User) IsPhysical ¶
IsPhysical helps implement the IUser interface
func (*User) IsSuperUser ¶
IsSuperUser helps implement the IUser interface
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