enhancements on ACLs
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@91369 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
39f6487f91
commit
173e2451c3
|
@ -12,7 +12,6 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER/gwt-2.5.1"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
|
|
16
pom.xml
16
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>workspace-tree-widget</artifactId>
|
||||
<version>6.6.0-SNAPSHOT</version>
|
||||
<version>6.7.0-SNAPSHOT</version>
|
||||
<name>gCube Workspace Tree Widget</name>
|
||||
<description>
|
||||
gCube Workspace Tree Widget.
|
||||
|
@ -116,11 +116,17 @@
|
|||
<artifactId>aslcore</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>org.apache.directory.studio</groupId> -->
|
||||
<!-- <artifactId>org.apache.commons.io</artifactId> -->
|
||||
<!-- <version>2.1</version> -->
|
||||
<!-- </dependency> -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.directory.studio</groupId>
|
||||
<artifactId>org.apache.commons.io</artifactId>
|
||||
<version>2.1</version>
|
||||
<scope>provided</scope>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- HOME LIBRARY -->
|
||||
|
|
|
@ -103,7 +103,6 @@ import org.gcube.portlets.user.workspace.client.model.SubTree;
|
|||
import org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceService;
|
||||
import org.gcube.portlets.user.workspace.client.rpc.GWTWorkspaceServiceAsync;
|
||||
import org.gcube.portlets.user.workspace.client.uploader.FileUploader;
|
||||
import org.gcube.portlets.user.workspace.client.uploader.UpdateServiceUploader;
|
||||
import org.gcube.portlets.user.workspace.client.util.RequestBuilderWorkspaceValidateItem;
|
||||
import org.gcube.portlets.user.workspace.client.util.WindowOpenParameter;
|
||||
import org.gcube.portlets.user.workspace.client.view.BasicDNDExample;
|
||||
|
@ -137,7 +136,6 @@ import org.gcube.portlets.widgets.fileupload.client.events.FileUploadCompleteEve
|
|||
import org.gcube.portlets.widgets.fileupload.client.events.FileUploadCompleteEventHandler;
|
||||
import org.gcube.portlets.widgets.fileupload.client.events.FileUploadSelectedEvent;
|
||||
import org.gcube.portlets.widgets.fileupload.client.events.FileUploadSelectedEventHandler;
|
||||
import org.gcube.portlets.widgets.fileupload.client.view.UploadProgressDialog;
|
||||
|
||||
import com.extjs.gxt.ui.client.Registry;
|
||||
import com.extjs.gxt.ui.client.event.BaseEvent;
|
||||
|
|
|
@ -16,6 +16,7 @@ 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.SessionExpiredException;
|
||||
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
|
@ -192,4 +193,9 @@ public interface GWTWorkspaceService extends RemoteService{
|
|||
*/
|
||||
Boolean moveItems(List<String> ids, String destinationId) throws Exception;
|
||||
|
||||
List<WorkspaceACL> getACLs() throws Exception;
|
||||
|
||||
void setACLs(String folderId, List<String> listLogins, String aclType)
|
||||
throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,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.WorkspaceACL;
|
||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
@ -170,4 +171,9 @@ public interface GWTWorkspaceServiceAsync {
|
|||
void moveItems(List<String> ids, String destinationId,
|
||||
AsyncCallback<Boolean> callback);
|
||||
|
||||
void getACLs(AsyncCallback<List<WorkspaceACL>> callback);
|
||||
|
||||
void setACLs(String folderId, List<String> listLogins, String aclType,
|
||||
AsyncCallback<Void> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,285 @@
|
|||
package org.gcube.portlets.user.workspace.client.view.sharing;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
|
||||
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.resources.Resources;
|
||||
import org.gcube.portlets.user.workspace.client.view.sharing.multisuggest.MultiValuePanel;
|
||||
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
||||
|
||||
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||
import com.extjs.gxt.ui.client.Style.Scroll;
|
||||
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||
import com.extjs.gxt.ui.client.event.SelectionListener;
|
||||
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.tips.ToolTipConfig;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
|
||||
/**
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
*/
|
||||
public class DialogPermission extends Dialog {
|
||||
|
||||
private int widthDialog = 530;
|
||||
private FileModel parentFolder = null;
|
||||
private UserStore userStore = new UserStore();
|
||||
private MultiValuePanel suggestPanel = new MultiValuePanel(userStore);
|
||||
private CheckBoxGroup checkGroup = new CheckBoxGroup();
|
||||
private LayoutContainer lc = new LayoutContainer();
|
||||
private List<InfoContactModel> listAlreadyShared = new ArrayList<InfoContactModel>(){
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Compare Login
|
||||
*/
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
|
||||
if(o==null)
|
||||
return false;
|
||||
|
||||
InfoContactModel contact = (InfoContactModel) o;
|
||||
|
||||
for (int i = 0; i < listAlreadyShared.size(); i++){
|
||||
if (contact.getName().compareTo(listAlreadyShared.get(i).getName())==0)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
public FileModel getParentFolder() {
|
||||
return parentFolder;
|
||||
}
|
||||
|
||||
public void initLayout(String folderParentName){
|
||||
FormLayout layout = new FormLayout();
|
||||
layout.setLabelWidth(90);
|
||||
layout.setDefaultWidth(380);
|
||||
setLayout(layout);
|
||||
setModal(true);
|
||||
setScrollMode(Scroll.AUTOY);
|
||||
setBodyStyle("padding: 9px; background: none");
|
||||
setWidth(widthDialog);
|
||||
setHeight(200);
|
||||
setResizable(true);
|
||||
setButtonAlign(HorizontalAlignment.CENTER);
|
||||
setWidth(widthDialog);
|
||||
setButtons(Dialog.OKCANCEL);
|
||||
lc.setStyleAttribute("margin-top", "10px");
|
||||
lc.setStyleAttribute("margin-bottom", "10px");
|
||||
lc.setSize(480, 50);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use to create a new shared folder
|
||||
*/
|
||||
public DialogPermission(String folderParentName, HandlerManager eventBus) {
|
||||
|
||||
initLayout(folderParentName);
|
||||
this.setIcon(Resources.getIconSharedFolder());
|
||||
setHeading("Set permission to folder: "+folderParentName);
|
||||
|
||||
setWidth(widthDialog);
|
||||
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");
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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(){
|
||||
|
||||
this.getButtonById(Dialog.CANCEL).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.getButtonById(Dialog.OK).addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
if(isValidForm(false))
|
||||
hide();
|
||||
}
|
||||
});
|
||||
|
||||
/* 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
|
||||
* @return
|
||||
*/
|
||||
public boolean isValidForm(boolean displayAlert){
|
||||
|
||||
/*
|
||||
if(getSharedListUsers().size()==0){
|
||||
if(displayAlert)
|
||||
new MessageBoxAlert("Attention", "You must pick at least one user with which share the folder", null);
|
||||
suggestPanel.boxSetFocus();
|
||||
return false;
|
||||
}*/
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
|
@ -24,6 +24,7 @@ import com.google.gwt.event.dom.client.ClickEvent;
|
|||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
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.FlexTable;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
|
@ -135,6 +136,25 @@ public class DialogShareFolder extends Dialog {
|
|||
flexTable.setWidget(2, 1, textAreaDescription);
|
||||
|
||||
|
||||
if(!folder.isShared()){ //SETTABLE PERMISSION ONLY IF FOLDER IS NOT ALREADY SHARED
|
||||
Label labelProperty = new Label("Property");
|
||||
Anchor anchorPermission = new Anchor("Set Permissions");
|
||||
flexTable.setWidget(3, 0, labelProperty);
|
||||
flexTable.setWidget(3, 1, anchorPermission);
|
||||
final DialogPermission permission = new DialogPermission(folderParentName, eventBus);
|
||||
anchorPermission.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
permission.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// flexTable.setWidget(3, 1, permission);
|
||||
|
||||
}
|
||||
|
||||
lc.add(flexTable);
|
||||
|
||||
lc.mask();
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
package org.gcube.portlets.user.workspace.client.view.sharing;
|
||||
|
||||
import com.extjs.gxt.ui.client.data.BaseModelData;
|
||||
|
||||
/**
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
*/
|
||||
public class StringNameFilterModel extends BaseModelData {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public StringNameFilterModel() {
|
||||
|
||||
}
|
||||
|
||||
public StringNameFilterModel(String name) {
|
||||
setName(name);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return get("name");
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
set("name", name);
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
|||
*/
|
||||
public class UserStore implements ContactFetcher{
|
||||
|
||||
public static List<InfoContactModel> listAllContact = null;
|
||||
public List<InfoContactModel> listAllContact = new ArrayList<InfoContactModel>();
|
||||
|
||||
// public boolean syncronizeCleanSharedUser = false;
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.gcube.portlets.user.workspace.client.resources.Resources;
|
|||
|
||||
import com.extjs.gxt.ui.client.Style.ButtonScale;
|
||||
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||
import com.extjs.gxt.ui.client.data.BaseModel;
|
||||
import com.extjs.gxt.ui.client.data.BaseModelData;
|
||||
import com.extjs.gxt.ui.client.dnd.GridDropTarget;
|
||||
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
||||
|
@ -20,7 +19,6 @@ import com.extjs.gxt.ui.client.event.SelectionListener;
|
|||
import com.extjs.gxt.ui.client.store.GroupingStore;
|
||||
import com.extjs.gxt.ui.client.store.ListStore;
|
||||
import com.extjs.gxt.ui.client.store.Record;
|
||||
import com.extjs.gxt.ui.client.store.TreeStoreModel;
|
||||
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
||||
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
|||
import org.gcube.common.homelibrary.home.workspace.WorkspaceItemType;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.WorkspaceSmartFolder;
|
||||
import org.gcube.common.homelibrary.home.workspace.accessmanager.ACLType;
|
||||
import org.gcube.common.homelibrary.home.workspace.accounting.AccountingEntry;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.InsufficientPrivilegesException;
|
||||
import org.gcube.common.homelibrary.home.workspace.exceptions.ItemAlreadyExistException;
|
||||
|
@ -56,6 +57,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.scope.ScopeUtilFilter;
|
||||
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
|
||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
||||
import org.gcube.portlets.user.workspaceapplicationhandler.ApplicationReaderFromGenericResource;
|
||||
|
@ -2448,4 +2450,81 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param folderId
|
||||
* @param listUserIds
|
||||
* @param aclType
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void setACLs(String folderId, List<String> listLogins, String aclType) throws Exception{
|
||||
try {
|
||||
// AccessManager am = HomeLibrary.getHomeManagerFactory().getAccessManager();
|
||||
|
||||
if(folderId == null)
|
||||
throw new Exception("Folder id is null");
|
||||
|
||||
if(listLogins==null || listLogins.size()==0)
|
||||
throw new Exception("List Logins is null or empty");
|
||||
|
||||
Workspace workspace = getWorkspace();
|
||||
WorkspaceItem wsItem = workspace.getItem(folderId);
|
||||
|
||||
if(wsItem.isShared() && (wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER))){
|
||||
WorkspaceSharedFolder ite = (WorkspaceSharedFolder) workspace.getItemByPath(wsItem.getPath());
|
||||
ite.setACL(listLogins, ACLType.valueOf(aclType));
|
||||
}else
|
||||
throw new Exception("Source item is not shared or shared folder");
|
||||
} catch (Exception e) {
|
||||
workspaceLogger.error("Error in set ACLs", e);
|
||||
String error = ConstantsExplorer.SERVER_ERROR +" setting permissions. "+e.getMessage();
|
||||
throw new Exception(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<WorkspaceACL> getACLs() throws Exception{
|
||||
try {
|
||||
List<WorkspaceACL> acls = new ArrayList<WorkspaceACL>();
|
||||
|
||||
for (ACLType acl : ACLType.values()) {
|
||||
|
||||
switch (acl) {
|
||||
case ADMINISTRATOR:
|
||||
acls.add(new WorkspaceACL(acl.toString(), acl.toString()));
|
||||
break;
|
||||
case READ_ONLY:
|
||||
acls.add(new WorkspaceACL(acl.toString(), "Read Only"));
|
||||
break;
|
||||
case WRITE_OWNER:
|
||||
acls.add(new WorkspaceACL(acl.toString(), "Write Owner"));
|
||||
break;
|
||||
|
||||
case WRITE_ALL:
|
||||
acls.add(new WorkspaceACL(acl.toString(), "Write All"));
|
||||
break;
|
||||
|
||||
default:
|
||||
acls.add(new WorkspaceACL(acl.toString(), acl.toString()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(acls.size()==0)
|
||||
throw new Exception("No ACLs rules found!");
|
||||
|
||||
return acls;
|
||||
} catch (Exception e) {
|
||||
workspaceLogger.error("Error in server get ACLs", e);
|
||||
String error = ConstantsExplorer.SERVER_ERROR +" get ACL rules. "+e.getMessage();
|
||||
throw new Exception(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,8 @@ package org.gcube.portlets.user.workspace.server;
|
|||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
|
@ -44,8 +42,6 @@ import org.gcube.portlets.user.workspace.server.notifications.NotificationsUtil;
|
|||
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
||||
import org.gcube.portlets.user.workspace.shared.HandlerResultMessage;
|
||||
|
||||
import com.google.gwt.http.client.URL;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
|
@ -161,7 +157,6 @@ public class LocalUploadServlet extends HttpServlet {
|
|||
|
||||
fileUploadIS = FileUtils.openInputStream(file);
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error processing request in upload servlet", e);
|
||||
sendError(response, "Internal error: Error during request processing");
|
||||
|
@ -268,7 +263,6 @@ public class LocalUploadServlet extends HttpServlet {
|
|||
String newItemName = itemName;
|
||||
logger.trace("createReport: "+newItemName);
|
||||
createReport(request.getSession(), wa, newItemName, FileUtils.openInputStream(file), destinationFolder, response, isOverwrite);
|
||||
|
||||
}else{ //CREATE AN EXTERNAL FILE
|
||||
|
||||
createExternalFile(request.getSession(), wa, itemName, FileUtils.openInputStream(file), destinationFolder, contentType, response, isOverwrite);
|
||||
|
|
|
@ -74,10 +74,10 @@ public class WsUtil {
|
|||
|
||||
/*USE ANOTHER ACCOUNT (OTHERWHISE BY TEST_USER) FOR RUNNING
|
||||
* COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
|
||||
user=TEST_USER;
|
||||
// user=TEST_USER;
|
||||
|
||||
//UNCOMMENT THIS IN DEVELOP ENVIROMENT
|
||||
// user = "francesco.mangiacrapa";
|
||||
user = "francesco.mangiacrapa";
|
||||
|
||||
logger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
|
||||
logger.warn("session id: "+sessionID);
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package org.gcube.portlets.user.workspace.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author francesco
|
||||
*
|
||||
*/
|
||||
public class WorkspaceACL implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -1682851324671600049L;
|
||||
|
||||
private String id;
|
||||
private String label;
|
||||
public enum USER_TYPE{ADMINISTRATOR, GROUP, OWNER, OTHER};
|
||||
|
||||
public WorkspaceACL(String id, String label) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public WorkspaceACL() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("WorkspaceACL [id=");
|
||||
builder.append(id);
|
||||
builder.append(", label=");
|
||||
builder.append(label);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue