Documentation
¶
Overview ¶
Package users reads and writes the OpenArch users file (config/users.yml).
OpenArch has no API to manage users: it reads this file once, at startup. The admin entry belongs to the workspace (its password is in .env.local). Other users and groups are kept as they are when the file is written again.
Index ¶
Constants ¶
const ( AdminID = "00000000-0000-0000-0000-000000000001" AdministratorsGroup = "administrators" MembersGroup = "members" )
Fixed ids, the same as in the users file bundled in the OpenArch image.
const Path = "config/users.yml"
Path is the users file in a workspace.
Variables ¶
This section is empty.
Functions ¶
func ValidateUsername ¶
ValidateUsername checks a new user name.
Types ¶
type File ¶
type File struct {
AdministratorsGroups []string `yaml:"administratorsGroups"`
Groups []Group `yaml:"groups"`
Users []User `yaml:"users"`
}
File is the content of the users file.
func Build ¶
Build returns the users file with the workspace admin, plus the other users and groups of old (which may be the zero File).
func (*File) EnsureGroup ¶
EnsureGroup adds a group with a new id when f does not have it.
type User ¶
type User struct {
ID string `yaml:"id" json:"id"`
Username string `yaml:"username" json:"username"`
Password string `yaml:"password" json:"-"`
FirstName string `yaml:"firstName,omitempty" json:"firstName,omitempty"`
LastName string `yaml:"lastName,omitempty" json:"lastName,omitempty"`
Email string `yaml:"email,omitempty" json:"email,omitempty"`
Groups []string `yaml:"groups" json:"groups"`
Attributes map[string]string `yaml:"attributes,omitempty" json:"attributes,omitempty"`
}
User is a user of the users file. Password is "{bcrypt}<hash>".