Fix path variables for type to accept '.' in all cases
This commit is contained in:
parent
f06f44ccaf
commit
696049ee05
|
@ -36,7 +36,7 @@ public class AdminController {
|
|||
/**
|
||||
* Get the user info of the managers of a type(Community, etc.) with id(ee, egi, etc.)
|
||||
*/
|
||||
@RequestMapping(value = "/{type}/{id}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/{type:.+}/{id}", method = RequestMethod.GET)
|
||||
public ResponseEntity<User[]> getAll(@PathVariable("type") String type, @PathVariable("id") String id,
|
||||
@RequestParam(value = "email", required = false, defaultValue = "true") boolean email,
|
||||
@RequestParam(value = "name", required = false, defaultValue = "true") boolean name) {
|
||||
|
@ -54,7 +54,7 @@ public class AdminController {
|
|||
* Assign admin role to logged-in user or user with @email
|
||||
* If role doesn't exist or user is not a member of this group already, use force=true to create and assign both roles.
|
||||
*/
|
||||
@RequestMapping(value = "/{type}/{id}", method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/{type:.+}/{id}", method = RequestMethod.POST)
|
||||
public ResponseEntity<Response> assignRole(@PathVariable("type") String type, @PathVariable("id") String id, @RequestParam(required = false) String email,
|
||||
@RequestParam(required = false) String identifier,
|
||||
@RequestParam(value = "force", defaultValue = "false") boolean force) {
|
||||
|
@ -101,7 +101,7 @@ public class AdminController {
|
|||
/**
|
||||
* Remove admin role from logged-in user or user with @email
|
||||
*/
|
||||
@RequestMapping(value = "/{type}/{id}", method = RequestMethod.DELETE)
|
||||
@RequestMapping(value = "/{type:.+}/{id}", method = RequestMethod.DELETE)
|
||||
public ResponseEntity<Response> removeRole(@PathVariable("type") String type, @PathVariable("id") String id,
|
||||
@RequestParam(required = false) String identifier,
|
||||
@RequestParam(required = false) String email) {
|
||||
|
|
|
@ -36,9 +36,10 @@ public class CuratorController {
|
|||
/**
|
||||
* Create a new Curator role (only for admins)
|
||||
*/
|
||||
@RequestMapping(value = "/{type}/create", method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/{type:.+}/create", method = RequestMethod.POST)
|
||||
public ResponseEntity<Response> createRole(@PathVariable("type") String type, @RequestParam(value = "description", required = false) String description) {
|
||||
try {
|
||||
System.out.println(type);
|
||||
if (registryService.getCouId(AuthoritiesUtils.curatorRole(type)) == null) {
|
||||
registryService.createRole(AuthoritiesUtils.curatorRole(type), description != null?description:"");
|
||||
return ResponseEntity.ok(new Response("Role has been created successfully"));
|
||||
|
@ -53,7 +54,7 @@ public class CuratorController {
|
|||
/**
|
||||
* Get the user info of the curators of a type(Community, etc.)
|
||||
*/
|
||||
@RequestMapping(value = "/{type}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/{type:.+}", method = RequestMethod.GET)
|
||||
public ResponseEntity<User[]> getAll(@PathVariable("type") String type,
|
||||
@RequestParam(value = "email", required = false, defaultValue = "true") boolean email,
|
||||
@RequestParam(value = "name", required = false, defaultValue = "true") boolean name) {
|
||||
|
@ -70,7 +71,7 @@ public class CuratorController {
|
|||
/**
|
||||
* Assign curator role to logged in user or user with @email
|
||||
*/
|
||||
@RequestMapping(value = "/{type}", method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/{type:.+}", method = RequestMethod.POST)
|
||||
public ResponseEntity<Response> assignRole(@PathVariable("type") String type, @RequestParam(required = false) String email,
|
||||
@RequestParam(value = "force", defaultValue = "false") boolean force) {
|
||||
List<Integer> coPersonIds = registryService.getCoPersonIdsByEmail(email);
|
||||
|
@ -93,7 +94,7 @@ public class CuratorController {
|
|||
/**
|
||||
* Remove curator role from logged in user or user with @email
|
||||
*/
|
||||
@RequestMapping(value = "/{type}", method = RequestMethod.DELETE)
|
||||
@RequestMapping(value = "/{type:.+}", method = RequestMethod.DELETE)
|
||||
public ResponseEntity<Response> removeRole(@PathVariable("type") String type, @RequestParam(required = false) String email) {
|
||||
List<Integer> coPersonIds = registryService.getCoPersonIdsByEmail(email);
|
||||
if (coPersonIds.size() > 0) {
|
||||
|
|
|
@ -37,7 +37,7 @@ public class MemberController {
|
|||
/**
|
||||
* Create a new Group for an entity (only for admins)
|
||||
*/
|
||||
@RequestMapping(value = "/{type}/{id}/create", method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/{type:.+}/{id}/create", method = RequestMethod.POST)
|
||||
public ResponseEntity<Response> createGroup(@PathVariable("type") String type, @PathVariable("id") String id,
|
||||
@RequestParam(value = "description", required = false) String description) {
|
||||
try {
|
||||
|
@ -55,7 +55,7 @@ public class MemberController {
|
|||
/**
|
||||
* Get the user info of the members of a type(Community, etc.) with id(ee, egi, etc.)
|
||||
*/
|
||||
@RequestMapping(value = "/{type}/{id}", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/{type:.+}/{id}", method = RequestMethod.GET)
|
||||
public ResponseEntity<User[]> getAll(@PathVariable("type") String type, @PathVariable("id") String id,
|
||||
@RequestParam(value = "isManager", required = false, defaultValue = "true") boolean isManager,
|
||||
@RequestParam(value = "email", required = false, defaultValue = "true") boolean email,
|
||||
|
@ -79,7 +79,7 @@ public class MemberController {
|
|||
/**
|
||||
* Get the number of the members of a type(Community, etc.) with id(ee, egi, etc.)
|
||||
*/
|
||||
@RequestMapping(value = "/{type}/{id}/count", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/{type:.+}/{id}/count", method = RequestMethod.GET)
|
||||
public ResponseEntity<Integer> getCount(@PathVariable("type") String type, @PathVariable("id") String id) {
|
||||
Integer couId = registryService.getCouId(AuthoritiesUtils.memberRole(type, id));
|
||||
if (couId != null) {
|
||||
|
@ -93,7 +93,7 @@ public class MemberController {
|
|||
* Assign member role to logged-in user or user with @email
|
||||
* If role doesn't exist, use force=true to create and assign the role
|
||||
*/
|
||||
@RequestMapping(value = "/{type}/{id}", method = RequestMethod.POST)
|
||||
@RequestMapping(value = "/{type:.+}/{id}", method = RequestMethod.POST)
|
||||
public ResponseEntity<Response> assignRole(@PathVariable("type") String type, @PathVariable("id") String id,
|
||||
@RequestParam(required = false) String identifier,
|
||||
@RequestParam(required = false) String email,
|
||||
|
@ -118,7 +118,7 @@ public class MemberController {
|
|||
* Remove member role from logged-in user or user with @email
|
||||
* If user is an admin of this group, use force=true to revoke both roles
|
||||
*/
|
||||
@RequestMapping(value = "/{type}/{id}", method = RequestMethod.DELETE)
|
||||
@RequestMapping(value = "/{type:.+}/{id}", method = RequestMethod.DELETE)
|
||||
public ResponseEntity<Response> removeRole(@PathVariable("type") String type, @PathVariable("id") String id,
|
||||
@RequestParam(required = false) String identifier,
|
||||
@RequestParam(required = false) String email,
|
||||
|
|
Loading…
Reference in New Issue