Only admin can manage profiles

This commit is contained in:
Luca Frosini 2019-09-23 11:15:49 +02:00
parent 5c187c9842
commit f6b97c7b3d
2 changed files with 10 additions and 4 deletions

View File

@ -161,7 +161,7 @@ public class ISProfile {
public boolean createOrUpdate(String name, String xml) throws SAXException {
try {
CKANUser ckanUser = CKANUserCache.getCurrrentCKANUser();
if(ckanUser.getRole().ordinal()<Role.EDITOR.ordinal()) {
if(ckanUser.getRole().ordinal()<Role.ADMIN.ordinal()) {
throw new NotAuthorizedException("You are not authorized to manage profiles, only Catalogue Editor can manipulate profiles.");
}
MetadataUtility metadataUtility = new MetadataUtility();

View File

@ -46,10 +46,16 @@ public class CKANGroupTest extends ContextTest {
String name = "my-test-group";
ckanGroup.setName(name);
ckanGroup.create();
ckanGroup.delete(true);
}
// @Test
public void listAllGroups() throws Exception {
ContextTest.setContextByName("/d4science.research-infrastructures.eu/D4Research/AGINFRAplusDev");
CKANGroup ckanGroup = new CKANGroup();
ckanGroup.setApiKey(CKANUtility.getSysAdminAPI());
List<String> groups = listGroup();
logger.debug("Groups are:\n{}", groups);
}
// @Test