diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties
index 78868eda95..188b7bcd26 100644
--- a/config/alfresco/messages/webclient.properties
+++ b/config/alfresco/messages/webclient.properties
@@ -334,7 +334,6 @@ sizeQuota=Quota
# Note - these come from the server, the english translation is generally the same
Administrator=Administrator
Consumer=Consumer
-Read=Consumer
Coordinator=Coordinator
Collaborator=Collaborator
Contributor=Contributor
@@ -570,6 +569,31 @@ select_users=Select Users to add to this Group
selected_users=Selected Users
groups_err_group_name=Group ID cannot contain the characters: {0}
groups_err_exists=A group ID with the same name already exists, group identifiers must be unique.
+Read=Read
+Write=Write
+Delete=Delete
+permission=Permission
+permissions=Permissions
+manage_permissions_title=Manage permissions for ''{0}''
+manage_permissions_subtitle=Manage the permissions you have granted to users who access your folder or file.
+manage_permissions=Manage permissions
+view_permissions=View permissions
+set_permissions=Set permissions
+change_permissions=Change Permissions
+set_permissions_title=Setting Permissions for ''{0}''
+set_permissions_subtitle=This dialog allows you to give other users access to your folder or file
+select_usersgroups_perms=Select user/group and their permission(s)
+selected_usersgroups_perms=Selected users/groups and their permission(s)
+remove_permissions_title=Remove User ''{0}''
+remove_permissions_subtitle=To remove all permissions for user, click Yes.
+remove_permissions=Are you sure you want to remove all permissions for this user?
+edit_permissions_title=Modify permissions for ''{0}''
+view_permissions_title=View permissions for ''{0}''
+edit_permissions_subtitle=Modify the permissions granted to a user for accessing your folder or file.
+view_permissions_subtitle=The permissions granted to a user for accessing your folder or file.
+select_perm=Select permission
+selected_perm=Selected permission
+change_user_perms=Change User Permissions
# Invite Users Wizard messages
invite_title=Invite Users Wizard
diff --git a/config/alfresco/web-client-config-dialogs.xml b/config/alfresco/web-client-config-dialogs.xml
index cfa8a27033..f497e45216 100644
--- a/config/alfresco/web-client-config-dialogs.xml
+++ b/config/alfresco/web-client-config-dialogs.xml
@@ -340,11 +340,16 @@
title-id="edit_permissions_title" description-id="edit_permissions_subtitle" />
+
+
diff --git a/config/alfresco/web-client-config-wcm-actions.xml b/config/alfresco/web-client-config-wcm-actions.xml
index 6b5b9bc489..dc7f182d77 100644
--- a/config/alfresco/web-client-config-wcm-actions.xml
+++ b/config/alfresco/web-client-config-wcm-actions.xml
@@ -237,6 +237,44 @@
+
+
+
+ ChangePermissions
+
+ org.alfresco.web.action.evaluator.ManagePermissionIsMainStoreEvaluator
+ manage_permissions
+ /images/icons/edit_group.gif
+ dialog:managePermissions
+ #{AVMBrowseBean.setupContentAction}
+
+ #{actionContext.id}
+
+
+
+
+
+ set_permissions
+ org.alfresco.web.action.evaluator.ManagePermissionIsMainStoreEvaluator
+ /images/icons/manage_permissions.gif
+ dialog:setPermissions
+
+
+
+
+
+ Read
+
+ org.alfresco.web.action.evaluator.ViewPermissionEvaluator
+ view_permissions
+ /images/icons/person.gif
+ dialog:viewPermissions
+ #{AVMBrowseBean.setupContentAction}
+
+ #{actionContext.id}
+
+
+
@@ -346,6 +384,8 @@
+
+
@@ -357,6 +397,8 @@
+
+
@@ -414,6 +456,8 @@
+
+
@@ -423,6 +467,8 @@
+
+
@@ -461,6 +507,11 @@
+
+
+
+
+
diff --git a/source/java/org/alfresco/web/action/evaluator/ManagePermissionIsMainStoreEvaluator.java b/source/java/org/alfresco/web/action/evaluator/ManagePermissionIsMainStoreEvaluator.java
new file mode 100644
index 0000000000..84b37a0aac
--- /dev/null
+++ b/source/java/org/alfresco/web/action/evaluator/ManagePermissionIsMainStoreEvaluator.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2005-2008 Alfresco Software Limited. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA. As a special exception to the terms and conditions of version 2.0 of the GPL, you may redistribute this Program in connection with Free/Libre and
+ * Open Source Software ("FLOSS") applications as described in Alfresco's FLOSS exception. You should have recieved a copy of the text describing the FLOSS exception, and it is
+ * also available here: http://www.alfresco.com/legal/licensing"
+ */
+
+package org.alfresco.web.action.evaluator;
+
+import org.alfresco.repo.avm.AVMNodeConverter;
+import org.alfresco.web.bean.repository.Node;
+import org.alfresco.web.bean.wcm.AVMUtil;
+import org.alfresco.web.bean.wcm.ManagePermissionsDialog;
+
+/**
+ * UI Action Evaluator - Evaluates whether the change and remove permissions action should be visible.
+ *
+ * @author Sergey Gavrusev
+ */
+public class ManagePermissionIsMainStoreEvaluator extends BaseActionEvaluator
+{
+
+ private static final long serialVersionUID = 4221869509273412546L;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.alfresco.web.action.evaluator.BaseActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
+ */
+ public boolean evaluate(final Node node)
+ {
+ boolean result = false;
+ final String path = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()).getSecond();
+ if (!AVMUtil.isMainStore(AVMUtil.getStoreName(path)))
+ {
+ result = true;
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.alfresco.web.action.evaluator.BaseActionEvaluator#evaluate(java.lang.Object)
+ */
+ @Override
+ public boolean evaluate(final Object obj)
+ {
+ if (obj instanceof ManagePermissionsDialog)
+ {
+ return ((ManagePermissionsDialog) obj).isRendered();
+ }
+ return false;
+ }
+
+}
diff --git a/source/java/org/alfresco/web/action/evaluator/ViewPermissionEvaluator.java b/source/java/org/alfresco/web/action/evaluator/ViewPermissionEvaluator.java
new file mode 100644
index 0000000000..6c28b23c3a
--- /dev/null
+++ b/source/java/org/alfresco/web/action/evaluator/ViewPermissionEvaluator.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2005-2008 Alfresco Software Limited. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA. As a special exception to the terms and conditions of version 2.0 of the GPL, you may redistribute this Program in connection with Free/Libre and
+ * Open Source Software ("FLOSS") applications as described in Alfresco's FLOSS exception. You should have recieved a copy of the text describing the FLOSS exception, and it is
+ * also available here: http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.web.action.evaluator;
+
+import org.alfresco.repo.avm.AVMNodeConverter;
+import org.alfresco.web.bean.repository.Node;
+import org.alfresco.web.bean.wcm.AVMUtil;
+import org.alfresco.web.bean.wcm.ManagePermissionsDialog;
+
+/**
+ * UI Action Evaluator - Evaluates whether the view permissions action should be visible.
+ *
+ * @author Sergey Gavrusev
+ */
+public class ViewPermissionEvaluator extends BaseActionEvaluator
+{
+
+ private static final long serialVersionUID = 1340473144312214960L;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.alfresco.web.action.evaluator.BaseActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
+ */
+ @Override
+ public boolean evaluate(final Node node)
+ {
+ boolean result = true;
+ final String path = AVMNodeConverter.ToAVMVersionPath(node.getNodeRef()).getSecond();
+ if (!AVMUtil.isMainStore(AVMUtil.getStoreName(path)))
+ {
+ result = false;
+ }
+ return result;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.alfresco.web.action.evaluator.BaseActionEvaluator#evaluate(java.lang.Object)
+ */
+ @Override
+ public boolean evaluate(Object obj)
+ {
+ if (obj instanceof ManagePermissionsDialog)
+ {
+ return !((ManagePermissionsDialog) obj).isRendered();
+ }
+ return false;
+ }
+
+}
diff --git a/source/java/org/alfresco/web/bean/wcm/BasePermissionsDialog.java b/source/java/org/alfresco/web/bean/wcm/BasePermissionsDialog.java
new file mode 100644
index 0000000000..f359138a1c
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/wcm/BasePermissionsDialog.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2005-2008 Alfresco Software Limited. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA. As a special exception to the terms and conditions of version 2.0 of the GPL, you may redistribute this Program in connection with Free/Libre and
+ * Open Source Software ("FLOSS") applications as described in Alfresco's FLOSS exception. You should have recieved a copy of the text describing the FLOSS exception, and it is
+ * also available here: http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.web.bean.wcm;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import org.alfresco.service.cmr.security.PermissionService;
+import org.alfresco.web.bean.dialog.BaseDialogBean;
+import org.alfresco.web.bean.repository.Repository;
+
+/**
+ * Base class for Permissions dialogs
+ *
+ * @author Sergei Gavrusev
+ */
+public class BasePermissionsDialog extends BaseDialogBean
+{
+
+ private static final long serialVersionUID = -1027989430514037278L;
+
+ /** PermissionService bean reference */
+ transient protected PermissionService permissionService;
+ private AVMBrowseBean avmBrowseBean;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map)
+ */
+ @Override
+ public void init(Map parameters)
+ {
+
+ super.init(parameters);
+
+ }
+
+ /**
+ * Getter for permissionService
+ *
+ * @return permissionService
+ */
+ protected PermissionService getPermissionService()
+ {
+ if (permissionService == null)
+ {
+ permissionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPermissionService();
+ }
+ return permissionService;
+ }
+
+ /**
+ * @param permissionService permission service
+ */
+ protected void setPermissionService(final PermissionService permissionService)
+ {
+ this.permissionService = permissionService;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
+ */
+ @Override
+ protected String finishImpl(FacesContext context, String outcome) throws Exception
+ {
+ return outcome;
+ }
+
+ /**
+ * Getter for avmBrowseBean
+ *
+ * @return avmBrowseBean
+ */
+ public AVMBrowseBean getAvmBrowseBean()
+ {
+ return avmBrowseBean;
+ }
+
+ /**
+ * @param avmBrowseBean The avmBrowseBean to set.
+ */
+ public void setAvmBrowseBean(final AVMBrowseBean avmBrowseBean)
+ {
+ this.avmBrowseBean = avmBrowseBean;
+ }
+
+}
diff --git a/source/java/org/alfresco/web/bean/wcm/EditPermissionsDialog.java b/source/java/org/alfresco/web/bean/wcm/EditPermissionsDialog.java
new file mode 100644
index 0000000000..9967ef5552
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/wcm/EditPermissionsDialog.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright (C) 2005-2008 Alfresco Software Limited. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA. As a special exception to the terms and conditions of version 2.0 of the GPL, you may redistribute this Program in connection with Free/Libre and
+ * Open Source Software ("FLOSS") applications as described in Alfresco's FLOSS exception. You should have recieved a copy of the text describing the FLOSS exception, and it is
+ * also available here: http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.web.bean.wcm;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.component.UISelectOne;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.model.DataModel;
+import javax.faces.model.ListDataModel;
+import javax.faces.model.SelectItem;
+
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.security.AccessPermission;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.users.UserMembersBean.PermissionWrapper;
+import org.alfresco.web.ui.common.component.UIActionLink;
+
+/**
+ * Class for EditPermissions dialog
+ *
+ * @author Sergei Gavrusev
+ */
+public class EditPermissionsDialog extends UpdatePermissionsDialog
+{
+ private static final long serialVersionUID = 670465612383178325L;
+
+ private static final String MSG_EDIT_PERMS_FOR = "edit_permissions_title";
+
+ private boolean finishButtonDisabled = true;
+
+ private List personPerms = null;
+ private transient DataModel personPermsDataModel = null;
+ private String personAuthority;
+
+ /**
+ * @param event
+ */
+ public void setupAction(ActionEvent event)
+ {
+
+ UIActionLink link = (UIActionLink) event.getComponent();
+ Map params = link.getParameterMap();
+ personAuthority = params.get("userName");
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.alfresco.web.bean.wcm.UpdatePermissionsDialog#init(java.util.Map)
+ */
+ @Override
+ public void init(Map parameters)
+ {
+ super.init(parameters);
+ setActiveNode(getAvmBrowseBean().getAvmActionNode());
+ personPerms = new ArrayList(3);
+ personPermsDataModel = null;
+
+ NodeRef actionNode = getAvmBrowseBean().getAvmActionNode().getNodeRef();
+ NodeRef parentRef = getNodeService().getPrimaryParent(actionNode).getParentRef();
+ Set parentPermission = getPermissionService().getAllSetPermissions(parentRef);
+
+ Set permsForRemove = ManagePermissionsDialog.getPermissionsForType();
+ Set allSetPerms = getPermissionService().getAllSetPermissions(getActiveNode().getNodeRef());
+ for (AccessPermission perm : allSetPerms)
+ {
+ if (!parentPermission.contains(perm))
+ {
+ if (perm.getAuthority().equals(personAuthority) && permsForRemove.contains(perm.getPermission()))
+ {
+ PermissionWrapper wraper = new PermissionWrapper(perm.getPermission(), perm.getPermission());
+ personPerms.add(wraper);
+ }
+ }
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled()
+ */
+ @Override
+ public boolean getFinishButtonDisabled()
+ {
+ return finishButtonDisabled;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.alfresco.web.bean.dialog.BaseDialogBean#getContainerTitle()
+ */
+ @Override
+ public String getContainerTitle()
+ {
+ FacesContext fc = FacesContext.getCurrentInstance();
+ String pattern = Application.getMessage(fc, MSG_EDIT_PERMS_FOR);
+ return MessageFormat.format(pattern, personAuthority);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.alfresco.web.bean.wcm.BasePermissionsDialog#finishImpl(javax.faces.context.FacesContext, java.lang.String)
+ */
+ @Override
+ protected String finishImpl(FacesContext context, String outcome) throws Exception
+ {
+ setPermissions(getActiveNode());
+ createLock(getActiveNode());
+
+ finishButtonDisabled = true;
+
+ return outcome;
+ }
+
+ @Override
+ public String cancel()
+ {
+ finishButtonDisabled = true;
+
+ return super.cancel();
+ }
+
+ /**
+ * Set permissions for current node
+ *
+ * @param node
+ */
+ private void setPermissions(AVMNode node)
+ {
+ NodeRef nodeRef = node.getNodeRef();
+ Set permsForRemove = ManagePermissionsDialog.getPermissionsForType();
+
+ // Set only those permissions that contains in personPerms
+ // Other permissions are removed
+ for (String perm : permsForRemove)
+ {
+ boolean needToSet = false;
+ for (PermissionWrapper wrapper : personPerms)
+ {
+ if (wrapper.getPermission().equals(perm))
+ {
+ needToSet = true;
+ break;
+ }
+ }
+
+ if (needToSet)
+ {
+ getPermissionService().setPermission(nodeRef, personAuthority, perm, true);
+ }
+ else
+ {
+ getPermissionService().deletePermission(nodeRef, personAuthority, perm);
+ }
+ }
+ }
+
+ /**
+ * @return The list of available permissions for the users/groups
+ */
+ public SelectItem[] getPerms()
+ {
+
+ return WCMPermissionsUtils.getPermissions();
+ }
+
+ /**
+ * Action handler called when the Add Permission button is pressed to process the current selection
+ */
+ public void addPermission(ActionEvent event)
+ {
+ UISelectOne permPicker = (UISelectOne) event.getComponent().findComponent("perms");
+
+ String permission = (String) permPicker.getValue();
+ if (permission != null)
+ {
+ boolean foundExisting = false;
+ for (int n = 0; n < personPerms.size(); n++)
+ {
+ PermissionWrapper wrapper = personPerms.get(n);
+ if (wrapper.getPermission().equals(permission))
+ {
+ foundExisting = true;
+ break;
+ }
+ }
+
+ if (!foundExisting)
+ {
+ FacesContext context = FacesContext.getCurrentInstance();
+ PermissionWrapper wrapper = new PermissionWrapper(permission, Application.getMessage(context, permission));
+ this.personPerms.add(wrapper);
+ finishButtonDisabled = false;
+ }
+ }
+
+ }
+
+ /**
+ * Returns the properties for current Person permissions JSF DataModel
+ *
+ * @return JSF DataModel representing the current Person permissions
+ */
+ public DataModel getPersonPermsDataModel()
+ {
+ if (this.personPermsDataModel == null)
+ {
+ this.personPermsDataModel = new ListDataModel();
+ }
+
+ if (this.personPermsDataModel.getWrappedData() == null)
+ {
+ this.personPermsDataModel.setWrappedData(this.personPerms);
+ }
+
+ return this.personPermsDataModel;
+ }
+
+ /**
+ * Action handler called when the Remove button is pressed to remove a permission from current user
+ */
+ public void removePermission(ActionEvent event)
+ {
+ PermissionWrapper wrapper = (PermissionWrapper) getPersonPermsDataModel().getRowData();
+ if (wrapper != null)
+ {
+ this.personPerms.remove(wrapper);
+ finishButtonDisabled = false;
+ }
+ }
+
+}
diff --git a/source/java/org/alfresco/web/bean/wcm/ManagePermissionsDialog.java b/source/java/org/alfresco/web/bean/wcm/ManagePermissionsDialog.java
new file mode 100644
index 0000000000..9cd4cae4bf
--- /dev/null
+++ b/source/java/org/alfresco/web/bean/wcm/ManagePermissionsDialog.java
@@ -0,0 +1,609 @@
+/*
+ * Copyright (C) 2005-2008 Alfresco Software Limited. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be
+ * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA. As a special exception to the terms and conditions of version 2.0 of the GPL, you may redistribute this Program in connection with Free/Libre and
+ * Open Source Software ("FLOSS") applications as described in Alfresco's FLOSS exception. You should have recieved a copy of the text describing the FLOSS exception, and it is
+ * also available here: http://www.alfresco.com/legal/licensing"
+ */
+package org.alfresco.web.bean.wcm;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ValueChangeEvent;
+import javax.transaction.UserTransaction;
+
+import org.alfresco.repo.avm.AVMNodeConverter;
+import org.alfresco.service.cmr.repository.InvalidNodeRefException;
+import org.alfresco.service.cmr.repository.NodeRef;
+import org.alfresco.service.cmr.security.AccessPermission;
+import org.alfresco.service.cmr.security.AccessStatus;
+import org.alfresco.service.cmr.security.AuthorityType;
+import org.alfresco.service.cmr.security.PermissionService;
+import org.alfresco.service.cmr.security.PersonService;
+import org.alfresco.web.app.Application;
+import org.alfresco.web.app.context.IContextListener;
+import org.alfresco.web.bean.dialog.FilterViewSupport;
+import org.alfresco.web.bean.repository.MapNode;
+import org.alfresco.web.bean.repository.QNameNodeMap;
+import org.alfresco.web.bean.repository.Repository;
+import org.alfresco.web.bean.users.UserMembersBean;
+import org.alfresco.web.ui.common.Utils;
+import org.alfresco.web.ui.common.component.UIListItem;
+import org.alfresco.web.ui.common.component.UIModeList;
+import org.alfresco.web.ui.common.component.data.UIRichList;
+import org.alfresco.web.ui.repo.WebResources;
+
+/**
+ * Class for ManagePermissions dialog
+ *
+ * @author Sergei Gavrusev
+ */
+public class ManagePermissionsDialog extends BasePermissionsDialog implements IContextListener, FilterViewSupport
+{
+
+ private static final long serialVersionUID = -6980134441634707541L;
+
+ private static final String MSG_MANAGE_PERMS_FOR = "manage_permissions_title";
+ private static final String MSG_VIEW_PERMS_FOR = "view_permissions_title";
+
+ private static final String LOCAL = "local";
+
+ private static final String INHERITED = "inherited";
+
+ private final static String MSG_CLOSE = "close";
+
+ private String filterMode = INHERITED;
+
+
+ /** PersonService bean reference */
+ transient private PersonService personService;
+
+ private UIRichList usersRichList = null;
+
+ private boolean inheritParenSpacePermissions;
+
+ /**
+ * @param personService The personService to set.
+ */
+ public void setPersonService(final PersonService personService)
+ {
+ this.personService = personService;
+ }
+
+ /**
+ * Getter for personService
+ *
+ * @return personService
+ */
+ protected PersonService getPersonService()
+ {
+ if (personService == null)
+ {
+ personService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getPersonService();
+ }
+ return personService;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.alfresco.web.bean.dialog.BaseDialogBean#init(java.util.Map)
+ */
+ public void init(Map parameters)
+ {
+ super.init(parameters);
+ contextUpdated();
+ inheritParenSpacePermissions = getPermissionService().getInheritParentPermissions(getAvmBrowseBean().getAvmActionNode().getNodeRef());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
+ */
+ protected String finishImpl(FacesContext context, String outcome) throws Exception
+ {
+ return null;
+ }
+
+ /**
+ * @return the list of user nodes for list data binding
+ */
+ public List