Documentation ¶
Index ¶
Constants ¶
View Source
const ( // RoleDatabaseManager role to save, delete and get info from database RoleDatabaseManager = iota // RoleImageManager role to save, delete and get info from image RoleImageManager // RoleScriptManager role to save, delete and get info from script RoleScriptManager // RoleUserManager role to save, delete and get info of database users RoleUserManager )
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
Authenticate authenticates user and returns token
func CheckUserPermission ¶
CheckUserPermission checks if UserClaim has the role
func LoadUserConfig ¶
func LoadUserConfig(filePath string, dbConfig *db.SparrowConfig)
LoadUserConfig loads users from configuration file
Types ¶
type Roles ¶
type Roles struct { RoleDatabaseManager bool `xml:"database-manager" json:"database-manager"` RoleImageManager bool `xml:"image-manager" json:"image-manager"` RoleScriptManager bool `xml:"script-manager" json:"script-manager"` RoleUserManager bool `xml:"user-manager" json:"user-manager"` }
Roles holds user roles
type User ¶
type User struct { Username string `xml:"username,attr" json:"username"` Password string `xml:"password,attr" json:"password"` Roles Roles `xml:"roles" json:"roles"` }
User holds user info
type UsersConfig ¶
UsersConfig user from xml file
Click to show internal directories.
Click to hide internal directories.