Change name of authorities to authorization service
This commit is contained in:
parent
35020bbf95
commit
8b58ee13f5
|
@ -90,7 +90,7 @@ public class RegistryService {
|
|||
@POST
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.USER_ADMIN)")
|
||||
@PreAuthorize("hasAnyAuthority(@AuthorizationService.SUPER_ADMIN, @AuthorizationService.USER_ADMIN)")
|
||||
public Response createRole(@RequestBody Role role) {
|
||||
calls.createRole(role);
|
||||
return Response.status(HttpStatus.OK.value()).entity(jsonUtils.createResponse("Role has been created").toString()).type(MediaType.APPLICATION_JSON).build();
|
||||
|
@ -103,8 +103,8 @@ public class RegistryService {
|
|||
@Path("/invite/{type}/{id}/manager/{email}")
|
||||
@POST
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.USER_ADMIN, @AuthoritiesService.PORTAL_ADMIN, " +
|
||||
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))")
|
||||
@PreAuthorize("hasAnyAuthority(@AuthorizationService.SUPER_ADMIN, @AuthorizationService.USER_ADMIN, @AuthorizationService.PORTAL_ADMIN, " +
|
||||
"@AuthorizationService.curator(#type), @AuthorizationService.manager(#type, #id))")
|
||||
public Response inviteUser(@PathParam("type") String type, @PathParam("id") String id, @PathParam("email") String email, @RequestBody String body) {
|
||||
Integer couId = calls.getCouId(type, id);
|
||||
if (couId != null) {
|
||||
|
@ -148,8 +148,8 @@ public class RegistryService {
|
|||
@Path("/invite/{type}/{id}/manager/{email}")
|
||||
@DELETE
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.USER_ADMIN, @AuthoritiesService.PORTAL_ADMIN, " +
|
||||
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))")
|
||||
@PreAuthorize("hasAnyAuthority(@AuthorizationService.SUPER_ADMIN, @AuthorizationService.USER_ADMIN, @AuthorizationService.PORTAL_ADMIN, " +
|
||||
"@AuthorizationService.curator(#type), @AuthorizationService.manager(#type, #id))")
|
||||
public Response cancelUserInvitations(@PathParam("type") String type, @PathParam("id") String id, @PathParam("email") String email) {
|
||||
Integer couId = calls.getCouId(type, id);
|
||||
if (couId != null) {
|
||||
|
@ -166,8 +166,8 @@ public class RegistryService {
|
|||
@Path("/invite/{type}/{id}/managers/")
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.USER_ADMIN, @AuthoritiesService.PORTAL_ADMIN, " +
|
||||
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))")
|
||||
@PreAuthorize("hasAnyAuthority(@AuthorizationService.SUPER_ADMIN, @AuthorizationService.USER_ADMIN, @AuthorizationService.PORTAL_ADMIN, " +
|
||||
"@AuthorizationService.curator(#type), @AuthorizationService.manager(#type, #id))")
|
||||
public Response getInvitedManagers(@PathParam("type") String type, @PathParam("id") String id) {
|
||||
JsonArray invited = verificationUtils.getInvitedUsers(type, id);
|
||||
return Response.status(HttpStatus.OK.value()).entity(jsonUtils.createResponse(invited).toString()).type(MediaType.APPLICATION_JSON).build();
|
||||
|
@ -259,8 +259,8 @@ public class RegistryService {
|
|||
@DELETE
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.USER_ADMIN," +
|
||||
"@AuthoritiesService.PORTAL_ADMIN, @AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))")
|
||||
@PreAuthorize("hasAnyAuthority(@AuthorizationService.SUPER_ADMIN, @AuthorizationService.USER_ADMIN," +
|
||||
"@AuthorizationService.PORTAL_ADMIN, @AuthorizationService.curator(#type), @AuthorizationService.manager(#type, #id))")
|
||||
public Response removeManagerRole(@PathParam("type") String type, @PathParam("id") String
|
||||
id, @PathParam("email") String email) {
|
||||
Integer coPersonId = calls.getCoPersonIdByEmail(email);
|
||||
|
@ -283,8 +283,8 @@ public class RegistryService {
|
|||
@Path("/{type}/{id}/subscribers")
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," +
|
||||
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))")
|
||||
@PreAuthorize("hasAnyAuthority(@AuthorizationService.SUPER_ADMIN, @AuthorizationService.PORTAL_ADMIN," +
|
||||
"@AuthorizationService.curator(#type), @AuthorizationService.manager(#type, #id))")
|
||||
public Response getSubscribers(@PathParam("type") String type, @PathParam("id") String id) {
|
||||
Integer couId = calls.getCouId(type, id);
|
||||
JsonArray subscribers = calls.getUserNamesByCouId(couId, false);
|
||||
|
@ -297,8 +297,8 @@ public class RegistryService {
|
|||
@Path("/{type}/{id}/subscribers/email")
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@PreAuthorize("hasAnyAuthority(@AuthoritiesService.SUPER_ADMIN, @AuthoritiesService.PORTAL_ADMIN," +
|
||||
"@AuthoritiesService.curator(#type), @AuthoritiesService.manager(#type, #id))")
|
||||
@PreAuthorize("hasAnyAuthority(@AuthorizationService.SUPER_ADMIN, @AuthorizationService.PORTAL_ADMIN," +
|
||||
"@AuthorizationService.curator(#type), @AuthorizationService.manager(#type, #id))")
|
||||
public Response getSubscribersEmail(@PathParam("type") String type, @PathParam("id") String id) {
|
||||
Integer couId = calls.getCouId(type, id);
|
||||
JsonArray subscribers = calls.getUserEmailByCouId(couId, false);
|
||||
|
|
|
@ -2,8 +2,8 @@ package eu.dnetlib.openaire.usermanagement.utils;
|
|||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("AuthoritiesService")
|
||||
public class AuthoritiesService {
|
||||
@Component("AuthorizationService")
|
||||
public class AuthorizationService {
|
||||
|
||||
public final String SUPER_ADMIN = "SUPER_ADMINISTRATOR";
|
||||
public final String PORTAL_ADMIN = "PORTAL_ADMINISTRATOR";
|
||||
|
@ -31,7 +31,7 @@ public class AuthoritiesService {
|
|||
*
|
||||
* Id = EE, EGI, etc
|
||||
* */
|
||||
public String subscriber(String type, String id) {
|
||||
public String member(String type, String id) {
|
||||
return type.toUpperCase() + "_" + id.toUpperCase();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue