Documentation ¶
Overview ¶
Users and clients ended up having to be split apart after all, once adding the SQL backing started falling into place. Users are very similar to clients, except that they are unique across the whole server and can log in via the web interface, while clients are only unique across an organization and cannot log in over the web. Basically, users are generally for something you would do, while a client would be associated with a specific node.
Note: At this time, organizations are not implemented, so the difference between clients and users is a little less stark.
Index ¶
- func GetList() []string
- func ValidatePublicKey(publicKey interface{}) (bool, util.Gerror)
- type User
- func (u *User) CheckPasswd(password string) util.Gerror
- func (u *User) CheckPermEdit(user_data map[string]interface{}, perm string) util.Gerror
- func (u *User) Delete() util.Gerror
- func (u *User) GenerateKeys() (string, error)
- func (u *User) GetName() string
- func (u *User) GobDecode(b []byte) error
- func (u *User) GobEncode() ([]byte, error)
- func (u *User) IsAdmin() bool
- func (u *User) IsClient() bool
- func (u *User) IsSelf(other interface{}) bool
- func (u *User) IsUser() bool
- func (u *User) IsValidator() bool
- func (u *User) PublicKey() string
- func (u *User) Rename(new_name string) util.Gerror
- func (u *User) Save() util.Gerror
- func (u *User) SetPasswd(password string) util.Gerror
- func (u *User) SetPublicKey(pk interface{}) error
- func (u *User) ToJson() map[string]interface{}
- func (u *User) URLType() string
- func (u *User) UpdateFromJson(json_user map[string]interface{}) util.Gerror
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidatePublicKey ¶
Checks that the provided public key is valid. Wrapper around chef_crypto.ValidatePublicKey(), but with a different error type.
Types ¶
type User ¶
type User struct { Username string `json:"username"` Name string `json:"name"` Email string `json:"email"` Admin bool `json:"admin"` // contains filtered or unexported fields }
func NewFromJson ¶
Build a new user from a JSON object.
func (*User) CheckPasswd ¶
Check the provided password to see if it matches the stored password hash.
func (*User) CheckPermEdit ¶
func (*User) Delete ¶
Deletes a user, but will refuse to do so and give an error if it is the last administrator user.
func (*User) GenerateKeys ¶
Generate a new set of RSA keys for the user. The new private key is saved with the user object, the public key is given to the user and not saved on the server at all.
func (*User) IsValidator ¶
Users are never validators, so always return false. This is true even if auth mode is not on.
func (*User) Rename ¶
Renames a user. Save() must be called after this method is used. Will not rename the last administrator user.
func (*User) SetPasswd ¶
Validate and set the user's password. Will not set a password for a client.
func (*User) SetPublicKey ¶
Set the user's public key. Part of the Actor interface.