user

package
v0.2.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	Store   store.GaiaStore
	RBACSvc rbac.Service
}

Provider represents the user handlers and contains any dependencies required by the handlers.

func NewProvider

func NewProvider(store store.GaiaStore, RBACSvc rbac.Service) *Provider

NewProvider creates a new provider.

func (*Provider) UserAdd

func (h *Provider) UserAdd(c echo.Context) error

UserAdd adds a new user to the store. @Summary Add user. @Description Adds a new user. @Tags users @Accept json @Produce plain @Security ApiKeyAuth @Param UserAddRequest body gaia.User true "UserAdd request" @Success 200 {string} string "User has been added" @Failure 400 {string} string "Invalid parameters given for add user request" @Failure 500 {string} string "{User put failed|User permission put error}" @Router /user [post]

func (*Provider) UserChangePassword

func (h *Provider) UserChangePassword(c echo.Context) error

UserChangePassword changes the password from a user. @Summary Change password for user. @Description Changes the password of the given user. @Tags users @Accept json @Produce plain @Security ApiKeyAuth @Param UserChangePasswordRequest body changePasswordRequest true "UserChangePassword request" @Success 200 {string} string Password has been changed @Failure 400 {string} string "{Invalid parameters given for password change request|Cannot find user with the given username|New password does not match new password confirmation}" @Failure 412 {string} string Wrong password given for password change @Failure 500 {string} string Cannot update user in store @Router /user/password [post]

func (*Provider) UserDelete

func (h *Provider) UserDelete(c echo.Context) error

UserDelete deletes the given user @Summary Delete user. @Description Delete a given user. @Tags users @Accept plain @Produce plain @Security ApiKeyAuth @Param username query string true "The username to delete" @Success 200 {string} string User has been deleted @Failure 400 {string} string "{Invalid username given|Auto user cannot be deleted}" @Failure 404 {string} string "{User not found|Permission not found|Rbac not found}" @Router /user/{username}/delete [delete]

func (*Provider) UserGetAll

func (h *Provider) UserGetAll(c echo.Context) error

UserGetAll returns all users stored in store. @Summary Get all users @Description Returns a list of registered users. @Tags users @Accept json @Produce json @Success 200 {array} gaia.User @Security ApiKeyAuth @Failure 500 {string} string Unable to connect to database. @Router /users [get]

func (*Provider) UserGetPermissions

func (h *Provider) UserGetPermissions(c echo.Context) error

UserGetPermissions returns the permissions for a user. @Summary Get permission of the user. @Description Get permissions of the user. @Tags users @Accept plain @Produce json @Security ApiKeyAuth @Param username query string true "The username to get permission for" @Success 200 {object} gaia.UserPermission @Failure 400 {string} string "Failed to get permission" @Router /user/{username}/permissions [get]

func (*Provider) UserLogin

func (h *Provider) UserLogin(c echo.Context) error

UserLogin authenticates the user with the given credentials. @Summary User Login @Description Returns an authenticated user. @Tags users @Accept json @Produce json @Param UserLoginRequest body gaia.User true "UserLogin request" @Success 200 {object} gaia.User @Failure 400 {string} string "error reading json" @Failure 403 {string} string "credentials provided" @Failure 500 {string} string "{creating jwt token|signing jwt token}" @Router /login [post]

func (*Provider) UserPutPermissions

func (h *Provider) UserPutPermissions(c echo.Context) error

UserPutPermissions adds or updates permissions for a user. @Summary Adds or updates permissions for a user. @Description Adds or updates permissions for a user.. @Tags users @Accept json @Produce plain @Security ApiKeyAuth @Param username query string true "The username to get permission for" @Success 200 {string} string "Permissions have been updated" @Failure 400 {string} string "{Invalid parameters given for request|Permissions put failed}" @Router /user/{username}/permissions [put]

func (*Provider) UserResetTriggerToken

func (h *Provider) UserResetTriggerToken(c echo.Context) error

UserResetTriggerToken will generate and save a new Remote trigger token for a given user. @Summary Generate new remote trigger token. @Description Generates and saves a new remote trigger token for a given user. @Tags users @Accept plain @Produce plain @Security ApiKeyAuth @Param username query string true "The username to reset the token for" @Success 200 {string} string Token reset @Failure 400 {string} string "{Invalid username given|Only auto user can have a token reset|User not found|Error retrieving user}" @Failure 500 {string} string Error while saving user @Router /user/{username}/reset-trigger-token [put]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL