updated behaviour to "Add Aministrators"
starting fix of https://support.d4science.research-infrastructures.eu/ticket/940 git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@98601 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
95f1319487
commit
6a61757cda
|
@ -2194,7 +2194,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
if(sharingWindow.isValidForm(true)){
|
||||
|
||||
List<org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel> listUsers = sharingWindow.getSharedListUsers(); //@return the selected contacts (as InfoContactModel)
|
||||
|
||||
|
||||
if(listUsers!=null && listUsers.size()>0){
|
||||
|
||||
List<String> logins = new ArrayList<String>(listUsers.size());
|
||||
|
@ -2228,14 +2228,17 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
|||
|
||||
@Override
|
||||
public void onSuccess(Boolean arg0) {
|
||||
/*
|
||||
String title = "Added";
|
||||
|
||||
String admin = logins.size()>1?"administrators":"administrator";
|
||||
title += " "+admin;
|
||||
|
||||
String msg = logins.size() + " "+admin +" added correctly to "+file.getName();
|
||||
*/
|
||||
|
||||
MessageBox.info(title, msg, null);
|
||||
String msg = "Adding administrator/s completed successfully";
|
||||
MessageBox.info("Operation completed", msg, null);
|
||||
|
||||
}
|
||||
});
|
||||
|
|
|
@ -34,8 +34,9 @@ public enum WorkspaceOperation {
|
|||
ACCREAD("ACR", "ACR"), //ACCOUNTING READ
|
||||
SHARE_LINK("SLK", "SLK"), //SHARE URL LINK
|
||||
PUBLIC_LINK("PLK", "PLK"), //PUBLIC LINK
|
||||
VRE_CHANGE_PERIMISSIONS("CHP", "CHP"),
|
||||
ADD_ADMINISTRATOR("AAD", "AAD"); // ADD_ADMINISTRATOR
|
||||
// ADD_ADMINISTRATOR("AAD", "AAD"), // ADD_ADMINISTRATOR
|
||||
VRE_CHANGE_PERIMISSIONS("CHP", "CHP");
|
||||
|
||||
|
||||
private String id; // ID CONTEXT MENU
|
||||
private String name;
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.gcube.portlets.user.workspace.client.model.ScopeModel;
|
|||
import org.gcube.portlets.user.workspace.client.model.SmartFolderModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.SubTree;
|
||||
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
||||
import org.gcube.portlets.user.workspace.shared.ExtendedWorkspaceACL;
|
||||
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
||||
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
||||
|
@ -212,7 +213,7 @@ public interface GWTWorkspaceService extends RemoteService{
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
List<WorkspaceACL> getUserACLForFolderId(String folderId) throws Exception;
|
||||
List<ExtendedWorkspaceACL> getUserACLForFolderId(String folderId) throws Exception;
|
||||
|
||||
/**
|
||||
* @return
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.gcube.portlets.user.workspace.client.model.ScopeModel;
|
|||
import org.gcube.portlets.user.workspace.client.model.SmartFolderModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.SubTree;
|
||||
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
||||
import org.gcube.portlets.user.workspace.shared.ExtendedWorkspaceACL;
|
||||
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
||||
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
||||
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
||||
|
@ -187,7 +188,7 @@ public interface GWTWorkspaceServiceAsync {
|
|||
AsyncCallback<Void> callback);
|
||||
|
||||
void getUserACLForFolderId(String folderId,
|
||||
AsyncCallback<List<WorkspaceACL>> callback);
|
||||
AsyncCallback<List<ExtendedWorkspaceACL>> callback);
|
||||
|
||||
void getTrashContent(AsyncCallback<List<FileTrashedModel>> callback);
|
||||
|
||||
|
|
|
@ -587,7 +587,7 @@ public class ContextMenuTree {
|
|||
|
||||
|
||||
MenuItem addAdministrator = new MenuItem();
|
||||
addAdministrator.setId(WorkspaceOperation.ADD_ADMINISTRATOR.getId());
|
||||
// addAdministrator.setId(WorkspaceOperation.ADD_ADMINISTRATOR.getId());
|
||||
addAdministrator.setText("Add Administrator/s");
|
||||
addAdministrator.setIcon(Resources.getIconAddAdministrator());
|
||||
|
||||
|
@ -600,9 +600,7 @@ public class ContextMenuTree {
|
|||
}
|
||||
});
|
||||
|
||||
contextMenu.add(addAdministrator);
|
||||
|
||||
|
||||
// contextMenu.add(addAdministrator);
|
||||
|
||||
MenuItem refreshItem = new MenuItem();
|
||||
refreshItem.setId(WorkspaceOperation.REFRESH_FOLDER.getId());
|
||||
|
@ -729,7 +727,7 @@ public class ContextMenuTree {
|
|||
contextMenu.getItemByItemId(WorkspaceOperation.PASTE.getId()).setEnabled(false); //paste
|
||||
contextMenu.getItemByItemId(WorkspaceOperation.REFRESH_FOLDER.getId()).setVisible(false); //refresh
|
||||
contextMenu.getItemByItemId(WorkspaceOperation.PUBLIC_LINK.getId()).setVisible(false); //public link
|
||||
contextMenu.getItemByItemId(WorkspaceOperation.ADD_ADMINISTRATOR.getId()).setVisible(false); //public link
|
||||
// contextMenu.getItemByItemId(WorkspaceOperation.ADD_ADMINISTRATOR.getId()).setVisible(false); //public link
|
||||
|
||||
contextMenu.getItemByItemId(WorkspaceOperation.SHARE.getId()).setVisible(false); //SHARE
|
||||
contextMenu.getItemByItemId(WorkspaceOperation.UNSHARE.getId()).setVisible(false); //UNSHARE
|
||||
|
@ -797,7 +795,7 @@ public class ContextMenuTree {
|
|||
contextMenu.getItemByItemId(WorkspaceOperation.SENDTO.getId()).setVisible(false); //send to
|
||||
if(selectedItem.isShared()){//IS SHARED
|
||||
|
||||
contextMenu.getItemByItemId(WorkspaceOperation.ADD_ADMINISTRATOR.getId()).setVisible(true); //add administrator
|
||||
// contextMenu.getItemByItemId(WorkspaceOperation.ADD_ADMINISTRATOR.getId()).setVisible(true); //add administrator
|
||||
|
||||
if(selectedItem.isShareable()){ //IS SHARABLE
|
||||
contextMenu.getItemByItemId(WorkspaceOperation.INSERT_SHARED_FOLDER.getId()).setVisible(false); //insert shared folder
|
||||
|
|
|
@ -66,6 +66,7 @@ import org.gcube.portlets.user.workspace.server.util.UserUtil;
|
|||
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
||||
import org.gcube.portlets.user.workspace.server.util.resource.PropertySpecialFolderReader;
|
||||
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
||||
import org.gcube.portlets.user.workspace.shared.ExtendedWorkspaceACL;
|
||||
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
||||
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
||||
|
@ -1851,7 +1852,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
WorkspaceItem folderDestinationItem = workspace.getItem(destinationFolderId);
|
||||
|
||||
checkNotifyAddItemToShare(sourceItem, sourceSharedId, folderDestinationItem);
|
||||
checkNotifyAddItemToShare(item, sourceSharedId, folderDestinationItem);
|
||||
|
||||
if(item!=null)
|
||||
return true;
|
||||
|
@ -1894,7 +1895,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
|
||||
WorkspaceItem folderDestinationItem = workspace.getItem(destinationFolderId);
|
||||
|
||||
checkNotifyAddItemToShare(sourceItem, sourceSharedId, folderDestinationItem);
|
||||
checkNotifyAddItemToShare(item, sourceSharedId, folderDestinationItem);
|
||||
|
||||
if(item==null){
|
||||
error = true;
|
||||
|
@ -2791,12 +2792,19 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<WorkspaceACL> getUserACLForFolderId(String folderId) throws Exception{
|
||||
public List<ExtendedWorkspaceACL> getUserACLForFolderId(String folderId) throws Exception{
|
||||
try {
|
||||
workspaceLogger.info("Get user ACL to FOLDER id: "+folderId);
|
||||
WorkspaceSharedFolder wsFolder = getSharedFolderForId(folderId);
|
||||
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||
return builder.getWorkspaceACLFromACLs(Arrays.asList(wsFolder.getACLUser()));
|
||||
List<WorkspaceACL> listACL = builder.getWorkspaceACLFromACLs(Arrays.asList(wsFolder.getACLUser()));
|
||||
|
||||
List<ExtendedWorkspaceACL> listEACL = new ArrayList<ExtendedWorkspaceACL>(listACL.size());
|
||||
for (WorkspaceACL workspaceACL : listACL) {
|
||||
listEACL.add(new ExtendedWorkspaceACL(workspaceACL.getId(), workspaceACL.getLabel(), workspaceACL.getDefaultValue(), workspaceACL.getUserType(), workspaceACL.getDescription(), wsFolder.getOwner().getPortalLogin(), folderId));
|
||||
}
|
||||
|
||||
return listEACL;
|
||||
} catch (Exception e) {
|
||||
workspaceLogger.error("Error in server get getACLForFolderId", e);
|
||||
String error = ConstantsExplorer.SERVER_ERROR +" get ACL rules for selected folder. "+e.getMessage();
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
package org.gcube.portlets.user.workspace.shared;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* @Feb 21, 2014
|
||||
*
|
||||
*/
|
||||
public class ExtendedWorkspaceACL extends WorkspaceACL{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5272059977475806564L;
|
||||
|
||||
|
||||
private String loginOwner;
|
||||
private String workspaceItemId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public ExtendedWorkspaceACL() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param label
|
||||
* @param defaultValue
|
||||
* @param userType
|
||||
* @param description
|
||||
* @param loginOwner
|
||||
* @param workspaceItemId
|
||||
*/
|
||||
public ExtendedWorkspaceACL(String id, String label, boolean defaultValue, USER_TYPE userType, String description, String loginOwner, String workspaceItemId) {
|
||||
super(id, label, defaultValue, userType, description);
|
||||
this.loginOwner = loginOwner;
|
||||
this.workspaceItemId = workspaceItemId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public String getLoginOwner() {
|
||||
return loginOwner;
|
||||
}
|
||||
|
||||
public String getWorkspaceItemId() {
|
||||
return workspaceItemId;
|
||||
}
|
||||
|
||||
public void setLoginOwner(String loginOwner) {
|
||||
this.loginOwner = loginOwner;
|
||||
}
|
||||
|
||||
public void setWorkspaceItemId(String workspaceItemId) {
|
||||
this.workspaceItemId = workspaceItemId;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ExtendedWorkspaceACL [loginOwner=");
|
||||
builder.append(loginOwner);
|
||||
builder.append(", workspaceItemId=");
|
||||
builder.append(workspaceItemId);
|
||||
builder.append(", getId()=");
|
||||
builder.append(getId());
|
||||
builder.append(", getLabel()=");
|
||||
builder.append(getLabel());
|
||||
builder.append(", getDefaultValue()=");
|
||||
builder.append(getDefaultValue());
|
||||
builder.append(", getUserType()=");
|
||||
builder.append(getUserType());
|
||||
builder.append(", getDescription()=");
|
||||
builder.append(getDescription());
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue