Documentation ¶
Index ¶
- Constants
- Variables
- func AdminFlagCommand(cu *sites.CmdUtils, authGetter func() *auth.Auth, preRun ...func()) (cmd *cobra.Command)
- func AdminFlagCommandChanger(cu *sites.CmdUtils, authGetter func() *auth.Auth, enable bool, ...) (cmd *cobra.Command)
- func CreateAdminUserIfNotExists(site *core.Site, Auth *auth.Auth, Notification *notification.Notification, ...) (err error)
- func CreateCommands(register *core.SitesRegister, authGetter func() *auth.Auth, preRun ...func()) (cmds []*cobra.Command, err error)
- func EqualsRoleChecker(roleName string) roles.Checker
- func Events(d plug.PluginEventDispatcherInterface) *events
- func GetGroupResource(Admin *admin.Admin) *admin.Resource
- func GetResource(Admin *admin.Admin) *admin.Resource
- func I18n(key ...string) string
- func PasswordResetterCommand(cu *sites.CmdUtils, authGetter func() *auth.Auth, preRun ...func()) (cmd *cobra.Command, err error)
- func RegisterRole(name, label string)
- func RoleUserManager() string
- func SetUserAdminMenuEnabled(res *admin.Resource)
- func SetUserPassword(site *core.Site, DB *aorm.DB, Auth *auth.Auth, ...) (err error)
- func Trigger(d plug.PluginEventDispatcherInterface) *trigger
- type AdvancedRoles
- type AvatarImageStorage
- type CliPlugin
- type Config
- type Group
- type Logouter
- type Logouters
- type Plugin
- type RegisterUserEvent
- type RolesAttribute
- func (this RolesAttribute) AormDefaultDbValue(dialect aorm.Dialector) string
- func (this RolesAttribute) GetCollection(ctx *admin.Context) (options [][]string)
- func (this RolesAttribute) Names() (names []string)
- func (this RolesAttribute) Roles(ctx *admin.Context) roles.Roles
- func (this *RolesAttribute) Scan(src interface{}) error
- func (this RolesAttribute) SortedNames() (names []string)
- func (this RolesAttribute) String(ctx *admin.Context) string
- func (this RolesAttribute) Strings(ctx *admin.Context) (items []string)
- func (this *RolesAttribute) StringsScan(src []string) error
- func (this RolesAttribute) Value() (driver.Value, error)
- func (this RolesAttribute) Values(ctx *admin.Context) interface{}
- type SetPassword
- type User
- func (this *User) AvailableLocales() []string
- func (this *User) BeforeAuth(ctx *auth.LoginContext) error
- func (this *User) DisplayName() string
- func (*User) FindUID(ctx *auth.Context, identifier string) (uid string, err error)
- func (this *User) GetAormInlinePreloadFields() []string
- func (this *User) GetDefaultLocale() string
- func (this *User) GetEmail() string
- func (this *User) GetLocales() []string
- func (this *User) GetName() string
- func (this *User) GetRoles() (rols roles.Roles)
- func (this *User) GetTimeLocation() *time.Location
- func (this *User) GetUID() string
- func (this *User) HasRole(name string) (ok bool)
- func (this *User) IsSuper() bool
- func (this *User) Schema() *auth.Schema
- func (this *User) String() string
- func (this *User) SystemAdmin()
- func (this *User) Validate(db *aorm.DB)
- type UserAccessToken
- type UserAuthAlias
- type UserGroup
- type UserRole
Constants ¶
View Source
const ( ActionLogout = "Logout" ActionBulkLogout = "BulkLogout" )
View Source
const AdminUserName = "admin"
View Source
const DEFAULT_PASSWORD = "123@456"
Variables ¶
View Source
var ( USER_MENU = PKG + ".menu.user" GROUP_MENU = PKG + ".menu.group" LOGOUTERS_KEY = PKG + ".logouters" )
View Source
var E_REGISTER_USER = PKG + ".register_user"
View Source
var (
PKG = path_helpers.GetCalledDir()
)
Functions ¶
func AdminFlagCommand ¶
func AdminFlagCommandChanger ¶
func CreateCommands ¶
func EqualsRoleChecker ¶
func Events ¶
func Events(d plug.PluginEventDispatcherInterface) *events
func PasswordResetterCommand ¶
func RegisterRole ¶
func RegisterRole(name, label string)
func RoleUserManager ¶
func RoleUserManager() string
func SetUserAdminMenuEnabled ¶
func SetUserPassword ¶
func Trigger ¶
func Trigger(d plug.PluginEventDispatcherInterface) *trigger
Types ¶
type AdvancedRoles ¶
func (*AdvancedRoles) Add ¶
func (r *AdvancedRoles) Add(group string, name ...string)
func (AdvancedRoles) Strings ¶
func (r AdvancedRoles) Strings() (names []string)
type AvatarImageStorage ¶
type CliPlugin ¶
type CliPlugin struct { plug.EventDispatcher SitesRegisterKey, AuthKey, AdminGetterKey string PreRun []func() }
func (*CliPlugin) OnRegister ¶
func (*CliPlugin) RequireOptions ¶
type Group ¶
type Group struct { aorm.AuditedModel fragment.FragmentedModel Name, Description string Users []UserGroup `sql:"foreignkey:GroupID"` }
type Plugin ¶
type Plugin struct { plug.EventDispatcher db.DBNames admin_plugin.AdminNames SitesRegisterKey, NotificationKey, AuthKey, RolesKey, LogoutersKey string Config Config }
func (*Plugin) OnRegister ¶
func (*Plugin) RequireOptions ¶
type RegisterUserEvent ¶
type RegisterUserEvent struct { plug.PluginEventInterface Site *core.Site }
type RolesAttribute ¶
type RolesAttribute struct {
// contains filtered or unexported fields
}
func (RolesAttribute) AormDefaultDbValue ¶
func (this RolesAttribute) AormDefaultDbValue(dialect aorm.Dialector) string
func (RolesAttribute) GetCollection ¶
func (this RolesAttribute) GetCollection(ctx *admin.Context) (options [][]string)
func (RolesAttribute) Names ¶
func (this RolesAttribute) Names() (names []string)
func (*RolesAttribute) Scan ¶
func (this *RolesAttribute) Scan(src interface{}) error
func (RolesAttribute) SortedNames ¶
func (this RolesAttribute) SortedNames() (names []string)
func (RolesAttribute) Strings ¶
func (this RolesAttribute) Strings(ctx *admin.Context) (items []string)
func (*RolesAttribute) StringsScan ¶
func (this *RolesAttribute) StringsScan(src []string) error
func (RolesAttribute) Values ¶
func (this RolesAttribute) Values(ctx *admin.Context) interface{}
type SetPassword ¶
type SetPassword struct { YourPassword string `admin:"required;type:password"` NewPassword string `admin:"required;type:password"` PasswordConfirm string `admin:"required;type:password"` // contains filtered or unexported fields }
func (SetPassword) AdminResourceSetup ¶
func (SetPassword) AdminResourceSetup(res *admin.Resource, defaultSetup func())
type User ¶
type User struct { aorm.AuditedSDModel fragment.FragmentedModel Email string `form:"email" aorm:"unique;size:64" admin:"required"` Name string `form:"name" aorm:"unique;size:64" admin:"required"` Roles RolesAttribute `aorm:"type:text;default" admin:"select_many;type:select_many"` // Confirm ConfirmToken string Confirmed bool `aorm:"default"` // Recover RecoverToken string `aorm:"size:2048"` RecoverTokenExpiry *time.Time Super bool `aorm:"default"` Location string `aorm:"default;size:64"` Locale string `aorm:"default;size:5"` AdvancedRoles AdvancedRoles `sql:"-"` AuthAliases []UserAuthAlias `aorm:"foreignkey:UserID"` AccessTokens []UserAccessToken `aorm:"foreignkey:UserID"` // contains filtered or unexported fields }
func GetUserAndAuth ¶
func (*User) AvailableLocales ¶
func (*User) BeforeAuth ¶
func (this *User) BeforeAuth(ctx *auth.LoginContext) error
func (*User) DisplayName ¶
func (*User) GetAormInlinePreloadFields ¶
func (*User) GetDefaultLocale ¶
func (*User) GetLocales ¶
func (*User) GetTimeLocation ¶
func (*User) SystemAdmin ¶
func (this *User) SystemAdmin()
type UserAccessToken ¶
type UserAuthAlias ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.