v1

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserAuthenticateHandler

func UserAuthenticateHandler(ctx *gin.Context)

UserAuthenticateHandler handles an incoming request with three query parameters: username, password, and (optional) token.

Behavior: It authenticates the user account with the provided information and generates an authenticated token.

Response: A token in the body (for debugging) and as a cookie + An error message.

func UserChangePasswordHandler

func UserChangePasswordHandler(ctx *gin.Context)

UserChangPasswordHandler handles an incoming PUT request of url /users/:id/password with three query parameters: newpassword and (optional) token, oldpassword.

Behavior: It updates password of the current profile. The subject is determined by token. The affected object is determined by the URL parameter. If the subject is higher role than the object, it doesn't need the oldpassword.

Response: An error message.

func UserChangeRoleHandler

func UserChangeRoleHandler(ctx *gin.Context)

UserChangRoleHandler handles an incoming PUT request of url /users/:id/role with two query parameters: role and (optional) token.

Behavior: It updates role of the current profile. The subject is determined by token. The affected object is determined by the URL parameter.

Response: An error message.

func UserGETHandler

func UserGETHandler(ctx *gin.Context)

UserGETHandler handles an incoming GET request of url /users/:id with one optional query parameter: token.

Behavior: It gets the profile of a user determined by URL parameter id. The subject is determined by the token.

Response: A profile + An error message.

func UserPUTHandler

func UserPUTHandler(ctx *gin.Context)

UserPUTHandler handles an incoming PUT request of url /users/:id with three optional query parameters: token, age, gender.

Behavior: It updates age and gender of the current profile. The subject is determined by token. The affected object is determined by the URL parameter. If the request doesn't provide age or gender, they will be set to null (a.k.a be deleted).

Response: An error message.

func UserProfileHandler

func UserProfileHandler(ctx *gin.Context)

UserProfileHandler handles an incoming request with one optional query parameter: token.

Behavior: It gets the profile of the user determined by the token.

Response: A profile + An error message.

func UserRegisterHandler

func UserRegisterHandler(ctx *gin.Context)

UserRegisterHandler handles an incoming request with four query parameters: username, password, and (optional) token, role.

Behavior: It registers a user account with the provided information. If the role is a member, it doesn't need a subject to register; otherwise, the subject must be higher role.

Response: An error message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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