Documentation ¶
Index ¶
- Constants
- Variables
- 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) g.Error
- func (thisUser *User) DefineLoadingPlan(loadingID g.LoadingID) g.ILoadingPlan
- 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() *r.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 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
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 = r.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 ¶
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 ¶
GetCurrentUserBI returns the user currently in the context, as a *User instance
func GetCurrentUserWS ¶
GetCurrentUserWS returns the user currently in the context, as a *User instance
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
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() *r.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