EquinoxUsersController

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 EquinoxUsersService 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
configuration the current configuration of the Equinox's backend instance
Link copied to clipboard
protected open var jsonHelper: JsonHelper
jsonHelper helper to work with JSON values
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
@Autowired(required = false)
protected open var messageSource: MessageSource
messageSource the message source used to manage the resources messages bundle
Link copied to clipboard
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"
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(required = false)
protected open var usersRepository: R
usersRepository instance for the user repository
Link copied to clipboard
@Autowired
protected open var usersService: H
usersService helper to manage the users database operations
Link copied to clipboard
val WRONG_EMAIL_MESSAGE: String = "wrong_email"
WRONG_EMAIL_MESSAGE error message used when the email inserted is not valid
Link copied to clipboard
val WRONG_LANGUAGE_MESSAGE: String = "wrong_language"
WRONG_LANGUAGE_MESSAGE error message used when the language inserted is not valid
Link copied to clipboard
val WRONG_NAME_MESSAGE: String = "wrong_name"
WRONG_NAME_MESSAGE error message used when the name inserted is not valid
Link copied to clipboard
val WRONG_PASSWORD_MESSAGE: String = "wrong_password"
WRONG_PASSWORD_MESSAGE error message used when the password inserted is not valid
Link copied to clipboard
val WRONG_PROCEDURE_MESSAGE: String = "wrong_procedure"
WRONG_PROCEDURE_MESSAGE message to use when the procedure is wrong
Link copied to clipboard
val WRONG_SURNAME_MESSAGE: String = "wrong_surname"
WRONG_SURNAME_MESSAGE error message used when the surname inserted is not valid

Functions

Link copied to clipboard
protected open fun assembleSignInSuccessResponse(user: T): JSONObject
Method used 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 used 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 used 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 used 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 used 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 used to delete the account of the user
Link copied to clipboard
protected open fun failedResponse(errorKey: String): String
protected open fun failedResponse(errorKey: String, @Nullable args: Array<Any>): String
Method used to get the payload for a failed response
Link copied to clipboard
Method used to generate an identifier of an item
Link copied to clipboard
@GetMapping(path = "USERS_KEY + "/{" + IDENTIFIER_KEY + "}" + DYNAMIC_ACCOUNT_DATA_ENDPOINT", headers = [])
open fun getDynamicAccountData(@PathVariable(value = "id") id: String, @RequestHeader(value = "token") token: String): String
Method used to get the dynamic data of the user to correctly update in all the devices where the user is connected
Link copied to clipboard
protected open fun getInternationalizedMessage(messageKey: String): String
protected open fun getInternationalizedMessage(messageKey: String, @Nullable args: Array<Any>): String
Method used to get the international message
Link copied to clipboard
protected open fun getSignInCustomParams(): Array<Any>
Method used to get the list of the custom parameters of a custom EquinoxUser from the payload of the signIn method
Link copied to clipboard
protected open fun getSignUpCustomParams(): Array<Any>
Method used to get the list of the custom parameters of a custom EquinoxUser from the payload of the signUp method
Link copied to clipboard
open fun initEquinoxEnvironment(context: Class<out Any>, args: Array<String>)
open fun initEquinoxEnvironment(    storagePath: String,     saveMessage: String,     context: Class<out Any>,     args: Array<String>,     customSubDirectories: Array<String>)
Method used to init the serverProtector and create the resources directories correctly
Link copied to clipboard
protected open fun isMe(id: String, token: String): Boolean
Method used 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>)
protected open fun loadJsonHelper(payload: JSONArray)
protected open fun loadJsonHelper(payload: JSONObject)
Method used to load the jsonHelper
Link copied to clipboard
protected open fun plainResponse(status: ResponseStatus, message: String): String
Method used to assemble the payload for a response
Link copied to clipboard
protected open fun setSessionLocale(locale: String)
protected open fun setSessionLocale(locale: Locale)
Method used to change the current locale of the session
Link copied to clipboard
@PostMapping(path = "users/signIn")
open fun signIn(@RequestBody payload: Map<String, Any>): String
Method used to sign in the Equinox's system
Link copied to clipboard
@PostMapping(path = "users/signUp")
open fun signUp(@RequestBody payload: Map<String, Any>): String
Method used to sign up in the Equinox's system
Link copied to clipboard
protected open fun successResponse(): String
protected open fun <V> successResponse(value: V): HashMap<String, V>
protected open fun successResponse(message: String): String
protected open fun successResponse(message: JSONObject): String
protected open fun successResponse(message: String, args: Array<Any>): String
Method used 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 used 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 used to validate the inputs of the signUp method to correctly execute a sign-up operation