Groups Controller

@RestController
@RequestMapping(path = "BASE_EQUINOX_ENDPOINT + USERS_KEY + "/{" + IDENTIFIER_KEY + "}/" + GROUPS_KEY" )
open class GroupsController : DefaultPandoroController

The GroupsController class is useful to manage all the group operations

Author

N7ghtm4r3 - Tecknobit

See also

EquinoxController

Constructors

Link copied to clipboard
constructor()

Properties

val CANNOT_EXECUTE_ACTION_ON_OWN_ACCOUNT_MESSAGE: String = "action_executed_on_own_account_error"
CANNOT_EXECUTE_ACTION_ON_OWN_ACCOUNT_MESSAGE message to use when the user tried to execute an action on its account wrong
Link copied to clipboard
@Autowired
private open var groupsService: GroupsService
groupsService instance to manage the groups database operations
Link copied to clipboard
protected open var jsonHelper: JsonHelper
Link copied to clipboard
protected val mantis: Mantis
Link copied to clipboard
protected open var me: T
Link copied to clipboard
protected open var messageSource: MessageSource
Link copied to clipboard
open var resourcesProvider: ResourcesProvider
Link copied to clipboard
val RESPONSE_SUCCESSFUL_MESSAGE: String = "operation_executed_successfully"
Link copied to clipboard
protected open var serverProtector: ServerProtector
Link copied to clipboard
protected open var usersRepository: R
Link copied to clipboard
val WRONG_EMAIL_MESSAGE: String = "wrong_email"
Link copied to clipboard
val WRONG_GROUP_ALREADY_EXISTS_ERROR_MESSAGE: String = "group_name_already_exists"
WRONG_GROUP_ALREADY_EXISTS_ERROR_MESSAGE message to use when the name of the group is already used
Link copied to clipboard
val WRONG_GROUP_DESCRIPTION_ERROR_MESSAGE: String = "wrong_group_description"
WRONG_GROUP_DESCRIPTION_ERROR_MESSAGE message to use when the description of the group is not a valid description
Link copied to clipboard
val WRONG_GROUP_LOGO_MESSAGE: String = "wrong_group_logo"
WRONG_GROUP_LOGO_MESSAGE the message to warn the user about an invalid logo for a group
Link copied to clipboard
val WRONG_GROUP_NAME_ERROR_MESSAGE: String = "wrong_group_name"
WRONG_GROUP_NAME_ERROR_MESSAGE message to use when the name of the group is not a valid name
Link copied to clipboard
val WRONG_LANGUAGE_MESSAGE: String = "wrong_language"
Link copied to clipboard
val WRONG_NAME_MESSAGE: String = "wrong_name"
Link copied to clipboard
val WRONG_PASSWORD_MESSAGE: String = "wrong_password"
Link copied to clipboard
val WRONG_PROCEDURE_MESSAGE: String = "wrong_procedure"
Link copied to clipboard
val WRONG_SURNAME_MESSAGE: String = "wrong_surname"

Functions

Link copied to clipboard
@PatchMapping(path = ""/{" + GROUP_IDENTIFIER_KEY + "}" + ACCEPT_GROUP_INVITATION_ENDPOINT", headers = [] )
open fun acceptInvitation(    @PathVariable(value = "id") id: String,     @RequestHeader(value = "token") token: String,     @PathVariable(value = "group_id") groupId: String,     @RequestBody payload: Map<String, String>): String
Method to accept a group invitation
Link copied to clipboard
@PutMapping(path = ""/{" + GROUP_IDENTIFIER_KEY + "}" + ADD_MEMBERS_ENDPOINT", headers = [] )
open fun addMembers(    @PathVariable(value = "id") id: String,     @RequestHeader(value = "token") token: String,     @PathVariable(value = "group_id") groupId: String,     @RequestBody payload: Map<String, Any>): String
Method to add members to a group
Link copied to clipboard
@PatchMapping(path = ""/{" + GROUP_IDENTIFIER_KEY + "}" + CHANGE_MEMBER_ROLE_ENDPOINT", headers = [] )
open fun changeMemberRole(    @PathVariable(value = "id") id: String,     @RequestHeader(value = "token") token: String,     @PathVariable(value = "group_id") groupId: String,     @RequestBody payload: Map<String, String>): String
Method to change the role of a group member
Link copied to clipboard
@PostMapping(headers = [] )
open fun createGroup(    @PathVariable(value = "id") id: String,     @RequestHeader(value = "token") token: String,     @ModelAttribute payload: GroupDTO): String
Method to create a new group
Link copied to clipboard
@DeleteMapping(path = ""/{" + GROUP_IDENTIFIER_KEY + "}" + DECLINE_GROUP_INVITATION_ENDPOINT", headers = [] )
open fun declineInvitation(    @PathVariable(value = "id") id: String,     @RequestHeader(value = "token") token: String,     @PathVariable(value = "group_id") groupId: String,     @RequestBody payload: Map<String, String>): String
Method to decline a group invitation
Link copied to clipboard
@DeleteMapping(path = "/{" + GROUP_IDENTIFIER_KEY + "}", headers = [] )
open fun deleteGroup(    @PathVariable(value = "id") id: String,     @RequestHeader(value = "token") token: String,     @PathVariable(value = "group_id") groupId: String): String
Method to delete a group
Link copied to clipboard
@PostMapping(path = "/{" + GROUP_IDENTIFIER_KEY + "}", headers = [] )
open fun editGroup(    @PathVariable(value = "id") id: String,     @PathVariable(value = "group_id") groupId: String,     @RequestHeader(value = "token") token: String,     @ModelAttribute payload: GroupDTO): String
Method to create edit an existing group
Link copied to clipboard
@PatchMapping(path = ""/{" + GROUP_IDENTIFIER_KEY + "}" + EDIT_PROJECTS_ENDPOINT", headers = [] )
open fun editProjects(    @PathVariable(value = "id") id: String,     @RequestHeader(value = "token") token: String,     @PathVariable(value = "group_id") groupId: String,     @RequestBody payload: Map<String, Any>): String
Method to edit the projects of a group
Link copied to clipboard
protected open fun failedResponse(errorKey: String): String
Link copied to clipboard
Link copied to clipboard
@GetMapping(path = "/{" + GROUP_IDENTIFIER_KEY + "}", headers = [] )
open fun <T> getGroup(    @PathVariable(value = "id") id: String,     @RequestHeader(value = "token") token: String,     @PathVariable(value = "group_id") groupId: String): T
Method to get a single group
Link copied to clipboard
@GetMapping(headers = [] )
open fun <T> getGroups(    @PathVariable(value = "id") id: String,     @RequestHeader(value = "token") token: String,     @RequestParam(name = "page", defaultValue = "0", required = false) page: Int,     @RequestParam(name = "pageSize", defaultValue = "10", required = false) pageSize: Int,     @RequestParam(name = "authored_groups", defaultValue = "false", required = false) authoredGroups: Boolean,     @RequestParam(name = "name", defaultValue = "", required = false) groupName: String,     @RequestParam(name = "roles", defaultValue = "", required = false) roles: List<String>): T
Method to get a groups list
Link copied to clipboard
protected open fun getInternationalizedMessage(messageKey: String): String
Link copied to clipboard
open fun initEquinoxEnvironment(    storagePath: String,     saveMessage: String,     context: Class<out Any>,     args: Array<String>,     customSubDirectories: Array<String>)
Link copied to clipboard
protected open fun isMe(id: String, token: String): Boolean
Link copied to clipboard
private open fun isNotTheAuthor(group: Group, memberId: String): Boolean
Method to check whether the member of the operation is not the author of the group
Link copied to clipboard
private open fun isValidRequest(id: String, token: String, payload: GroupDTO, editingMode: Boolean): String
Method to check the validity of a request between createGroup and editGroup
Link copied to clipboard
@DeleteMapping(path = ""/{" + GROUP_IDENTIFIER_KEY + "}" + LEAVE_GROUP_ENDPOINT", headers = [] )
open fun leaveGroup(    @PathVariable(value = "id") id: String,     @RequestHeader(value = "token") token: String,     @PathVariable(value = "group_id") groupId: String,     @RequestBody(required = false) payload: Map<String, String>): String
Method to leave from a group
Link copied to clipboard
protected open fun loadJsonHelper(payload: JSONObject)
Link copied to clipboard
protected open fun plainResponse(status: ResponseStatus, message: String): String
Link copied to clipboard
@DeleteMapping(path = ""/{" + GROUP_IDENTIFIER_KEY + "}" + REMOVE_MEMBER_ENDPOINT", headers = [] )
open fun removeMember(    @PathVariable(value = "id") id: String,     @RequestHeader(value = "token") token: String,     @PathVariable(value = "group_id") groupId: String,     @RequestBody payload: Map<String, String>): String
Method to remove a group member
Link copied to clipboard
protected open fun setSessionLocale(locale: String)
Link copied to clipboard
protected open fun successResponse(): String
protected open fun <V> successResponse(value: V): HashMap<String, V>