Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Permissions ¶
type Permissions struct { Admin bool `json:"admin"` Execute bool `json:"execute"` Connect bool `json:"connect"` Stage bool `json:"stage"` Create bool `json:"create"` Rename bool `json:"rename"` Modify bool `json:"modify"` Delete bool `json:"delete"` Download bool `json:"download"` }
Permissions describe a user's permissions.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is a users storage.
func NewStorage ¶
func NewStorage(back StorageBackend) *Storage
NewStorage creates a users storage from a backend.
func (*Storage) Delete ¶
Delete allows you to delete a user by its name or username. The provided id must be a string for username lookup or a uint for id lookup. If id is neither, a ErrInvalidDataType will be returned.
func (*Storage) Get ¶
Get allows you to get a user by its name or username. The provided id must be a string for username lookup or a uint for id lookup. If id is neither, a ErrInvalidDataType will be returned.
func (*Storage) LastUpdate ¶
LastUpdate gets the timestamp for the last update of an user.
type StorageBackend ¶
type StorageBackend interface { GetBy(interface{}) (*User, error) Gets() ([]*User, error) Save(u *User) error Update(u *User, fields ...string) error DeleteByID(uint) error DeleteByUsername(string) error }
StorageBackend is the interface to implement for a users storage.
type User ¶
type User struct { ID uint `storm:"id,increment" json:"id"` Username string `storm:"unique" json:"username"` Password string `json:"password"` Scope string `json:"scope"` Locale string `json:"locale"` LockPassword bool `json:"lockPassword"` ViewMode ViewMode `json:"viewMode"` SingleClick bool `json:"singleClick"` Perm Permissions `json:"perm"` Commands []string `json:"commands"` Sorting files.Sorting `json:"sorting"` Fs afero.Fs `json:"-" yaml:"-"` Rules []rules.Rule `json:"rules"` HideDotfiles bool `json:"hideDotfiles"` DateFormat bool `json:"dateFormat"` }
User describes a user.
func (*User) CanExecute ¶
CanExecute checks if an user can execute a specific command.