Documentation ¶
Index ¶
- Constants
- func StartExternalServer(listenAddr string, stop <-chan struct{}, um UserManager) error
- type AuthenticateRequest
- type AuthenticateResponse
- type AuthenticationType
- type AuthorizeNamespaceAdminRequest
- type AuthorizeRequest
- type AuthorizeResponse
- type DeleteRequest
- type ExternalManager
- func (m *ExternalManager) Authenticate(username, password string) (*User, AuthenticationType, error)
- func (m *ExternalManager) Authorize(user *User, ownerAction bool, tlf *types.TopLevelFilesystem) (bool, error)
- func (m *ExternalManager) Delete(id string) error
- func (m *ExternalManager) Get(q *Query) (*User, error)
- func (m *ExternalManager) Import(user *User) error
- func (m *ExternalManager) List(selector string) ([]*User, error)
- func (m *ExternalManager) New(name, email, password string) (*User, error)
- func (m *ExternalManager) NewAdmin(user *User) error
- func (m *ExternalManager) ResetAPIKey(id string) (*User, error)
- func (m *ExternalManager) Update(user *User) (*User, error)
- func (m *ExternalManager) UpdatePassword(id string, password string) (*User, error)
- func (m *ExternalManager) UserIsNamespaceAdministrator(user *User, namespace string) (bool, error)
- type InternalManager
- func (m *InternalManager) Authenticate(username, password string) (*User, AuthenticationType, error)
- func (m *InternalManager) Authorize(user *User, collabsAllowed bool, tlf *types.TopLevelFilesystem) (bool, error)
- func (m *InternalManager) Delete(id string) error
- func (m *InternalManager) Get(q *Query) (*User, error)
- func (m *InternalManager) Import(user *User) error
- func (m *InternalManager) List(selector string) ([]*User, error)
- func (m *InternalManager) New(username, email, password string) (*User, error)
- func (m *InternalManager) NewAdmin(user *User) error
- func (m *InternalManager) ResetAPIKey(username string) (*User, error)
- func (m *InternalManager) Update(user *User) (*User, error)
- func (m *InternalManager) UpdatePassword(username string, password string) (*User, error)
- func (m *InternalManager) UserIsNamespaceAdministrator(user *User, namespace string) (bool, error)
- type ListRequest
- type NewUserRequest
- type Query
- type ResetAPIKeyRequest
- type SafeUser
- type UpdatePasswordRequest
- type User
- type UserManager
Constants ¶
View Source
const ADMIN_USER_UUID = "00000000-0000-0000-0000-000000000000"
special admin user with global privs
View Source
const UsersPrefix = "users"
UsersPrefix - KV store prefix for users
Variables ¶
This section is empty.
Functions ¶
func StartExternalServer ¶
func StartExternalServer(listenAddr string, stop <-chan struct{}, um UserManager) error
Types ¶
type AuthenticateRequest ¶
type AuthenticateResponse ¶
type AuthenticationType ¶
type AuthenticationType int
const ( AuthenticationTypeNone AuthenticationType = iota AuthenticationTypePassword AuthenticationTypeAPIKey )
func AuthenticationTypeFromString ¶
func AuthenticationTypeFromString(at string) (AuthenticationType, error)
func (AuthenticationType) Privileged ¶
func (at AuthenticationType) Privileged() bool
Privileged - authentication type that enables certain API action
func (AuthenticationType) String ¶
func (at AuthenticationType) String() string
type AuthorizeRequest ¶
type AuthorizeRequest struct { User User OwnerAction bool TopLevelFilesystem types.TopLevelFilesystem }
type AuthorizeResponse ¶
type AuthorizeResponse struct {
Allowed bool
}
type DeleteRequest ¶
type DeleteRequest struct {
UserID string
}
type ExternalManager ¶
type ExternalManager struct {
// contains filtered or unexported fields
}
func NewExternal ¶
func NewExternal(url string, httpClient *http.Client) *ExternalManager
func (*ExternalManager) Authenticate ¶
func (m *ExternalManager) Authenticate(username, password string) (*User, AuthenticationType, error)
func (*ExternalManager) Authorize ¶
func (m *ExternalManager) Authorize(user *User, ownerAction bool, tlf *types.TopLevelFilesystem) (bool, error)
func (*ExternalManager) Delete ¶
func (m *ExternalManager) Delete(id string) error
func (*ExternalManager) Import ¶
func (m *ExternalManager) Import(user *User) error
Import user without hashing password or generating API key
func (*ExternalManager) New ¶
func (m *ExternalManager) New(name, email, password string) (*User, error)
func (*ExternalManager) NewAdmin ¶
func (m *ExternalManager) NewAdmin(user *User) error
func (*ExternalManager) ResetAPIKey ¶
func (m *ExternalManager) ResetAPIKey(id string) (*User, error)
func (*ExternalManager) UpdatePassword ¶
func (m *ExternalManager) UpdatePassword(id string, password string) (*User, error)
func (*ExternalManager) UserIsNamespaceAdministrator ¶
func (m *ExternalManager) UserIsNamespaceAdministrator(user *User, namespace string) (bool, error)
type InternalManager ¶
type InternalManager struct {
// contains filtered or unexported fields
}
func NewInternal ¶
func NewInternal(kv store.KVStoreWithIndex) *InternalManager
func (*InternalManager) Authenticate ¶
func (m *InternalManager) Authenticate(username, password string) (*User, AuthenticationType, error)
func (*InternalManager) Authorize ¶
func (m *InternalManager) Authorize(user *User, collabsAllowed bool, tlf *types.TopLevelFilesystem) (bool, error)
func (*InternalManager) Delete ¶
func (m *InternalManager) Delete(id string) error
func (*InternalManager) Import ¶
func (m *InternalManager) Import(user *User) error
Import - imports user without generating password, API key
func (*InternalManager) New ¶
func (m *InternalManager) New(username, email, password string) (*User, error)
func (*InternalManager) NewAdmin ¶
func (m *InternalManager) NewAdmin(user *User) error
func (*InternalManager) ResetAPIKey ¶
func (m *InternalManager) ResetAPIKey(username string) (*User, error)
func (*InternalManager) UpdatePassword ¶
func (m *InternalManager) UpdatePassword(username string, password string) (*User, error)
func (*InternalManager) UserIsNamespaceAdministrator ¶
func (m *InternalManager) UserIsNamespaceAdministrator(user *User, namespace string) (bool, error)
type ListRequest ¶
type ListRequest struct {
Selector string
}
type NewUserRequest ¶
type ResetAPIKeyRequest ¶
type ResetAPIKeyRequest struct {
UserID string
}
type UpdatePasswordRequest ¶
type UserManager ¶
type UserManager interface { NewAdmin(user *User) error New(name, email, password string) (*User, error) Get(q *Query) (*User, error) Update(user *User) (*User, error) // Import user without hashing password or generating API key Import(user *User) error UpdatePassword(id string, password string) (*User, error) ResetAPIKey(id string) (*User, error) Delete(id string) error List(selector string) ([]*User, error) // Authenticate user, if successful returns User struct and // authentication type or error if unsuccessful Authenticate(username, password string) (*User, AuthenticationType, error) // Authorize user action on a tlf, returns (true, nil) for OK, (false, nil) for not OK, // and (false, error) for an error happened (so not OK). Authorize(user *User, ownerAction bool, tlf *types.TopLevelFilesystem) (bool, error) // Is the user the administrator for this namespace? UserIsNamespaceAdministrator(user *User, namespace string) (bool, error) }
Click to show internal directories.
Click to hide internal directories.