Equinox Users Controller

The EquinoxUsersController class is useful to manage all the user operations

Author

N7ghtm4r3 - Tecknobit

Since

1.0.1

Parameters

<T>

: the type of the EquinoxUser used in the system, is generic to avoid manual casts if it has been customized

<R>

: the type of the EquinoxUsersRepository used in the system, is generic to avoid manual casts if it has been customized

<H>

: the type of the EquinoxUsersHelper used in the system, is generic to avoid manual casts if it has been customized

See also

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
protected open var jsonHelper: JsonHelper
jsonHelper helper to work with JSON values
Link copied to clipboard
protected val mantis: Mantis
mantis the translations manager
Link copied to clipboard
protected open var me: T
me user representing the user who made a request on the server
Link copied to clipboard
val NOT_AUTHORIZED_OR_WRONG_DETAILS_MESSAGE: String = "not_authorized_key"
NOT_AUTHORIZED_OR_WRONG_DETAILS_MESSAGE message to use when the request is by a not authorized user or tried to fetch wrong details
Link copied to clipboard
resourcesProvider the resources provider and manager
Link copied to clipboard
val RESPONSE_SUCCESSFUL_MESSAGE: String = "operation_executed_successfully_key"
RESPONSE_SUCCESSFUL_MESSAGE message to use when the request has been successful
Link copied to clipboard
protected open var serverProtector: ServerProtector
protector the instance to launch the server protector to manage the server accesses
Link copied to clipboard
@Autowired
protected open var usersHelper: H
usersHelper helper to manage the users database operations
Link copied to clipboard
@Autowired(required = false )
protected open var usersRepository: R
usersRepository instance for the user repository
Link copied to clipboard
val WRONG_PROCEDURE_MESSAGE: String = "wrong_procedure_key"
WRONG_PROCEDURE_MESSAGE message to use when the procedure is wrong

Functions

Link copied to clipboard
protected open fun assembleSignInSuccessResponse(user: T): JSONObject
Method to assemble the sign-in response with the user details
Link copied to clipboard
@PatchMapping(path = "USERS_KEY + "/{" + IDENTIFIER_KEY + "}" + CHANGE_EMAIL_ENDPOINT", headers = [] )
open fun changeEmail(@PathVariable(value = "id") id: String, @RequestHeader(value = "token") token: String, @RequestBody payload: Map<String, String>): String
Method to change the email of the user
Link copied to clipboard
@PatchMapping(path = "USERS_KEY + "/{" + IDENTIFIER_KEY + "}" + CHANGE_LANGUAGE_ENDPOINT", headers = [] )
open fun changeLanguage(@PathVariable(value = "id") id: String, @RequestHeader(value = "token") token: String, @RequestBody payload: Map<String, String>): String
Method to change the language of the user
Link copied to clipboard
@PatchMapping(path = "USERS_KEY + "/{" + IDENTIFIER_KEY + "}" + CHANGE_PASSWORD_ENDPOINT", headers = [] )
open fun changePassword(@PathVariable(value = "id") id: String, @RequestHeader(value = "token") token: String, @RequestBody payload: Map<String, String>): String
Method to change the password of the user
Link copied to clipboard
@PostMapping(path = "USERS_KEY + "/{" + IDENTIFIER_KEY + "}" + CHANGE_PROFILE_PIC_ENDPOINT", headers = [] )
open fun changeProfilePic(@PathVariable(value = "id") id: String, @RequestHeader(value = "token") token: String, @RequestParam(value = "profile_pic") profilePic: MultipartFile): String
Method to change the profile pic of the user
Link copied to clipboard
@DeleteMapping(path = "USERS_KEY + "/{" + IDENTIFIER_KEY + "}"", headers = [] )
open fun deleteAccount(@PathVariable(value = "id") id: String, @RequestHeader(value = "token") token: String): String
Method to delete the account of the user
Link copied to clipboard
protected open fun failedResponse(error: String): String
Method to get the payload for a failed response
Link copied to clipboard
Method to generate an identifier of an item No-any params required
Link copied to clipboard
protected open fun getSignInCustomParams(): Array<Any>
Method to get the list of the custom parameters of a custom EquinoxUser from the payload of the signIn method No-any params required
Link copied to clipboard
protected open fun getSignUpCustomParams(): Array<Any>
Method to get the list of the custom parameters of a custom EquinoxUser from the payload of the signUp method No-any params required
Link copied to clipboard
open fun initEquinoxEnvironment(storagePath: String, saveMessage: String, context: Class<out Any>, args: Array<String>, customSubDirectories: Array<String>)
Method to init the serverProtector and create the resources directories correctly
Link copied to clipboard
protected open fun isMe(id: String, token: String): Boolean
Method to check whether the user who made a request is an authorized user If the user is authorized the me instance is loaded
Link copied to clipboard
protected open fun loadJsonHelper(payload: String)
protected open fun <V> loadJsonHelper(payload: Map<String, V>)
Method to load the jsonHelper
Link copied to clipboard
@PostMapping(path = "users/signIn" )
open fun signIn(@RequestBody payload: Map<String, String>): String
Method to sign in the Equinox's system
Link copied to clipboard
@PostMapping(path = "users/signUp" )
open fun signUp(@RequestBody payload: Map<String, String>): String
Method to sign up in the Equinox's system
Link copied to clipboard
protected open fun successResponse(): String
Method to get the payload for a successful response No-any params required
protected open fun <V> successResponse(value: V): HashMap<String, V>
protected open fun successResponse(message: JSONObject): String
Method to get the payload for a successful response
Link copied to clipboard
protected open fun validateSignIn(email: String, password: String, language: String, custom: Array<Any>): String
Method to validate the inputs of the signIn method to correctly execute a sign-in operation
Link copied to clipboard
protected open fun validateSignUp(name: String, surname: String, email: String, password: String, language: String, custom: Array<Any>): String
Method to validate the inputs of the signUp method to correctly execute a sign-up operation