Fixing roles
This commit is contained in:
parent
bf179a44fd
commit
51d1f11d56
|
@ -45,6 +45,7 @@ public class Organization extends REST<CKANOrganization>
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||||
|
@AuthorizationControl(allowedRoles={Role.CATALOGUE_EDITOR, Role.CATALOGUE_ADMIN, Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class)
|
||||||
public String list(@QueryParam(GCatConstants.LIMIT_PARAMETER) @DefaultValue("10") int limit,
|
public String list(@QueryParam(GCatConstants.LIMIT_PARAMETER) @DefaultValue("10") int limit,
|
||||||
@QueryParam(GCatConstants.OFFSET_PARAMETER) @DefaultValue("0") int offset,
|
@QueryParam(GCatConstants.OFFSET_PARAMETER) @DefaultValue("0") int offset,
|
||||||
@QueryParam(GCatConstants.COUNT_PARAMETER) @DefaultValue("false") Boolean countOnly) {
|
@QueryParam(GCatConstants.COUNT_PARAMETER) @DefaultValue("false") Boolean countOnly) {
|
||||||
|
@ -78,6 +79,7 @@ public class Organization extends REST<CKANOrganization>
|
||||||
@Path("/{" + ORGANIZATION_ID_PARAMETER + "}")
|
@Path("/{" + ORGANIZATION_ID_PARAMETER + "}")
|
||||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||||
@Override
|
@Override
|
||||||
|
@AuthorizationControl(allowedRoles={Role.CATALOGUE_EDITOR, Role.CATALOGUE_ADMIN, Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class)
|
||||||
public String read(@PathParam(ORGANIZATION_ID_PARAMETER) String id) {
|
public String read(@PathParam(ORGANIZATION_ID_PARAMETER) String id) {
|
||||||
return super.read(id);
|
return super.read(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,7 +138,7 @@ public class Profile extends BaseREST implements org.gcube.gcat.api.interfaces.P
|
||||||
@Path("/{" + PROFILE_NAME_PARAMETER + "}")
|
@Path("/{" + PROFILE_NAME_PARAMETER + "}")
|
||||||
@Consumes(MediaType.APPLICATION_XML)
|
@Consumes(MediaType.APPLICATION_XML)
|
||||||
@Produces(MediaType.APPLICATION_XML)
|
@Produces(MediaType.APPLICATION_XML)
|
||||||
@AuthorizationControl(allowedRoles={Role.CATALOGUE_ADMIN}, exception=NotAuthorizedException.class)
|
@AuthorizationControl(allowedRoles={Role.CATALOGUE_EDITOR, Role.CATALOGUE_ADMIN, Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class)
|
||||||
public Response createOrUpdate(@PathParam(PROFILE_NAME_PARAMETER) String name, String xml) {
|
public Response createOrUpdate(@PathParam(PROFILE_NAME_PARAMETER) String name, String xml) {
|
||||||
setCalledMethod("PUT /" + PROFILES + "/{" + PROFILE_NAME_PARAMETER + "}");
|
setCalledMethod("PUT /" + PROFILES + "/{" + PROFILE_NAME_PARAMETER + "}");
|
||||||
try {
|
try {
|
||||||
|
@ -169,7 +169,7 @@ public class Profile extends BaseREST implements org.gcube.gcat.api.interfaces.P
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("/{" + PROFILE_NAME_PARAMETER + "}")
|
@Path("/{" + PROFILE_NAME_PARAMETER + "}")
|
||||||
@AuthorizationControl(allowedRoles={Role.CATALOGUE_ADMIN}, exception=NotAuthorizedException.class)
|
@AuthorizationControl(allowedRoles={Role.CATALOGUE_EDITOR, Role.CATALOGUE_ADMIN, Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class)
|
||||||
public Response delete(@PathParam(PROFILE_NAME_PARAMETER) String name) {
|
public Response delete(@PathParam(PROFILE_NAME_PARAMETER) String name) {
|
||||||
setCalledMethod("DELETE /" + PROFILES + "/{" + PROFILE_NAME_PARAMETER + "}");
|
setCalledMethod("DELETE /" + PROFILES + "/{" + PROFILE_NAME_PARAMETER + "}");
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class User extends REST<CKANUser> implements org.gcube.gcat.api.interface
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||||
@AuthorizationControl(allowedRoles={Role.CATALOGUE_ADMIN}, exception=NotAuthorizedException.class)
|
@AuthorizationControl(allowedRoles={Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class)
|
||||||
public String list() {
|
public String list() {
|
||||||
return super.list(-1, -1);
|
return super.list(-1, -1);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public class User extends REST<CKANUser> implements org.gcube.gcat.api.interface
|
||||||
@Path("/{" + USER_ID_PARAMETER + "}")
|
@Path("/{" + USER_ID_PARAMETER + "}")
|
||||||
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
@Produces(GCatConstants.APPLICATION_JSON_CHARSET_UTF_8)
|
||||||
@Override
|
@Override
|
||||||
@AuthorizationControl(allowedRoles={Role.CATALOGUE_ADMIN}, exception=NotAuthorizedException.class)
|
@AuthorizationControl(allowedRoles={Role.CATALOGUE_MANAGER}, exception=NotAuthorizedException.class)
|
||||||
public String read(@PathParam(USER_ID_PARAMETER) String username) {
|
public String read(@PathParam(USER_ID_PARAMETER) String username) {
|
||||||
return super.read(username);
|
return super.read(username);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue