Documentation ¶
Index ¶
- Constants
- Variables
- func DeviceIDToName(num int) string
- func DeviceNameToID(name string) int
- func GetPermission(key string) translator.Translate
- func GetPermissions() map[string]translator.Translate
- func GetPermissionsKeys() []string
- func SetPermissions(perms []model2.Permission)
- type AuthToken
- type Permission
- type RefreshToken
- type Role
- type RolePermission
- type Setting
- type Token
- type User
- type UserRole
Constants ¶
View Source
const ( IOSDeviceID = 1 AndroidDeviceID = 2 DesktopDeviceID = 3 WebDeviceID = 4 ConsoleDeviceID = 5 LinuxDeviceID = 6 WindowsDeviceID = 7 IOSDeviceStr = "IOS" AndroidDeviceStr = "Android" DesktopDeviceStr = "Desktop" WebDeviceStr = "Web" ConsoleDeviceStr = "Console" LinuxDeviceStr = "Linux" WindowsDeviceStr = "Windows" )
View Source
const SuperAdmin = "SuperAdmin"
Variables ¶
View Source
var DeviceID2Name = map[int]string{ IOSDeviceID: IOSDeviceStr, AndroidDeviceID: AndroidDeviceStr, DesktopDeviceID: DesktopDeviceStr, WebDeviceID: WebDeviceStr, ConsoleDeviceID: ConsoleDeviceStr, LinuxDeviceID: LinuxDeviceStr, WindowsDeviceID: WindowsDeviceStr, }
View Source
var DeviceIDs = []int{ IOSDeviceID, AndroidDeviceID, DesktopDeviceID, WebDeviceID, ConsoleDeviceID, LinuxDeviceID, WindowsDeviceID, }
View Source
var DeviceName2ID = map[string]int{ IOSDeviceStr: IOSDeviceID, AndroidDeviceStr: AndroidDeviceID, DesktopDeviceStr: DesktopDeviceID, WebDeviceStr: WebDeviceID, ConsoleDeviceStr: ConsoleDeviceID, LinuxDeviceStr: LinuxDeviceID, WindowsDeviceStr: WindowsDeviceID, }
View Source
var DeviceStrs = []string{ IOSDeviceStr, AndroidDeviceStr, DesktopDeviceStr, WebDeviceStr, ConsoleDeviceStr, LinuxDeviceStr, WindowsDeviceStr, }
View Source
var Permissions = []model2.Permission{ {Method: "auth/roles", Desc: i18n.RolesPermission}, {Method: "auth/users", Desc: i18n.UsersPermission}, {Method: "auth/permissions", Desc: i18n.PermissionsPermission}, {Method: "auth/sessions", Desc: i18n.SessionsPermission}, }
Functions ¶
func DeviceIDToName ¶
func DeviceNameToID ¶
func GetPermission ¶
func GetPermission(key string) translator.Translate
func GetPermissions ¶
func GetPermissions() map[string]translator.Translate
func GetPermissionsKeys ¶
func GetPermissionsKeys() []string
func SetPermissions ¶
func SetPermissions(perms []model2.Permission)
Types ¶
type Permission ¶
func (Permission) TableName ¶
func (m Permission) TableName() string
type RefreshToken ¶
type RefreshToken struct { ID int `json:"id"` UserID int `json:"user_id"` DeviceID int `json:"device_id"` Token string `json:"token"` LoggedAt time.Time `json:"logged_at"` UpdatedAt time.Time `json:"updated_at"` ExpiresAt time.Time `json:"expires_at"` User *User `json:"user"` }
func (RefreshToken) TableName ¶
func (m RefreshToken) TableName() string
type Role ¶
type Role struct { ID int `json:"id"` Name string `json:"name"` RolePermissions []RolePermission `json:"role_permissions"` }
type RolePermission ¶
type RolePermission struct { RoleID int `json:"role_id"` PermissionID int `json:"permission_id"` Read bool `json:"read"` Write bool `json:"write"` Exec bool `json:"exec"` Permission *Permission `json:"auth_permission"` }
func (RolePermission) TableName ¶
func (m RolePermission) TableName() string
type Setting ¶
type User ¶
type User struct { ID int `json:"id"` Login string `json:"login"` FirstName string `json:"first_name"` SecondName *string `json:"second_name"` LastName *string `json:"last_name"` Password string `json:"password"` Email *string `json:"email"` Phone *string `json:"phone"` Blocked bool `json:"blocked"` Roles []Role `json:"roles" gorm:"many2many:auth_user_roles;"` }
Click to show internal directories.
Click to hide internal directories.