Initial version of WCM permissions UI

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@10697 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2008-09-03 15:05:42 +00:00
parent 81ff6bba16
commit 033a5f5602
18 changed files with 2454 additions and 23 deletions

View File

@@ -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

View File

@@ -340,11 +340,16 @@
title-id="edit_permissions_title" description-id="edit_permissions_subtitle" />
<dialog name="managePermissions" page="/jsp/wcm/manage-permissions.jsp"
managed-bean="ManagePermissionsDialog" icon="/images/icons/edituser.gif"
managed-bean="ManagePermissionsDialog" icon="/images/icons/edituser_large.gif"
actions-config-id="set_permission_menu"
show-ok-button="false"
title-id="view_permissions_title" description-id="manage_permissions_subtitle" />
<dialog name="viewPermissions" page="/jsp/wcm/manage-permissions.jsp"
managed-bean="ManagePermissionsDialog" icon="/images/icons/user_large.gif"
show-ok-button="false"
title-id="view_permissions_title" description-id="view_permissions_subtitle" />
<dialog name="editUserDetails" page="/jsp/users/edit-user-details.jsp" managed-bean="EditUserDetailsDialog"
icon="/images/icons/edituser_large.gif" title-id="edit_user_details"
description-id="edit_user_details_description" />

View File

@@ -237,6 +237,44 @@
</params>
</action>
<!-- Manage file/folder permissions -->
<action id="manage_permissions">
<permissions>
<permission allow="true">ChangePermissions</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.ManagePermissionIsMainStoreEvaluator</evaluator>
<label-id>manage_permissions</label-id>
<image>/images/icons/edit_group.gif</image>
<action>dialog:managePermissions</action>
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Set Permission action-->
<action id="set_permissions">
<label-id>set_permissions</label-id>
<evaluator>org.alfresco.web.action.evaluator.ManagePermissionIsMainStoreEvaluator</evaluator>
<image>/images/icons/manage_permissions.gif</image>
<action>dialog:setPermissions</action>
</action>
<!-- View file/folder permissions -->
<action id="view_permissions">
<permissions>
<permission allow="true">Read</permission>
</permissions>
<evaluator>org.alfresco.web.action.evaluator.ViewPermissionEvaluator</evaluator>
<label-id>view_permissions</label-id>
<image>/images/icons/person.gif</image>
<action>dialog:viewPermissions</action>
<action-listener>#{AVMBrowseBean.setupContentAction}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
<!-- Invite Website Users -->
<action id="invite_website_users">
<permissions>
@@ -346,6 +384,8 @@
<action idref="copy_avm_node" />
<action idref="file_details" />
<action idref="unlock_file" />
<action idref="manage_permissions" />
<action idref="view_permissions" />
<action idref="delete_file_browse" />
</action-group>
@@ -357,6 +397,8 @@
<action idref="copy_avm_node" />
<action idref="folder_details" />
<action idref="delete_folder_browse" />
<action idref="manage_permissions" />
<action idref="view_permissions" />
<action idref="delete_layered_folder" />
</action-group>
@@ -414,6 +456,8 @@
<action idref="edit_file" />
<action idref="update_file" />
<action idref="delete_file_browse" />
<action idref="manage_permissions" />
<action idref="view_permissions" />
</action-group>
<!-- Actions for the Folder Details action menu -->
@@ -423,6 +467,8 @@
<action idref="copy_avm_node" />
<action idref="delete_folder_browse" />
<action idref="delete_layered_folder" />
<action idref="manage_permissions" />
<action idref="view_permissions" />
</action-group>
<!-- Actions for the Web Project Details action menu -->
@@ -461,6 +507,11 @@
<action idref="edit_file" />
</action-group>
<!-- Action menu for set permissions in manage permission screen-->
<action-group id="set_permission_menu">
<action idref="set_permissions"/>
</action-group>
</actions>
</config>

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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<String, String> 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;
}
}

View File

@@ -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<PermissionWrapper> personPerms = null;
private transient DataModel personPermsDataModel = null;
private String personAuthority;
/**
* @param event
*/
public void setupAction(ActionEvent event)
{
UIActionLink link = (UIActionLink) event.getComponent();
Map<String, String> 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<String, String> parameters)
{
super.init(parameters);
setActiveNode(getAvmBrowseBean().getAvmActionNode());
personPerms = new ArrayList<PermissionWrapper>(3);
personPermsDataModel = null;
NodeRef actionNode = getAvmBrowseBean().getAvmActionNode().getNodeRef();
NodeRef parentRef = getNodeService().getPrimaryParent(actionNode).getParentRef();
Set<AccessPermission> parentPermission = getPermissionService().getAllSetPermissions(parentRef);
Set<String> permsForRemove = ManagePermissionsDialog.getPermissionsForType();
Set<AccessPermission> 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<String> 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;
}
}
}

View File

@@ -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<String, String> 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<Map> getUsers()
{
boolean includeInherited = true;
if (this.filterMode.equals(LOCAL))
{
includeInherited = false;
}
FacesContext context = FacesContext.getCurrentInstance();
List<Map> personNodes = null;
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(context, true);
tx.begin();
// Return all the permissions set against the current node
// for any authentication instance (user/group).
// Then combine them into a single list for each authentication
// found.
NodeRef actionNode = getAvmBrowseBean().getAvmActionNode().getNodeRef();
// getPermissionService().setInheritParentPermissions(actionNode, inheritParenSpacePermissions);
Map<String, List<String>> permissionMap;
Map<String, List<String>> parentPermissionMap;
Set<AccessPermission> permissions = getPermissionService().getAllSetPermissions(actionNode);
Set<String> permsToDisplay = getPermissionsForType();
permissionMap = getPerson(permissions, permsToDisplay);
NodeRef parentRef = getNodeService().getPrimaryParent(actionNode).getParentRef();
// getPermissionService().getAllSetPermissions(parentRef);
parentPermissionMap = getPerson(getPermissionService().getAllSetPermissions(parentRef), permsToDisplay);
// for each authentication (username/group key) found we get the
// Person
// node represented by it and use that for our list databinding
// object
personNodes = new ArrayList<Map>(permissionMap.size());
List<String> local = new ArrayList<String>();
List<String> inh = new ArrayList<String>();
for (String authority : permissionMap.keySet())
{
local.clear();
inh.clear();
divisionPermissions(authority, permissionMap, parentPermissionMap, inh, local);
// check if we are dealing with a person (User Authority)
if (AuthorityType.getAuthorityType(authority) == AuthorityType.GUEST || getPersonService().personExists(authority))
{
NodeRef nodeRef = getPersonService().getPerson(authority);
if (nodeRef != null)
{
// create our Node representation
MapNode node = new MapNode(nodeRef);
// set data binding properties
// this will also force initialisation of the props now
// during the UserTransaction
// it is much better for performance to do this now
// rather than during page bind
if (includeInherited)
{
addUserPermissions(node, context, inh, personNodes, nodeRef, true);
}
addUserPermissions(node, context, local, personNodes, nodeRef, false);
}
}
else
{
// need a map (dummy node) to represent props for this Group
// Authority
if (includeInherited)
{
addGroupPermissions(authority, context, personNodes, inh, true);
}
addGroupPermissions(authority, context, personNodes, local, false);
}
}
// commit the transaction
tx.commit();
}
catch (InvalidNodeRefException refErr)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, Repository.ERROR_NODEREF), new Object[] { refErr.getNodeRef() }));
personNodes = Collections.<Map> emptyList();
try
{
if (tx != null)
{
tx.rollback();
}
}
catch (Exception tex)
{
}
}
catch (Throwable err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, Repository.ERROR_GENERIC), err.getMessage()), err);
personNodes = Collections.<Map> emptyList();
try
{
if (tx != null)
{
tx.rollback();
}
}
catch (Exception tex)
{
}
}
return personNodes;
}
/**
* Add group permissions
*
* @param authority
* @param context
* @param personNodes
* @param perms
* @param inherited
*/
private void addGroupPermissions(final String authority, FacesContext context, List<Map> personNodes, List<String> perms, final boolean inherited)
{
if (perms == null || perms.size() == 0)
return;
Map<String, Object> node = new HashMap<String, Object>(5, 1.0f);
if (authority.startsWith(PermissionService.GROUP_PREFIX) == true)
{
node.put("fullName", authority.substring(PermissionService.GROUP_PREFIX.length()));
}
else
{
node.put("fullName", authority);
}
node.put("userName", authority);
node.put("id", authority);
node.put("perms", UserMembersBean.roleListToString(context, perms));
node.put("icon", WebResources.IMAGE_GROUP);
node.put("inherited", inherited);
personNodes.add(node);
}
/**
* Add users permissions
*
* @param node
* @param context
* @param perms
* @param personNodes
* @param nodeRef
* @param inherited
*/
private void addUserPermissions(MapNode node, FacesContext context, List<String> perms, List<Map> personNodes, NodeRef nodeRef, boolean inherited)
{
if (perms == null || perms.size() == 0)
return;
Map<String, Object> props = (Map<String, Object>) ((QNameNodeMap) node.getProperties()).clone();
props.put("fullName", ((String) node.get("firstName")) + ' ' + ((String) node.get("lastName")));
props.put("perms", UserMembersBean.roleListToString(context, perms));
props.put("icon", WebResources.IMAGE_PERSON);
props.put("inherited", inherited);
personNodes.add(props);
}
/**
* Separate permissions on inherited and local
*
* @param authority
* @param person
* @param parentPerson
* @param inherited
* @param local
*/
private void divisionPermissions(String authority, Map<String, List<String>> person, Map<String, List<String>> parentPerson, List<String> inherited, List<String> local)
{
List<String> parentPerms = parentPerson.get(authority);
List<String> perms = person.get(authority);
if (parentPerms == null)
{
local.addAll(perms);
return;
}
if (perms.equals(parentPerms))
{
inherited.addAll(perms);
return;
}
for (String perm : perms)
{
if (parentPerms.contains(perm))
{
inherited.add(perm);
}
else
{
local.add(perm);
}
}
}
/**
* @param permissions
* @param permsToDisplay
* @return
*/
private Map<String, List<String>> getPerson(Set<AccessPermission> permissions, Set<String> permsToDisplay)
{
Map<String, List<String>> permissionMap = new HashMap<String, List<String>>(8, 1.0f);
for (AccessPermission permission : permissions)
{
if (permsToDisplay.contains(permission.getPermission()))
{
// we are only interested in Allow and not groups/owner etc.
if (permission.getAccessStatus() == AccessStatus.ALLOWED
&& (permission.getAuthorityType() == AuthorityType.USER || permission.getAuthorityType() == AuthorityType.GROUP
|| permission.getAuthorityType() == AuthorityType.GUEST || permission.getAuthorityType() == AuthorityType.EVERYONE))
{
String authority = permission.getAuthority();
List<String> userPermissions = permissionMap.get(authority);
if (userPermissions == null)
{
// create for first time
userPermissions = new ArrayList<String>(4);
permissionMap.put(authority, userPermissions);
}
// add the permission name for this authority
userPermissions.add(permission.getPermission());
}
}
}
return permissionMap;
}
/**
* Get available permissions
*
* @return Set of permissions
*/
public static Set<String> getPermissionsForType()
{
Set<String> permissions = new LinkedHashSet<String>(3);
permissions.add(PermissionService.READ);
permissions.add(PermissionService.WRITE);
permissions.add(PermissionService.DELETE);
return permissions;
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.app.context.IContextListener#areaChanged()
*/
public void areaChanged()
{
// nothing to do
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.app.context.IContextListener#contextUpdated()
*/
public void contextUpdated()
{
if (this.usersRichList != null)
{
this.usersRichList.setValue(null);
}
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.app.context.IContextListener#spaceChanged()
*/
public void spaceChanged()
{
// nothing to do
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.bean.dialog.FilterViewSupport#filterModeChanged(javax.faces.event.ActionEvent)
*/
public void filterModeChanged(ActionEvent event)
{
UIModeList viewList = (UIModeList) event.getComponent();
// this.filterModeMode = viewList.getValue().toString();
setFilterMode(viewList.getValue().toString());
// force the list to be re-queried when the page is refreshed
if (this.usersRichList != null)
{
this.usersRichList.setValue(null);
}
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.bean.dialog.FilterViewSupport#getFilterItems()
*/
public List<UIListItem> getFilterItems()
{
FacesContext context = FacesContext.getCurrentInstance();
List<UIListItem> items = new ArrayList<UIListItem>(2);
UIListItem item1 = new UIListItem();
item1.setValue(INHERITED);
item1.setLabel(Application.getMessage(context, INHERITED));
items.add(item1);
UIListItem item2 = new UIListItem();
item2.setValue(LOCAL);
item2.setLabel(Application.getMessage(context, LOCAL));
items.add(item2);
return items;
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.bean.dialog.FilterViewSupport#getFilterMode()
*/
public String getFilterMode()
{
return filterMode;
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.bean.dialog.FilterViewSupport#setFilterMode(java.lang.String)
*/
public void setFilterMode(final String filterMode)
{
this.filterMode = filterMode;
// clear datalist cache ready to change results based on filter setting
contextUpdated();
}
/**
* Getter for usersRichList
*
* @return usersRichList
*/
public UIRichList getUsersRichList()
{
return usersRichList;
}
/**
* Setter for usersRichList
*
* @param usersRichList
*/
public void setUsersRichList(final UIRichList usersRichList)
{
this.usersRichList = usersRichList;
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.bean.dialog.BaseDialogBean#restored()
*/
@Override
public void restored()
{
super.restored();
contextUpdated();
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.bean.dialog.BaseDialogBean#getCancelButtonLabel()
*/
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_CLOSE);
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled()
*/
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.bean.dialog.BaseDialogBean#getActionsContext()
*/
@Override
public Object getActionsContext()
{
return this;
}
@Override
public String getContainerTitle()
{
FacesContext fc = FacesContext.getCurrentInstance();
String pattern = Application.getMessage(fc, isRendered() ? MSG_MANAGE_PERMS_FOR : MSG_VIEW_PERMS_FOR);
// avmBrowseBean.getAvmActionNode().getNodePath().toDisplayPath(getNodeService(), getPermissionService());
return MessageFormat.format(pattern, getAvmBrowseBean().getAvmActionNode().getName());
}
/**
* @return true if node in Staging Sandbox
*/
public boolean isRendered()
{
boolean result = false;
final String path = AVMNodeConverter.ToAVMVersionPath(getAvmBrowseBean().getAvmActionNode().getNodeRef()).getSecond();
if (!AVMUtil.isMainStore(AVMUtil.getStoreName(path)))
{
result = true;
}
return result;
}
/**
* Getter for inheritParenSpacePermissions
*
* @return inheritParenSpacePermissions
*/
public boolean isInheritParenSpacePermissions()
{
return inheritParenSpacePermissions;
}
/**
* Setter for inheritParenSpacePermissions Set the global inheritance behaviour for permissions on a node.
*
* @param inheritParenSpacePermissions
*/
public void setInheritParenSpacePermissions(final boolean inheritParenSpacePermissions)
{
this.inheritParenSpacePermissions = inheritParenSpacePermissions;
getPermissionService().setInheritParentPermissions(getAvmBrowseBean().getAvmActionNode().getNodeRef(), inheritParenSpacePermissions);
contextUpdated();
}
public void inheritPermissionsValueChanged(ValueChangeEvent event)
{
boolean inheritPermissions = (Boolean)event.getNewValue();
setInheritParenSpacePermissions(inheritPermissions);
}
}

View File

@@ -0,0 +1,115 @@
/*
* 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.Map;
import java.util.Set;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.alfresco.service.cmr.security.AccessPermission;
import org.alfresco.web.app.Application;
import org.alfresco.web.ui.common.component.UIActionLink;
/**
* Class for RemovePermissions dialog
*
* @author Sergei Gavrusev
*/
public class RemovePermissionsDialog extends UpdatePermissionsDialog
{
private static final long serialVersionUID = 7804466683515156182L;
private static final String MSG_YES = "yes";
private static final String MSG_NO = "no";
private static final String MSG_REMOVE_PERMS_FOR = "remove_permissions_title";
private String personAuthority = null;
@Override
public boolean getFinishButtonDisabled()
{
return false;
}
@Override
public String getFinishButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_YES);
}
@Override
public String getCancelButtonLabel()
{
return Application.getMessage(FacesContext.getCurrentInstance(), MSG_NO);
}
@Override
public String getContainerTitle()
{
FacesContext fc = FacesContext.getCurrentInstance();
String pattern = Application.getMessage(fc, MSG_REMOVE_PERMS_FOR);
return MessageFormat.format(pattern, personAuthority);
}
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
setActiveNode(getAvmBrowseBean().getAvmActionNode());
}
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
removePermissions(getActiveNode());
createLock(getActiveNode());
return outcome;
}
/**
* Remove permission from node
*
* @param node
*/
private void removePermissions(AVMNode node)
{
Set<String> permsForRemove = ManagePermissionsDialog.getPermissionsForType();
Set<AccessPermission> allSetPerms = getPermissionService().getAllSetPermissions(node.getNodeRef());
for (AccessPermission perm : allSetPerms)
{
if (perm.getAuthority().equals(personAuthority) && permsForRemove.contains(perm.getPermission()))
{
getPermissionService().deletePermission(node.getNodeRef(), personAuthority, perm.getPermission());
}
}
}
/**
* @param event
*/
public void setupAction(ActionEvent event)
{
UIActionLink link = (UIActionLink) event.getComponent();
Map<String, String> params = link.getParameterMap();
personAuthority = params.get("userName");
}
}

View File

@@ -0,0 +1,498 @@
/*
* 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.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
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 javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.search.impl.lucene.QueryParser;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.AuthorityService;
import org.alfresco.service.cmr.security.AuthorityType;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.SortableSelectItem;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIGenericPicker;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Class for SetPermissions dialog
*
* @author Sergei Gavrusev
*/
public class SetPermissionsDialog extends UpdatePermissionsDialog
{
private static final long serialVersionUID = -8139619811033232880L;
/** logger */
private static Log logger = LogFactory.getLog(SetPermissionsDialog.class);
private static final String MSG_USERS = "users";
private static final String MSG_GROUPS = "groups";
private static final String MSG_SET_PERMS_FOR = "set_permissions_title";
transient private AuthorityService authorityService;
transient private PersonService personService;
transient private DataModel userPermsDataModel = null;
private List<AVMNodeDescriptor> childList = null;
private List<UserGroupPerm> userGroupPerms = null;
/**
* @param authorityService The authorityService to set.
*/
public void setAuthorityService(final AuthorityService authorityService)
{
this.authorityService = authorityService;
}
/**
* Getter for authorityService
*
* @return authorityService
*/
protected AuthorityService getAuthorityService()
{
if (authorityService == null)
{
authorityService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthorityService();
}
return authorityService;
}
/**
* @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.wcm.UpdatePermissionsDialog#init(java.util.Map)
*/
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
setActiveNode(getAvmBrowseBean().getAvmActionNode());
userGroupPerms = new ArrayList<UserGroupPerm>(8);
userPermsDataModel = null;
childList = new ArrayList<AVMNodeDescriptor>();
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.bean.dialog.BaseDialogBean#getFinishButtonDisabled()
*/
@Override
public boolean getFinishButtonDisabled()
{
if (userGroupPerms.size() == 0)
return true;
else
return false;
}
/*
* (non-Javadoc)
*
* @see org.alfresco.web.bean.dialog.BaseDialogBean#getContainerTitle()
*/
@Override
public String getContainerTitle()
{
FacesContext fc = FacesContext.getCurrentInstance();
String pattern = Application.getMessage(fc, MSG_SET_PERMS_FOR);
return MessageFormat.format(pattern, getActiveNode().getName());
}
/*
* (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
{
// check if any permissions was selected
if (userGroupPerms.size() > 0)
{
childList.add(getActiveNode().getDescriptor());
setPermissions(getActiveNode().getDescriptor());
createLock(getActiveNode());
}
return outcome;
}
/**
* Set permissions for current node
*
* @param node
*/
private void setPermissions(final AVMNodeDescriptor node)
{
for (int i = 0; i < userGroupPerms.size(); i++)
{
UserGroupPerm userGroupPerm = userGroupPerms.get(i);
final String authority = userGroupPerm.getAuthority();
// find the selected permission ref from it's name and apply for the specified user
Set<String> perms = ManagePermissionsDialog.getPermissionsForType();
for (final String permission : perms)
{
if (userGroupPerm.getPermission().equals(permission))
{
getPermissionService().setPermission(AVMNodeConverter.ToNodeRef(-1, node.getPath()), authority, permission, true);
if (logger.isDebugEnabled())
logger.debug("permission setted:" + permission);
break;
}
}
}
}
/**
* Property accessed by the Generic Picker component.
*
* @return The array of filter options to show in the users/groups picker
*/
public SelectItem[] getFilters()
{
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
return new SelectItem[] { new SelectItem("0", bundle.getString(MSG_USERS)), new SelectItem("1", bundle.getString(MSG_GROUPS)) };
}
/**
* Query callback method executed by the Generic Picker component. This method is part of the contract to the Generic Picker, it is up to the backing bean to execute whatever
* query is appropriate and return the results.
*
* @param filterIndex Index of the filter drop-down selection
* @param contains Text from the contains textbox
* @return An array of SelectItem objects containing the results to display in the picker.
*/
public SelectItem[] pickerCallback(int filterIndex, String contains)
{
FacesContext context = FacesContext.getCurrentInstance();
SelectItem[] items;
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(context, true);
tx.begin();
List<SelectItem> results = new ArrayList<SelectItem>();
if (filterIndex == 0)
{
// Use lucene search to retrieve user details
String term = QueryParser.escape(contains.trim());
StringBuilder query = new StringBuilder(128);
query.append("@").append(NamespaceService.CONTENT_MODEL_PREFIX).append("\\:firstName:\"*");
query.append(term);
query.append("*\" @").append(NamespaceService.CONTENT_MODEL_PREFIX).append("\\:lastName:\"*");
query.append(term);
query.append("*\" @").append(NamespaceService.CONTENT_MODEL_PREFIX).append("\\:userName:");
query.append(term);
query.append("*");
ResultSet resultSet = Repository.getServiceRegistry(context).getSearchService().query(Repository.getStoreRef(), SearchService.LANGUAGE_LUCENE, query.toString());
List<NodeRef> nodes = resultSet.getNodeRefs();
for (int index = 0; index < nodes.size(); index++)
{
NodeRef personRef = nodes.get(index);
String firstName = (String) getNodeService().getProperty(personRef, ContentModel.PROP_FIRSTNAME);
String lastName = (String) getNodeService().getProperty(personRef, ContentModel.PROP_LASTNAME);
String username = (String) getNodeService().getProperty(personRef, ContentModel.PROP_USERNAME);
if (username != null)
{
SelectItem item = new SortableSelectItem(username, firstName + " " + lastName + " [" + username + "]", lastName);
results.add(item);
}
}
}
else
{
// groups - simple text based match on name
Set<String> groups = getAuthorityService().getAllAuthorities(AuthorityType.GROUP);
groups.addAll(getAuthorityService().getAllAuthorities(AuthorityType.EVERYONE));
String containsLower = contains.trim().toLowerCase();
int offset = PermissionService.GROUP_PREFIX.length();
for (String group : groups)
{
if (group.toLowerCase().indexOf(containsLower, offset) != -1)
{
results.add(new SortableSelectItem(group, group.substring(offset), group));
}
}
}
items = new SelectItem[results.size()];
results.toArray(items);
Arrays.sort(items);
// commit the transaction
tx.commit();
}
catch (Throwable err)
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
try
{
if (tx != null)
{
tx.rollback();
}
}
catch (Exception tex)
{
}
items = new SelectItem[0];
}
return items;
}
/**
* Action handler called when the Add button is pressed to process the current selection
*/
public void addSelection(ActionEvent event)
{
UIGenericPicker picker = (UIGenericPicker) event.getComponent().findComponent("picker");
UISelectOne permissionPicker = (UISelectOne) event.getComponent().findComponent("permissions");
String[] results = picker.getSelectedResults();
if (results != null)
{
String permission = (String) permissionPicker.getValue();
if (permission != null)
{
for (int i = 0; i < results.length; i++)
{
addAuthorityWithPerm(results[i], permission);
}
}
}
}
/**
* Add an authority with the specified permission to the list .
*
* @param authority Authority to add (cannot be null)
* @param permsission Permission for the authorities (cannot be null)
*/
public void addAuthorityWithPerm(String authority, String permsission)
{
// only add if authority not already present in the list with same role
boolean foundExisting = false;
for (int n = 0; n < userGroupPerms.size(); n++)
{
UserGroupPerm wrapper = userGroupPerms.get(n);
if (authority.equals(wrapper.getAuthority()) && (permsission.equals(wrapper.getPermission())))
{
foundExisting = true;
break;
}
}
if (foundExisting == false)
{
StringBuilder label = new StringBuilder(64);
// build a display label showing the user and their role for the space
AuthorityType authType = AuthorityType.getAuthorityType(authority);
if (authType == AuthorityType.GUEST || authType == AuthorityType.USER)
{
if (authType == AuthorityType.GUEST || getPersonService().personExists(authority) == true)
{
// found a User authority
label.append(buildLabelForUserAuthorityPerm(authority, permsission));
}
}
else
{
// found a group authority
label.append(buildLabelForGroupAuthorityPerm(authority, permsission));
}
userGroupPerms.add(new UserGroupPerm(authority, permsission, label.toString()));
}
}
/**
* Action handler called when the Remove button is pressed to remove a user+permission
*/
public void removeSelection(ActionEvent event)
{
UserGroupPerm wrapper = (UserGroupPerm) getUserPermsDataModel().getRowData();
if (wrapper != null)
{
userGroupPerms.remove(wrapper);
}
}
/**
* Returns the properties for current user-roles JSF DataModel
*
* @return JSF DataModel representing the current user-permission
*/
public DataModel getUserPermsDataModel()
{
if (userPermsDataModel == null)
{
userPermsDataModel = new ListDataModel();
}
// only set the wrapped data once otherwise the rowindex is reset
if (userPermsDataModel.getWrappedData() == null)
{
userPermsDataModel.setWrappedData(userGroupPerms);
}
return userPermsDataModel;
}
/**
* Helper to build a label of the form: Firstname Lastname (permission)
*/
public String buildLabelForUserAuthorityPerm(String authority, String role)
{
// found a User authority
NodeRef ref = getPersonService().getPerson(authority);
String firstName = (String) getNodeService().getProperty(ref, ContentModel.PROP_FIRSTNAME);
String lastName = (String) getNodeService().getProperty(ref, ContentModel.PROP_LASTNAME);
StringBuilder buf = new StringBuilder(100);
buf.append(firstName).append(" ").append(lastName != null ? lastName : "").append(" (").append(Application.getMessage(FacesContext.getCurrentInstance(), role)).append(")");
return buf.toString();
}
/**
* Helper to build a label for a Group authority of the form: Groupname (permission)
*/
public String buildLabelForGroupAuthorityPerm(String authority, String role)
{
StringBuilder buf = new StringBuilder(100);
buf.append(authority.substring(PermissionService.GROUP_PREFIX.length())).append(" (").append(Application.getMessage(FacesContext.getCurrentInstance(), role)).append(")");
return buf.toString();
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
in.defaultReadObject();
userPermsDataModel = new ListDataModel();
userPermsDataModel.setWrappedData(userGroupPerms);
}
/**
* @return The list of available permissions for the users/groups
*/
public SelectItem[] getPermissions()
{
return WCMPermissionsUtils.getPermissions();
}
/**
* Simple wrapper class to represent a user/group and a permission combination
*/
public static class UserGroupPerm implements Serializable
{
private static final long serialVersionUID = -1546705703700113861L;
public UserGroupPerm(String authority, String permission, String label)
{
this.authority = authority;
this.permission = permission;
this.label = label;
}
public String getAuthority()
{
return authority;
}
public String getPermission()
{
return permission;
}
public String getLabel()
{
return label;
}
private String authority;
private String permission;
private String label;
}
}

View File

@@ -0,0 +1,120 @@
/*
* 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.ArrayList;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.avm.locking.AVMLock;
import org.alfresco.service.cmr.avm.locking.AVMLockingService;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.web.bean.repository.Repository;
/**
* Base class for Remove,Set,Edit Permissions dialogs
*
* @author Sergei Gavrusev
*/
public class UpdatePermissionsDialog extends BasePermissionsDialog
{
private static final long serialVersionUID = 7189321059584956816L;
transient private AVMLockingService avmLockingService;
transient private AuthenticationService authenticationService;
private AVMNode activeNode;
@Override
public void init(Map<String, String> parameters)
{
super.init(parameters);
}
/**
* @param avmLockingService The AVMLockingService to set.
*/
public void setAvmLockingService(final AVMLockingService avmLockingService)
{
this.avmLockingService = avmLockingService;
}
protected AVMLockingService getAvmLockingService()
{
if (avmLockingService == null)
{
avmLockingService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAVMLockingService();
}
return avmLockingService;
}
/**
* @param authenticationService The AuthenticationService to set.
*/
protected void setAuthenticationService(final AuthenticationService authenticationService)
{
this.authenticationService = authenticationService;
}
protected AuthenticationService getAuthenticationService()
{
if (authenticationService == null)
{
authenticationService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getAuthenticationService();
}
return authenticationService;
}
/**
* Create lock for node if it is necessary. Also create lock for children, if they inherit parent permissions.
*
* @param node
*/
protected void createLock(AVMNode node)
{
if (getAvmLockingService().getLock(node.getWebProject().getStoreId(), node.getPath().substring(node.getPath().indexOf("/"))) == null && !node.isDirectory())
{
String userName = getAuthenticationService().getCurrentUserName();
List<String> owners = new ArrayList<String>(1);
owners.add(userName);
String webProject = node.getWebProject().getStoreId();
String[] storePath = node.getPath().split(":");
AVMLock lock = new AVMLock(webProject, storePath[0], storePath[1], AVMLockingService.Type.DISCRETIONARY, owners);
getAvmLockingService().lockPath(lock);
}
}
/**
* Getter for active node property
*
* @return activeNode
*/
public AVMNode getActiveNode()
{
return activeNode;
}
/**
* Setter for active node property
*
* @param activeNode
*/
public void setActiveNode(final AVMNode activeNode)
{
this.activeNode = activeNode;
}
}

View File

@@ -0,0 +1,41 @@
/*
* 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.ResourceBundle;
import java.util.Set;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.web.app.Application;
public class WCMPermissionsUtils
{
/**
* @return The list of available permissions for the users/groups
*/
public static SelectItem[] getPermissions()
{
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
Set<String> perms = ManagePermissionsDialog.getPermissionsForType();
SelectItem[] permissions = new SelectItem[perms.size()];
int index = 0;
for (String permission : perms)
{
String displayLabel = bundle.getString(permission);
permissions[index++] = new SelectItem(permission, displayLabel);
}
return permissions;
}
}

View File

@@ -43,6 +43,26 @@
<value>#{DocumentDetailsDialog.translationDocument}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean for the Manage Permissions.
</description>
<managed-bean-name>ManagePermissionsDialog</managed-bean-name>
<managed-bean-class>
org.alfresco.web.bean.wcm.ManagePermissionsDialog
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>personService</property-name>
<value>#{PersonService}</value>
</managed-property>
<managed-property>
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>
@@ -5828,4 +5848,76 @@
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean that backs up the view of the Set Permissions
</description>
<managed-bean-name>SetPermissionsDialog</managed-bean-name>
<managed-bean-class>
org.alfresco.web.bean.wcm.SetPermissionsDialog
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>authorityService</property-name>
<value>#{AuthorityService}</value>
</managed-property>
<managed-property>
<property-name>personService</property-name>
<value>#{PersonService}</value>
</managed-property>
<managed-property>
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean that backs up the view of the Remove Permissions
</description>
<managed-bean-name>RemovePermissionsDialog</managed-bean-name>
<managed-bean-class>
org.alfresco.web.bean.wcm.RemovePermissionsDialog
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
<managed-property>
<property-name>avmLockingService</property-name>
<value>#{AVMLockingService}</value>
</managed-property>
</managed-bean>
<managed-bean>
<description>
The bean that backs up the view of the Edit Permissions
</description>
<managed-bean-name>EditPermissionsDialog</managed-bean-name>
<managed-bean-class>
org.alfresco.web.bean.wcm.EditPermissionsDialog
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>avmBrowseBean</property-name>
<value>#{AVMBrowseBean}</value>
</managed-property>
<managed-property>
<property-name>avmLockingService</property-name>
<value>#{AVMLockingService}</value>
</managed-property>
</managed-bean>
</faces-config>

Binary file not shown.

After

Width:  |  Height:  |  Size: 994 B

View File

@@ -0,0 +1,124 @@
<%--
* 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"
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
<f:verbatim>
<script type="text/javascript">
window.onload = pageLoaded;
function pageLoaded()
{
document.getElementById("dialog:finish-button").onclick = showProgress;
}
function showProgress()
{
document.getElementById('progress').style.display = 'block';
}
</script>
<div id="progress" style="margin-left: 90px; margin-top: 4px; margin-bottom: 4px; display: none">
<img src="<%=request.getContextPath()%>/images/icons/process_animation.gif" width=174 height=14>
</div>
<%-- Details --%>
<table cellpadding="2" cellspacing="2" border="0" width="100%">
<tr>
<td class="mainSubTitle"></f:verbatim><h:outputText value="#{msg.change_user_perms}" /><f:verbatim></td>
</tr>
<tr><td class="paddingRow"></td></tr>
<tr>
<td>1.&nbsp;</f:verbatim><h:outputText value="#{msg.select_perm}" /><f:verbatim></td>
</tr>
<tr>
<td>
</f:verbatim>
<h:selectOneListbox id="perms" style="width:250px" size="5">
<f:selectItems value="#{DialogManager.bean.perms}" />
</h:selectOneListbox>
<f:verbatim>
</td>
</tr>
<tr>
<td>
2.&nbsp;</f:verbatim><h:commandButton value="#{msg.add_to_list_button}" actionListener="#{DialogManager.bean.addPermission}" /><f:verbatim>
</td>
</tr>
<tr><td class="paddingRow"></td></tr>
<tr>
<td></f:verbatim><h:outputText value="#{msg.selected_perm}" /><f:verbatim></td>
</tr>
<tr>
<td>
</f:verbatim>
<h:dataTable value="#{DialogManager.bean.personPermsDataModel}" var="row"
rowClasses="selectedItemsRow,selectedItemsRowAlt"
styleClass="selectedItems" headerClass="selectedItemsHeader"
cellspacing="0" cellpadding="4"
rendered="#{DialogManager.bean.personPermsDataModel.rowCount != 0}">
<h:column>
<f:facet name="header">
<h:outputText value="#{msg.name}" />
</f:facet>
<h:outputText value="#{row.role}" />
</h:column>
<h:column>
<a:actionLink actionListener="#{DialogManager.bean.removePermission}" image="/images/icons/delete.gif"
value="#{msg.remove}" showLink="false" style="padding-left:6px" />
</h:column>
</h:dataTable>
<a:panel id="no-items" rendered="#{DialogManager.bean.personPermsDataModel.rowCount == 0}">
<f:verbatim>
<table cellspacing='0' cellpadding='2' border='0' class='selectedItems'>
<tr>
<td colspan='2' class='selectedItemsHeader'></f:verbatim><h:outputText id="no-items-name" value="#{msg.name}" /><f:verbatim></td>
</tr>
<tr>
<td class='selectedItemsRow'></f:verbatim><h:outputText id="no-items-msg" value="#{msg.no_selected_items}" /><f:verbatim></td>
</tr>
</table>
</f:verbatim>
</a:panel>
<f:verbatim>
</td>
</tr>
<tr><td colspan=2 class="paddingRow"></td></tr>
</f:verbatim>
<f:verbatim>
</table>
</f:verbatim>

View File

@@ -0,0 +1,138 @@
<%--
* 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"
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a"%>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r"%>
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ page import="org.alfresco.web.ui.common.PanelGenerator"%>
<%-- load a bundle of properties with I18N strings --%>
<f:loadBundle basename="alfresco.messages.webclient" var="msg" />
<a:panel id="users-panel" border="white" bgcolor="white"
titleBorder="lbgrey" expandedTitleBorder="dotted" titleBgcolor="white"
styleClass="mainSubTitle" label="#{msg.permissions}">
<a:richList id="users-list"
binding="#{DialogManager.bean.usersRichList}" viewMode="details"
pageSize="10" styleClass="recordSet"
headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow"
altRowStyleClass="recordSetRowAlt" width="100%"
value="#{DialogManager.bean.users}" var="r"
initialSortColumn="userName" initialSortDescending="true">
<%-- Primary column with full name --%>
<a:column primary="true" width="200"
style="padding:2px;text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.name}" value="fullName"
mode="case-insensitive" styleClass="header" />
</f:facet>
<f:facet name="small-icon">
<h:graphicImage url="#{r.icon}" />
</f:facet>
<h:outputText value="#{r.fullName}" />
</a:column>
<%-- Username column --%>
<a:column width="120" style="text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.authority}" value="userName"
styleClass="header" />
</f:facet>
<h:outputText value="#{r.userName}" />
</a:column>
<%-- Created Date column for details view mode --%>
<%-- Column to show whether the rule is local --%>
<a:column style="text-align:left" id="column3">
<f:facet name="header">
<a:sortLink id="sortLink2" label="#{msg.inherited}" value="local" styleClass="header" />
</f:facet>
<h:outputText value="#{r.inherited}">
<a:convertBoolean />
</h:outputText>
</a:column>
<%-- Permission column --%>
<a:column style="text-align:left">
<f:facet name="header">
<a:sortLink label="#{msg.permissions}" value="perms"
styleClass="header" />
</f:facet>
<h:outputText value="#{r.perms}" />
</a:column>
<%-- Actions column --%>
<a:column actions="true" style="text-align:left">
<f:facet name="header">
<h:outputText value="#{msg.actions}" />
</f:facet>
<a:booleanEvaluator value="#{!r.inherited}">
<a:actionLink value="#{msg.change_permissions}"
rendered="#{DialogManager.bean.rendered}"
image="/images/icons/edituser.gif" showLink="false"
action="dialog:editPermissions"
actionListener="#{EditPermissionsDialog.setupAction}">
<f:param name="userName" value="#{r.userName}" />
</a:actionLink>
<a:actionLink value="#{msg.remove}"
rendered="#{DialogManager.bean.rendered}"
image="/images/icons/delete_person.gif" showLink="false"
action="dialog:removePermissions"
actionListener="#{RemovePermissionsDialog.setupAction}">
<f:param name="userName" value="#{r.userName}" />
</a:actionLink>
</a:booleanEvaluator>
</a:column>
<a:dataPager styleClass="pager" />
</a:richList>
</a:panel>
<f:verbatim>
<table cellspacing="2" cellpadding="0" border="0" width="100%">
<tr>
<td>
</f:verbatim>
<h:selectBooleanCheckbox id="inherit-parent-box"
onclick="document.forms['dialog'].submit(); return true;"
valueChangeListener="#{DialogManager.bean.inheritPermissionsValueChanged}"
value="#{DialogManager.bean.inheritParenSpacePermissions}"/>
<f:verbatim>
</td>
<td width=100%>
&nbsp;</f:verbatim><h:outputText id="apply-rec-msg" value="Inherit parent space permissions"/><f:verbatim>
</td>
</tr>
</table>
</f:verbatim>

View File

@@ -0,0 +1,55 @@
<%--
* 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"
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<f:verbatim>
<script type="text/javascript">
window.onload = pageLoaded;
function pageLoaded()
{
document.getElementById("dialog:finish-button").onclick = showProgress;
}
function showProgress()
{
document.getElementById('progress').style.display = 'block';
}
</script>
<div id="progress" style="margin-left: 90px; margin-top: 4px; margin-bottom: 4px; display: none">
<img src="<%=request.getContextPath()%>/images/icons/process_animation.gif" width=174 height=14>
</div>
</f:verbatim>
<h:panelGrid id="remove-msg" columns="1" cellpadding="2" style="padding-top:2px; padding-bottom:2px;" width="100%">
<h:outputText value="#{msg.remove_permissions}"/>
</h:panelGrid>

View File

@@ -0,0 +1,92 @@
<%--
* 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"
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<f:verbatim>
<script type="text/javascript">
window.onload = pageLoaded;
function pageLoaded()
{
document.getElementById("dialog:finish-button").onclick = showProgress;
}
function showProgress()
{
document.getElementById('progress').style.display = 'block';
}
</script>
<div id="progress" style="margin-left: 90px; margin-top: 4px; margin-bottom: 4px; display: none">
<img src="<%=request.getContextPath()%>/images/icons/process_animation.gif" width=174 height=14>
</div>
</f:verbatim>
<h:panelGrid id="perm" columns="1" cellpadding="2" style="padding-top:2px; padding-bottom:2px;" width="100%">
<h:outputText styleClass="mainSubText" value="#{msg.specify_usersgroups}" />
<h:outputText styleClass="mainSubText" value="1. #{msg.select_usersgroups_perms}" />
<a:genericPicker id="picker" showAddButton="false" filters="#{DialogManager.bean.filters}" queryCallback="#{DialogManager.bean.pickerCallback}" />
<h:outputText value="#{msg.permission}" />
<h:selectOneListbox id="permissions" style="width:250px" size="5">
<f:selectItems value="#{DialogManager.bean.permissions}" />
</h:selectOneListbox>
<h:panelGroup styleClass="mainSubText">
<h:outputText value="2." /> <h:commandButton value="#{msg.add_to_list_button}" actionListener="#{DialogManager.bean.addSelection}" styleClass="wizardButton" />
</h:panelGroup>
<h:outputText styleClass="mainSubText" value="#{msg.selected_usersgroups_perms}" />
<h:panelGroup>
<h:dataTable value="#{DialogManager.bean.userPermsDataModel}" var="row"
rowClasses="selectedItemsRow,selectedItemsRowAlt"
styleClass="selectedItems" headerClass="selectedItemsHeader"
cellspacing="0" cellpadding="4"
rendered="#{DialogManager.bean.userPermsDataModel.rowCount != 0}">
<h:column>
<f:facet name="header">
<h:outputText value="#{msg.name}" />
</f:facet>
<h:outputText value="#{row.label}" />
</h:column>
<h:column>
<a:actionLink actionListener="#{DialogManager.bean.removeSelection}" image="/images/icons/delete.gif"
value="#{msg.remove}" showLink="false" style="padding-left:6px" />
</h:column>
</h:dataTable>
<a:panel id="no-items" rendered="#{DialogManager.bean.userPermsDataModel.rowCount == 0}">
<h:panelGrid columns="1" cellpadding="2" styleClass="selectedItems" rowClasses="selectedItemsHeader,selectedItemsRow">
<h:outputText id="no-items-name" value="#{msg.name}" />
<h:outputText styleClass="selectedItemsRow" id="no-items-msg" value="#{msg.no_selected_items}" />
</h:panelGrid>
</a:panel>
</h:panelGroup>
</h:panelGrid>