updating for ticket https://issue.imarine.research-infrastructures.eu/ticket/2634
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@91396 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c8f88e8ab5
commit
c552fa334a
|
@ -343,16 +343,20 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
fileModel.setDescription(finalDialog.getDescription());
|
fileModel.setDescription(finalDialog.getDescription());
|
||||||
|
|
||||||
//DEBUG
|
//DEBUG
|
||||||
// System.out.println("FileModel id "+fileModel.getIdentifier() + " name: "+fileModel.getName() + " parent " + fileModel.getParentFileModel());
|
/*
|
||||||
// for(InfoContactModel contact:finalDialog.getSharedListUsers() ){
|
System.out.println("FileModel id "+fileModel.getIdentifier() + " name: "+fileModel.getName() + " parent " + fileModel.getParentFileModel());
|
||||||
// System.out.println("Share with Contact "+contact) ;
|
for(InfoContactModel contact:finalDialog.getSharedListUsers() ){
|
||||||
//
|
System.out.println("Share with Contact "+contact) ;
|
||||||
// }
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
System.out.println("ACL is "+finalDialog.getSelectedACL());
|
||||||
|
|
||||||
|
|
||||||
Info.display("Info", "An operation of sharing was submitted");
|
Info.display("Info", "An operation of sharing was submitted");
|
||||||
explorerPanel.mask("Submitting operation");
|
explorerPanel.mask("Submitting operation");
|
||||||
|
|
||||||
rpcWorkspaceService.shareFolder(fileModel, finalDialog.getSharedListUsers(), isNewFolder, new AsyncCallback<Boolean>() {
|
rpcWorkspaceService.shareFolder(fileModel, finalDialog.getSharedListUsers(), isNewFolder, finalDialog.getSelectedACL(), new AsyncCallback<Boolean>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
|
|
@ -107,7 +107,8 @@ public interface GWTWorkspaceService extends RemoteService{
|
||||||
|
|
||||||
public GWTWorkspaceItem getTimeSeriesById(String identifier) throws Exception;
|
public GWTWorkspaceItem getTimeSeriesById(String identifier) throws Exception;
|
||||||
|
|
||||||
boolean shareFolder(FileModel folder, List<InfoContactModel> listContacts, boolean isNewFolder) throws Exception;
|
boolean shareFolder(FileModel folder, List<InfoContactModel> listContacts,
|
||||||
|
boolean isNewFolder, WorkspaceACL acl) throws Exception;
|
||||||
|
|
||||||
public List<InfoContactModel> getListUserSharedByFolderSharedId(String itemId) throws Exception;
|
public List<InfoContactModel> getListUserSharedByFolderSharedId(String itemId) throws Exception;
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,8 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
AsyncCallback<GWTWorkspaceItem> callback);
|
AsyncCallback<GWTWorkspaceItem> callback);
|
||||||
|
|
||||||
void shareFolder(FileModel folder, List<InfoContactModel> listContacts,
|
void shareFolder(FileModel folder, List<InfoContactModel> listContacts,
|
||||||
boolean isNewFolder, AsyncCallback<Boolean> callback);
|
boolean isNewFolder, WorkspaceACL acl,
|
||||||
|
AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
void getListUserSharedByFolderSharedId(String itemId,
|
void getListUserSharedByFolderSharedId(String itemId,
|
||||||
AsyncCallback<List<InfoContactModel>> callback);
|
AsyncCallback<List<InfoContactModel>> callback);
|
||||||
|
|
|
@ -15,14 +15,9 @@ import com.extjs.gxt.ui.client.Style.Scroll;
|
||||||
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||||
import com.extjs.gxt.ui.client.widget.Dialog;
|
import com.extjs.gxt.ui.client.widget.Dialog;
|
||||||
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
|
||||||
import com.extjs.gxt.ui.client.widget.form.CheckBox;
|
|
||||||
import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
|
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
||||||
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
|
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.FlexTable;
|
|
||||||
import com.google.gwt.user.client.ui.Label;
|
import com.google.gwt.user.client.ui.Label;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,10 +30,10 @@ public class DialogPermission extends Dialog {
|
||||||
private FileModel parentFolder = null;
|
private FileModel parentFolder = null;
|
||||||
private UserStore userStore = new UserStore();
|
private UserStore userStore = new UserStore();
|
||||||
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
||||||
private CheckBoxGroup checkGroup = new CheckBoxGroup();
|
private PanelPermission panelPermission;
|
||||||
private LayoutContainer lc = new LayoutContainer();
|
private DialogPermission INSTANCE = this;
|
||||||
private List<InfoContactModel> listAlreadyShared = new ArrayList<InfoContactModel>(){
|
private List<InfoContactModel> listAlreadyShared = new ArrayList<InfoContactModel>(){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -86,9 +81,6 @@ public class DialogPermission extends Dialog {
|
||||||
setButtonAlign(HorizontalAlignment.CENTER);
|
setButtonAlign(HorizontalAlignment.CENTER);
|
||||||
setWidth(widthDialog);
|
setWidth(widthDialog);
|
||||||
setButtons(Dialog.OKCANCEL);
|
setButtons(Dialog.OKCANCEL);
|
||||||
lc.setStyleAttribute("margin-top", "10px");
|
|
||||||
lc.setStyleAttribute("margin-bottom", "10px");
|
|
||||||
lc.setSize(480, 50);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,70 +88,31 @@ public class DialogPermission extends Dialog {
|
||||||
*/
|
*/
|
||||||
public DialogPermission(String folderParentName, HandlerManager eventBus) {
|
public DialogPermission(String folderParentName, HandlerManager eventBus) {
|
||||||
|
|
||||||
|
AppControllerExplorer.rpcWorkspaceService.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<WorkspaceACL> result) {
|
||||||
|
panelPermission = new PanelPermission(result);
|
||||||
|
INSTANCE.layout(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
INSTANCE.add(new Label("Error on recovering ACLs"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
initLayout(folderParentName);
|
initLayout(folderParentName);
|
||||||
this.setIcon(Resources.getIconSharedFolder());
|
this.setIcon(Resources.getIconSharedFolder());
|
||||||
setHeading("Set permission to folder: "+folderParentName);
|
setHeading("Set permission to folder: "+folderParentName);
|
||||||
|
|
||||||
setWidth(widthDialog);
|
setWidth(widthDialog);
|
||||||
setButtons(Dialog.OKCANCEL);
|
setButtons(Dialog.OKCANCEL);
|
||||||
|
|
||||||
FlexTable flexTable = new FlexTable();
|
|
||||||
flexTable.setStyleName("userssuggest");
|
|
||||||
Label lableShareWith = new Label("Administrators");
|
|
||||||
flexTable.setWidget(0, 0, lableShareWith);
|
|
||||||
flexTable.setWidget(0, 1, suggestPanel);
|
|
||||||
|
|
||||||
checkGroup.mask("Loading");
|
add(panelPermission);
|
||||||
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(List<WorkspaceACL> result) {
|
|
||||||
for (WorkspaceACL acl : result) {
|
|
||||||
CheckBox box = createCheckBox(acl);
|
|
||||||
checkGroup.add(box);
|
|
||||||
}
|
|
||||||
checkGroup.unmask();
|
|
||||||
lc.layout();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
checkGroup.unmask();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
Label labelOthers = new Label("Others");
|
|
||||||
flexTable.setWidget(2, 0, labelOthers);
|
|
||||||
flexTable.setWidget(2, 1, checkGroup);
|
|
||||||
|
|
||||||
lc.add(flexTable);
|
|
||||||
|
|
||||||
add(lc);
|
|
||||||
addListners();
|
addListners();
|
||||||
}
|
}
|
||||||
|
|
||||||
private CheckBox createCheckBox(WorkspaceACL acl){
|
|
||||||
|
|
||||||
CheckBox check = new CheckBox();
|
|
||||||
// check.setId(dsm.getId());
|
|
||||||
// check.setBoxLabel(dsm.getName() + " ("+property+")");
|
|
||||||
check.setBoxLabel(acl.getLabel());
|
|
||||||
check.setValueAttribute(acl.getLabel());
|
|
||||||
check.setData("WORKSPACEACL", acl);
|
|
||||||
check.setToolTip(new ToolTipConfig(acl.getLabel()));
|
|
||||||
return check;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<InfoContactModel> getSharedListUsers() {
|
|
||||||
// printSelectedUser();
|
|
||||||
return suggestPanel.getSelectedUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void addListners(){
|
public void addListners(){
|
||||||
|
|
||||||
|
@ -181,89 +134,8 @@ public class DialogPermission extends Dialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* buttonMultiDrag.addClickHandler(new ClickHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(ClickEvent event) {
|
|
||||||
final MultiDragContact multiDrag = new MultiDragContact();
|
|
||||||
multiDrag.show();
|
|
||||||
|
|
||||||
List<InfoContactModel> exclusiveContacts = userStore.getExclusiveContactsFromAllContact(suggestPanel.getSelectedUser());
|
|
||||||
multiDrag.addSourceContacts(exclusiveContacts);
|
|
||||||
|
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : suggestPanel.getSelectedUser()) {
|
|
||||||
if(!listAlreadyShared.contains(infoContactModel))
|
|
||||||
multiDrag.addTargetContact(infoContactModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
multiDrag.addAlreadySharedContacts(suggestPanel.getSelectedUser());
|
|
||||||
|
|
||||||
// multiDrag.addTargetContacts(suggestPanel.getSelectedUser());
|
|
||||||
|
|
||||||
multiDrag.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void componentSelected(ButtonEvent ce) {
|
|
||||||
|
|
||||||
initSuggestContacts();
|
|
||||||
|
|
||||||
for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
|
|
||||||
suggestPanel.addRecipient(infoContactModel.getName(),true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for (InfoContactModel infoContactModel : multiDrag.getTargetListContact()) {
|
|
||||||
//
|
|
||||||
// if(!listAlreadySharedContains(infoContactModel))
|
|
||||||
// suggestPanel.addRecipient(infoContactModel.getName(),true);
|
|
||||||
// }
|
|
||||||
|
|
||||||
suggestPanel.boxSetFocus();
|
|
||||||
|
|
||||||
// printSelectedUser();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean listAlreadySharedContains(InfoContactModel contact){
|
|
||||||
|
|
||||||
if(contact==null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
for (InfoContactModel ct : listAlreadyShared) {
|
|
||||||
|
|
||||||
if(ct.getLogin().compareTo(contact.getLogin())==0){
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//DEBUG
|
|
||||||
private void printSelectedUser(){
|
|
||||||
|
|
||||||
System.out.println("SELETECTED USERS: ");
|
|
||||||
for (InfoContactModel contact : suggestPanel.getSelectedUser())
|
|
||||||
System.out.println(contact);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initSuggestContacts(){
|
|
||||||
|
|
||||||
suggestPanel.resetItemSelected();
|
|
||||||
|
|
||||||
for (InfoContactModel contact : listAlreadyShared) {
|
|
||||||
suggestPanel.addRecipient(contact.getName(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param displayAlert
|
* @param displayAlert
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.workspace.client.view.sharing;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||||
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
|
import org.gcube.portlets.user.workspace.client.model.InfoContactModel;
|
||||||
|
@ -10,6 +11,7 @@ import org.gcube.portlets.user.workspace.client.resources.Resources;
|
||||||
import org.gcube.portlets.user.workspace.client.view.sharing.multisuggest.MultiDragContact;
|
import org.gcube.portlets.user.workspace.client.view.sharing.multisuggest.MultiDragContact;
|
||||||
import org.gcube.portlets.user.workspace.client.view.sharing.multisuggest.MultiValuePanel;
|
import org.gcube.portlets.user.workspace.client.view.sharing.multisuggest.MultiValuePanel;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert;
|
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
||||||
|
|
||||||
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||||
|
@ -24,7 +26,6 @@ import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Anchor;
|
|
||||||
import com.google.gwt.user.client.ui.Button;
|
import com.google.gwt.user.client.ui.Button;
|
||||||
import com.google.gwt.user.client.ui.FlexTable;
|
import com.google.gwt.user.client.ui.FlexTable;
|
||||||
import com.google.gwt.user.client.ui.Label;
|
import com.google.gwt.user.client.ui.Label;
|
||||||
|
@ -44,6 +45,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
||||||
private Button buttonMultiDrag = new Button("Choose Contacts");
|
private Button buttonMultiDrag = new Button("Choose Contacts");
|
||||||
private TextField<String> txtOwner;
|
private TextField<String> txtOwner;
|
||||||
|
private PanelPermission permission;
|
||||||
|
|
||||||
private List<InfoContactModel> listAlreadyShared = new ArrayList<InfoContactModel>(){
|
private List<InfoContactModel> listAlreadyShared = new ArrayList<InfoContactModel>(){
|
||||||
|
|
||||||
|
@ -119,7 +121,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
lc.setStyleAttribute("margin-bottom", "10px");
|
lc.setStyleAttribute("margin-bottom", "10px");
|
||||||
lc.setSize(480, 50);
|
lc.setSize(480, 50);
|
||||||
|
|
||||||
FlexTable flexTable = new FlexTable();
|
final FlexTable flexTable = new FlexTable();
|
||||||
flexTable.setStyleName("userssuggest");
|
flexTable.setStyleName("userssuggest");
|
||||||
Label labelShareWith = new Label("Share with users");
|
Label labelShareWith = new Label("Share with users");
|
||||||
flexTable.setWidget(0, 0, labelShareWith);
|
flexTable.setWidget(0, 0, labelShareWith);
|
||||||
|
@ -137,22 +139,27 @@ public class DialogShareFolder extends Dialog {
|
||||||
|
|
||||||
|
|
||||||
if(!folder.isShared()){ //SETTABLE PERMISSION ONLY IF FOLDER IS NOT ALREADY SHARED
|
if(!folder.isShared()){ //SETTABLE PERMISSION ONLY IF FOLDER IS NOT ALREADY SHARED
|
||||||
Label labelProperty = new Label("Property");
|
Label labelProperty = new Label("Permissions");
|
||||||
Anchor anchorPermission = new Anchor("Set Permissions");
|
// final ToggleButton togglePermission = new ToggleButton("Set Permissions");
|
||||||
flexTable.setWidget(3, 0, labelProperty);
|
flexTable.setWidget(3, 0, labelProperty);
|
||||||
flexTable.setWidget(3, 1, anchorPermission);
|
|
||||||
final DialogPermission permission = new DialogPermission(folderParentName, eventBus);
|
flexTable.setWidget(3, 1, Resources.getIconLoading().createImage());
|
||||||
anchorPermission.addClickHandler(new ClickHandler() {
|
|
||||||
|
AppControllerExplorer.rpcWorkspaceService.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onSuccess(List<WorkspaceACL> result) {
|
||||||
permission.show();
|
permission = new PanelPermission(result);
|
||||||
|
flexTable.setWidget(3, 1, permission);
|
||||||
|
lc.layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
flexTable.setWidget(3, 1, new Label("Error on recovering ACLs"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// flexTable.setWidget(3, 1, permission);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
lc.add(flexTable);
|
lc.add(flexTable);
|
||||||
|
@ -215,7 +222,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
setScrollMode(Scroll.AUTOY);
|
setScrollMode(Scroll.AUTOY);
|
||||||
setBodyStyle("padding: 9px; background: none");
|
setBodyStyle("padding: 9px; background: none");
|
||||||
setWidth(widthDialog);
|
setWidth(widthDialog);
|
||||||
setHeight(380);
|
setHeight(397);
|
||||||
setResizable(true);
|
setResizable(true);
|
||||||
setButtonAlign(HorizontalAlignment.CENTER);
|
setButtonAlign(HorizontalAlignment.CENTER);
|
||||||
setWidth(widthDialog);
|
setWidth(widthDialog);
|
||||||
|
@ -230,7 +237,7 @@ public class DialogShareFolder extends Dialog {
|
||||||
initLayout(folderParentName);
|
initLayout(folderParentName);
|
||||||
this.setIcon(Resources.getIconSharedFolder());
|
this.setIcon(Resources.getIconSharedFolder());
|
||||||
setHeading("Create a new shared folder in: "+folderParentName);
|
setHeading("Create a new shared folder in: "+folderParentName);
|
||||||
|
setHeight(375);
|
||||||
setWidth(widthDialog);
|
setWidth(widthDialog);
|
||||||
setButtons(Dialog.OKCANCEL);
|
setButtons(Dialog.OKCANCEL);
|
||||||
|
|
||||||
|
@ -245,12 +252,12 @@ public class DialogShareFolder extends Dialog {
|
||||||
textAreaDescription.setHeight(heightTextArea);
|
textAreaDescription.setHeight(heightTextArea);
|
||||||
textAreaDescription.setWidth(380);
|
textAreaDescription.setWidth(380);
|
||||||
|
|
||||||
LayoutContainer lc = new LayoutContainer();
|
final LayoutContainer lc = new LayoutContainer();
|
||||||
lc.setStyleAttribute("margin-top", "10px");
|
lc.setStyleAttribute("margin-top", "10px");
|
||||||
lc.setStyleAttribute("margin-bottom", "10px");
|
lc.setStyleAttribute("margin-bottom", "10px");
|
||||||
lc.setSize(480, 50);
|
lc.setSize(480, 50);
|
||||||
|
|
||||||
FlexTable flexTable = new FlexTable();
|
final FlexTable flexTable = new FlexTable();
|
||||||
flexTable.setStyleName("userssuggest");
|
flexTable.setStyleName("userssuggest");
|
||||||
Label lableShareWith = new Label("Share with users");
|
Label lableShareWith = new Label("Share with users");
|
||||||
flexTable.setWidget(0, 0, lableShareWith);
|
flexTable.setWidget(0, 0, lableShareWith);
|
||||||
|
@ -266,6 +273,30 @@ public class DialogShareFolder extends Dialog {
|
||||||
flexTable.setWidget(2, 0, labelDescription);
|
flexTable.setWidget(2, 0, labelDescription);
|
||||||
flexTable.setWidget(2, 1, textAreaDescription);
|
flexTable.setWidget(2, 1, textAreaDescription);
|
||||||
|
|
||||||
|
|
||||||
|
Label labelProperty = new Label("Permissions");
|
||||||
|
// final ToggleButton togglePermission = new ToggleButton("Set Permissions");
|
||||||
|
flexTable.setWidget(3, 0, labelProperty);
|
||||||
|
|
||||||
|
flexTable.setWidget(3, 1, Resources.getIconLoading().createImage());
|
||||||
|
|
||||||
|
AppControllerExplorer.rpcWorkspaceService.getACLs(new AsyncCallback<List<WorkspaceACL>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<WorkspaceACL> result) {
|
||||||
|
permission = new PanelPermission(result);
|
||||||
|
flexTable.setWidget(3, 1, permission);
|
||||||
|
lc.layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
flexTable.setWidget(3, 1, new Label("Error on recovering ACLs"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
lc.add(flexTable);
|
lc.add(flexTable);
|
||||||
|
|
||||||
setFocusWidget(txtName);
|
setFocusWidget(txtName);
|
||||||
|
@ -421,4 +452,10 @@ public class DialogShareFolder extends Dialog {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WorkspaceACL getSelectedACL(){
|
||||||
|
if(permission!=null)
|
||||||
|
return permission.getSelectedACL();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
package org.gcube.portlets.user.workspace.client.view.sharing;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.WorkspaceACL.USER_TYPE;
|
||||||
|
|
||||||
|
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||||
|
import com.extjs.gxt.ui.client.widget.form.Radio;
|
||||||
|
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
|
||||||
|
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
|
||||||
|
|
||||||
|
public class PanelPermission extends LayoutContainer {
|
||||||
|
|
||||||
|
protected static final String WORKSPACEACL = "WORKSPACEACL";
|
||||||
|
private RadioGroup radioGroup = new RadioGroup();
|
||||||
|
|
||||||
|
public PanelPermission(List<WorkspaceACL> acls) {
|
||||||
|
|
||||||
|
setStyleAttribute("margin-top", "10px");
|
||||||
|
setStyleAttribute("margin-bottom", "10px");
|
||||||
|
setSize(350, 30);
|
||||||
|
|
||||||
|
radioGroup.mask("Loading ACLs");
|
||||||
|
|
||||||
|
for (WorkspaceACL acl : acls) {
|
||||||
|
|
||||||
|
if(acl.getUserType().equals(USER_TYPE.OTHER)){
|
||||||
|
Radio radio = createRadio(acl);
|
||||||
|
radioGroup.add(radio);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
radioGroup.unmask();
|
||||||
|
add(radioGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Radio createRadio(WorkspaceACL acl) {
|
||||||
|
|
||||||
|
Radio radio = new Radio();
|
||||||
|
// check.setId(dsm.getId());
|
||||||
|
// check.setBoxLabel(dsm.getName() + " ("+property+")");
|
||||||
|
radio.setBoxLabel(acl.getLabel());
|
||||||
|
radio.setValueAttribute(acl.getLabel());
|
||||||
|
radio.setData(WORKSPACEACL, acl);
|
||||||
|
radio.setToolTip(new ToolTipConfig(acl.getLabel()));
|
||||||
|
radio.setValue(acl.getDefaultValue());
|
||||||
|
return radio;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorkspaceACL getSelectedACL() {
|
||||||
|
|
||||||
|
if (radioGroup.getValue()!=null)
|
||||||
|
return (WorkspaceACL) radioGroup.getValue().getData(WORKSPACEACL);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public List<WorkspaceACL> getCheckedGroupList() {
|
||||||
|
|
||||||
|
List<WorkspaceACL> listDS = new ArrayList<WorkspaceACL>();
|
||||||
|
|
||||||
|
List<Radio> values = new ArrayList<Radio>();
|
||||||
|
|
||||||
|
if (radioGroup.getValue()!=null){
|
||||||
|
Radio radio = radioGroup.getValue();
|
||||||
|
values.add((Radio) radio);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
List<Field<?>> listChecks = radioGroup.getAll();
|
||||||
|
for (Field<?> field : listChecks) {
|
||||||
|
values.add((Radio) field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Radio radio : values) {
|
||||||
|
if (radio.isEnabled()){
|
||||||
|
WorkspaceACL acl = (WorkspaceACL) radio.getData(WORKSPACEACL);
|
||||||
|
listDS.add(acl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listDS.size() == 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return listDS;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
|
@ -58,6 +58,7 @@ import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
||||||
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
import org.gcube.portlets.user.workspace.server.util.scope.ScopeUtilFilter;
|
||||||
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.WorkspaceACL.USER_TYPE;
|
||||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
|
||||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
||||||
import org.gcube.portlets.user.workspaceapplicationhandler.ApplicationReaderFromGenericResource;
|
import org.gcube.portlets.user.workspaceapplicationhandler.ApplicationReaderFromGenericResource;
|
||||||
|
@ -1797,7 +1798,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shareFolder(FileModel folder, List<InfoContactModel> listContacts, boolean isNewFolder) throws Exception {
|
public boolean shareFolder(FileModel folder, List<InfoContactModel> listContacts, boolean isNewFolder, WorkspaceACL acl) throws Exception {
|
||||||
|
|
||||||
if(isSessionExpired())
|
if(isSessionExpired())
|
||||||
throw new SessionExpiredException();
|
throw new SessionExpiredException();
|
||||||
|
@ -1844,16 +1845,18 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
|
|
||||||
boolean created = sharedFolder==null?false:true;
|
boolean created = sharedFolder==null?false:true;
|
||||||
|
|
||||||
|
if(acl!=null)
|
||||||
|
setACLs(sharedFolder.getId(), listLogin, acl.getId().toString());
|
||||||
|
|
||||||
if(created){
|
if(created){
|
||||||
NotificationsProducer np = getNotificationProducer();
|
NotificationsProducer np = getNotificationProducer();
|
||||||
if(!sourceFolderIsShared) //if source folder is not already shared
|
if(!sourceFolderIsShared) //if source folder is not already shared
|
||||||
np.notifyFolderSharing(listContacts, sharedFolder);
|
np.notifyFolderSharing(listContacts, sharedFolder);
|
||||||
else{
|
else{
|
||||||
System.out.println("SHARED CONTACS: ");
|
/*System.out.println("SHARED CONTACS: ");
|
||||||
printContacts(listSharedContact);
|
printContacts(listSharedContact);
|
||||||
System.out.println("NEW CONTACS: ");
|
System.out.println("NEW CONTACS: ");
|
||||||
printContacts(listContacts);
|
printContacts(listContacts);*/
|
||||||
np.notifyAddedUsersToSharing(listSharedContact, listContacts, sharedFolder);
|
np.notifyAddedUsersToSharing(listSharedContact, listContacts, sharedFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2461,13 +2464,15 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
@Override
|
@Override
|
||||||
public void setACLs(String folderId, List<String> listLogins, String aclType) throws Exception{
|
public void setACLs(String folderId, List<String> listLogins, String aclType) throws Exception{
|
||||||
try {
|
try {
|
||||||
// AccessManager am = HomeLibrary.getHomeManagerFactory().getAccessManager();
|
|
||||||
|
|
||||||
if(folderId == null)
|
if(folderId == null)
|
||||||
throw new Exception("Folder id is null");
|
throw new Exception("Folder id is null");
|
||||||
|
|
||||||
if(listLogins==null || listLogins.size()==0)
|
if(listLogins==null || listLogins.size()==0)
|
||||||
throw new Exception("List Logins is null or empty");
|
throw new Exception("List Logins is null or empty");
|
||||||
|
|
||||||
|
workspaceLogger.trace("Setting ACL for folder id: "+folderId);
|
||||||
|
workspaceLogger.trace("ACL type is: "+aclType);
|
||||||
|
|
||||||
Workspace workspace = getWorkspace();
|
Workspace workspace = getWorkspace();
|
||||||
WorkspaceItem wsItem = workspace.getItem(folderId);
|
WorkspaceItem wsItem = workspace.getItem(folderId);
|
||||||
|
@ -2477,6 +2482,8 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
ite.setACL(listLogins, ACLType.valueOf(aclType));
|
ite.setACL(listLogins, ACLType.valueOf(aclType));
|
||||||
}else
|
}else
|
||||||
throw new Exception("Source item is not shared or shared folder");
|
throw new Exception("Source item is not shared or shared folder");
|
||||||
|
|
||||||
|
workspaceLogger.trace("Setting ACL completed, retuning");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
workspaceLogger.error("Error in set ACLs", e);
|
workspaceLogger.error("Error in set ACLs", e);
|
||||||
String error = ConstantsExplorer.SERVER_ERROR +" setting permissions. "+e.getMessage();
|
String error = ConstantsExplorer.SERVER_ERROR +" setting permissions. "+e.getMessage();
|
||||||
|
@ -2498,21 +2505,21 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
|
|
||||||
switch (acl) {
|
switch (acl) {
|
||||||
case ADMINISTRATOR:
|
case ADMINISTRATOR:
|
||||||
acls.add(new WorkspaceACL(acl.toString(), acl.toString()));
|
acls.add(new WorkspaceACL(acl.toString(), acl.toString(), false, USER_TYPE.ADMINISTRATOR));
|
||||||
break;
|
break;
|
||||||
case READ_ONLY:
|
case READ_ONLY:
|
||||||
acls.add(new WorkspaceACL(acl.toString(), "Read Only"));
|
acls.add(new WorkspaceACL(acl.toString(), "Read Only", false, USER_TYPE.OTHER));
|
||||||
break;
|
break;
|
||||||
case WRITE_OWNER:
|
case WRITE_OWNER:
|
||||||
acls.add(new WorkspaceACL(acl.toString(), "Write Owner"));
|
acls.add(new WorkspaceACL(acl.toString(), "Write Owner", true, USER_TYPE.OTHER));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WRITE_ALL:
|
case WRITE_ALL:
|
||||||
acls.add(new WorkspaceACL(acl.toString(), "Write All"));
|
acls.add(new WorkspaceACL(acl.toString(), "Write All", false, USER_TYPE.OTHER));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
acls.add(new WorkspaceACL(acl.toString(), acl.toString()));
|
acls.add(new WorkspaceACL(acl.toString(), acl.toString(), false, USER_TYPE.OTHER));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,17 @@ public class WorkspaceACL implements Serializable{
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
private String label;
|
private String label;
|
||||||
|
private boolean defaultValue;
|
||||||
|
private USER_TYPE userType;
|
||||||
|
|
||||||
public enum USER_TYPE{ADMINISTRATOR, GROUP, OWNER, OTHER};
|
public enum USER_TYPE{ADMINISTRATOR, GROUP, OWNER, OTHER};
|
||||||
|
|
||||||
public WorkspaceACL(String id, String label) {
|
public WorkspaceACL(String id, String label, boolean defaultValue, USER_TYPE userType) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.userType = userType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,6 +51,24 @@ public class WorkspaceACL implements Serializable{
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getDefaultValue() {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDefaultValue(boolean defaultValue) {
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public USER_TYPE getUserType() {
|
||||||
|
return userType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserType(USER_TYPE userType) {
|
||||||
|
this.userType = userType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
@ -53,6 +76,10 @@ public class WorkspaceACL implements Serializable{
|
||||||
builder.append(id);
|
builder.append(id);
|
||||||
builder.append(", label=");
|
builder.append(", label=");
|
||||||
builder.append(label);
|
builder.append(label);
|
||||||
|
builder.append(", defaultValue=");
|
||||||
|
builder.append(defaultValue);
|
||||||
|
builder.append(", userType=");
|
||||||
|
builder.append(userType);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue