Edit Administrator can be performed by other Administrator/s
[Task #7382] Added a quick fix to 'Edit Permissions' git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@144587 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b325553df9
commit
c5dd674f5b
|
@ -394,7 +394,11 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
if(file==null || file.getIdentifier()==null)
|
||||
return;
|
||||
|
||||
rpcWorkspaceService.getOwnerByItemId(file.getIdentifier(), new AsyncCallback<InfoContactModel>() {
|
||||
//ADMINISTRATOR/S CAN EDIT OTHER ADMINISTRATOR/S
|
||||
showAddAdministratorsDialog(file);
|
||||
|
||||
//COMMENTED 03-03-2017 ONLY OWNER CAN EDIT ADMINISTRATOR/S
|
||||
/*rpcWorkspaceService.getOwnerByItemId(file.getIdentifier(), new AsyncCallback<InfoContactModel>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -419,7 +423,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
new MessageBoxAlert("Permission denied", "You have no permissions to manage administrators. You are not manager of \""+file.getName()+"\"", null);
|
||||
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -2123,14 +2127,18 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
msg+="<li>"+error +";</li><br/>";
|
||||
|
||||
}
|
||||
|
||||
new MessageBoxAlert("Warning!!", msg, null);
|
||||
return;
|
||||
}
|
||||
|
||||
if(result.getValidLogins().size()==0){
|
||||
MessageBox info = MessageBox.info("Permissions not valid to "+file.getName(), msg, null);
|
||||
info.show();
|
||||
return;
|
||||
}
|
||||
|
||||
String names = "";
|
||||
for (String name : result.getValidLogins()) {
|
||||
// String name = infoContactModel.getName()!=null? infoContactModel.getName():infoContactModel.getLogin();
|
||||
names+="<li><i>"+name +";</i></li>";
|
||||
}
|
||||
|
||||
|
|
|
@ -2816,7 +2816,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
workspaceLogger.trace("Folder " +ite.getName()+" is a "+WorkspaceFolder.class.getName());
|
||||
// ite = (WorkspaceSharedFolder) workspace.getItem(wsItem.getIdSharedFolder());
|
||||
}
|
||||
// validateACLToUser(ite, listLogins, aclType);
|
||||
|
||||
ite.setACL(listLogins, ACLType.valueOf(aclType));
|
||||
}else
|
||||
throw new Exception("Source item is not shared or shared folder");
|
||||
|
@ -2860,6 +2860,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
else
|
||||
workspaceLogger.warn("Parent folder of folder: "+folder.getName() + " is null, using current folder");
|
||||
}
|
||||
|
||||
Map<ACLType, List<String>> mapACL = folder.getACLOwner();
|
||||
|
||||
ACLType settingACL = ACLType.valueOf(aclType);
|
||||
|
@ -2869,16 +2870,19 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
AclTypeComparator comparator = new AclTypeComparator();
|
||||
|
||||
//TO COMPLETE REPORT
|
||||
List<String> validLogins = new ArrayList<String>(listLogins);
|
||||
List<String> errors = new ArrayList<String>();
|
||||
|
||||
//TO REMOVE ADMINS
|
||||
List<String> admins = mapACL.get(ACLType.ADMINISTRATOR);
|
||||
for (String admin : admins) {
|
||||
listLogins.remove(admin);
|
||||
workspaceLogger.info("Reject username: "+admin +" as "+ACLType.ADMINISTRATOR);
|
||||
errors.add("Unable to grant the privilege "+settingACL+" for "+admin+", it's lower than (parent privilege) "+ ACLType.ADMINISTRATOR);
|
||||
}
|
||||
|
||||
//TO COMPLETE REPORT
|
||||
List<String> validLogins = new ArrayList<String>(listLogins);
|
||||
List<String> errors = new ArrayList<String>();
|
||||
|
||||
ReportAssignmentACL reportValidation = new ReportAssignmentACL();
|
||||
|
||||
for (String username : listLogins) {
|
||||
|
@ -2888,7 +2892,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
if(!aclHL.equals(ACLType.ADMINISTRATOR)){
|
||||
List<String> loginsHL = mapACL.get(aclHL);
|
||||
workspaceLogger.trace("to ACLType: "+aclHL +", logins found: "+loginsHL);
|
||||
|
||||
if(loginsHL.contains(username)){
|
||||
int cmp = comparator.compare(settingACL, aclHL);
|
||||
workspaceLogger.trace("Compare result between "+aclHL + " and "+settingACL +": "+cmp);
|
||||
|
|
Loading…
Reference in New Issue