. Inviting a Group into a website now creates sandboxes for all user authorities contained within the group

- http://issues.alfresco.com/browse/WCM-76
. AVM file Version History list UI fixes and improvements
. Fix to navigation (back and forward links) in AVM file/folder details page
. More WCM UI enhancements from the usability review list

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4761 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-01-09 12:22:38 +00:00
parent 844e8b2e70
commit 0d43590417
7 changed files with 101 additions and 56 deletions

View File

@@ -186,7 +186,7 @@ public abstract class AVMDetailsBean
// reset - it does not know when the item has changed etc.
for (int i=0; i<nodes.size(); i++)
{
if (path.equals(nodes.get(i).get("path")) == true)
if (path.equals(nodes.get(i).get("id")) == true)
{
AVMNode next;
// found our item - navigate to next
@@ -225,7 +225,7 @@ public abstract class AVMDetailsBean
// see above
for (int i=0; i<nodes.size(); i++)
{
if (path.equals(nodes.get(i).get("path")) == true)
if (path.equals(nodes.get(i).get("id")) == true)
{
AVMNode previous;
// found our item - navigate to previous

View File

@@ -153,7 +153,8 @@ public class FileDetailsBean extends AVMDetailsBean
List<Map<String, Object>> wrappers = new ArrayList<Map<String, Object>>(history.size());
for (AVMNodeDescriptor record : history)
{
Map<String, Object> wrapper = new HashMap<String, Object>(4, 1.0f);
Map<String, Object> wrapper = new HashMap<String, Object>(8, 1.0f);
wrapper.put("version", record.getVersionID());
wrapper.put("strVersion", Integer.toString(record.getVersionID()));
wrapper.put("modifiedDate", new Date(record.getModDate()));
@@ -165,6 +166,8 @@ public class FileDetailsBean extends AVMDetailsBean
wrapper.put("url", DownloadContentServlet.generateBrowserURL(
AVMNodeConverter.ToNodeRef(path.getFirst(), path.getSecond()), avmNode.getName()));
}
wrapper.put("fileType16", Utils.getFileTypeImage(avmNode.getName(), true));
wrappers.add(wrapper);
}
return wrappers;

View File

@@ -18,6 +18,7 @@ package org.alfresco.web.bean.wcm;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@@ -28,9 +29,9 @@ import java.util.Set;
import javax.faces.context.FacesContext;
import org.alfresco.model.WCMAppModel;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.AuthorityType;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.Application;
@@ -104,18 +105,22 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
// invited users and the power user who is executing the create web project wizard
boolean foundCurrentUser = false;
String currentUser = Application.getCurrentUser(context).getUserName();
for (UserGroupRole userRole : this.userGroupRoles)
{
String authority = userRole.getAuthority();
if (currentUser.equals(authority))
for (String userAuth : findNestedUserAuthorities(userRole.getAuthority()))
{
foundCurrentUser = true;
}
if (SandboxFactory.ROLE_CONTENT_MANAGER.equals(userRole.getRole()))
{
this.managers.add(authority);
if (currentUser.equals(userAuth))
{
foundCurrentUser = true;
}
if (SandboxFactory.ROLE_CONTENT_MANAGER.equals(userRole.getRole()))
{
this.managers.add(userAuth);
}
}
}
if (foundCurrentUser == false)
{
this.userGroupRoles.add(new UserGroupRole(currentUser, SandboxFactory.ROLE_CONTENT_MANAGER, null));
@@ -128,11 +133,15 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
// so retrieve the list of managers from the existing users and the selected invitees
for (UserGroupRole userRole : this.userGroupRoles)
{
if (SandboxFactory.ROLE_CONTENT_MANAGER.equals(userRole.getRole()))
for (String userAuth : findNestedUserAuthorities(userRole.getAuthority()))
{
this.managers.add(userRole.getAuthority());
if (SandboxFactory.ROLE_CONTENT_MANAGER.equals(userRole.getRole()))
{
this.managers.add(userAuth);
}
}
}
List<ChildAssociationRef> userInfoRefs = this.nodeService.getChildAssocs(
getNode().getNodeRef(), WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef ref : userInfoRefs)
@@ -140,68 +149,99 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
NodeRef userInfoRef = ref.getChildRef();
String username = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
String userrole = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
if (SandboxFactory.ROLE_CONTENT_MANAGER.equals(userrole) &&
this.managers.contains(username) == false)
{
this.managers.add(username);
}
// add each existing user to the exclude this - we cannot add them more than once!
excludeUsers.add(username);
}
}
// build the sandboxes now we have the manager list and complete user list
// and create an association to a node to represent each invited user
List<SandboxInfo> sandboxInfoList = new LinkedList<SandboxInfo>();
for (UserGroupRole userRole : this.userGroupRoles)
{
String authority = userRole.getAuthority();
if (excludeUsers.contains(authority) == false)
for (String userAuth : findNestedUserAuthorities(userRole.getAuthority()))
{
SandboxInfo info =
SandboxFactory.createUserSandbox(
getAvmStore(), this.managers, userRole.getAuthority(), userRole.getRole());
sandboxInfoList.add( info );
}
}
// save the list of invited users against the store
for (UserGroupRole userRole : this.userGroupRoles)
{
String authority = userRole.getAuthority();
if (excludeUsers.contains(authority) == false)
{
// create an app:webuser instance for each authority and assoc to the website node
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(WCMAppModel.PROP_WEBUSERNAME, authority);
props.put(WCMAppModel.PROP_WEBUSERROLE, userRole.getRole());
this.nodeService.createNode(getNode().getNodeRef(),
WCMAppModel.ASSOC_WEBUSER,
WCMAppModel.ASSOC_WEBUSER,
WCMAppModel.TYPE_WEBUSER,
props);
if (excludeUsers.contains(userAuth) == false)
{
SandboxInfo info = SandboxFactory.createUserSandbox(
getAvmStore(), this.managers, userAuth, userRole.getRole());
sandboxInfoList.add(info);
// create an app:webuser instance for each authority and assoc to the website node
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(WCMAppModel.PROP_WEBUSERNAME, userAuth);
props.put(WCMAppModel.PROP_WEBUSERROLE, userRole.getRole());
this.nodeService.createNode(getNode().getNodeRef(),
WCMAppModel.ASSOC_WEBUSER,
WCMAppModel.ASSOC_WEBUSER,
WCMAppModel.TYPE_WEBUSER,
props);
}
}
}
// reload virtualisation server for webapp in this web project
if (isStandalone())
{
for (SandboxInfo sandboxInfo : sandboxInfoList )
for (SandboxInfo sandboxInfo : sandboxInfoList)
{
String newlyInvitedStoreName =
AVMConstants.buildStagingStoreName( sandboxInfo.getMainStoreName() );
String path =
AVMConstants.buildStoreWebappPath( newlyInvitedStoreName,
this.avmBrowseBean.getWebapp());
String newlyInvitedStoreName = AVMConstants.buildStagingStoreName(sandboxInfo.getMainStoreName());
String path = AVMConstants.buildStoreWebappPath(newlyInvitedStoreName, this.avmBrowseBean.getWebapp());
AVMConstants.updateVServerWebapp(path, true);
}
}
return outcome;
}
/**
* Find all nested user authorities contained with an authority
*
* @param authority The authority to search, USER authorities are returned immediately, GROUP authorites
* are recursively scanned for contained USER authorities.
*
* @return a Set of USER authorities
*/
private Set<String> findNestedUserAuthorities(String authority)
{
Set<String> users;
AuthorityType authType = AuthorityType.getAuthorityType(authority);
if (authType.equals(AuthorityType.USER))
{
users = new HashSet<String>(1, 1.0f);
if (this.personService.personExists(authority) == true)
{
users.add(authority);
}
}
else if (authType.equals(AuthorityType.GROUP))
{
// walk each member of the group
users = this.authorityService.getContainedAuthorities(AuthorityType.USER, authority, false);
for (String userAuth : users)
{
if (this.personService.personExists(userAuth) == false)
{
users.remove(authType);
}
}
}
else
{
users = Collections.<String>emptySet();
}
return users;
}
/**
* @return summary text for the wizard

View File

@@ -66,7 +66,7 @@ public class UISandboxSnapshots extends SelfRenderingComponent
private static final String COMPONENT_ACTIONS = "org.alfresco.faces.Actions";
private static final String MSG_LABEL = "label";
private static final String MSG_LABEL = "name";
private static final String MSG_DESCRIPTION = "description";
private static final String MSG_DATE = "date";
private static final String MSG_USERNAME = "username";
@@ -204,8 +204,10 @@ public class UISandboxSnapshots extends SelfRenderingComponent
versions = avmService.getStoreVersions(sandbox, fromDate, toDate);
}
Map requestMap = context.getExternalContext().getRequestMap();
for (VersionDescriptor item : versions)
for (int i=versions.size() - 1; i >= 0; i--) // reverse order
{
VersionDescriptor item = versions.get(i);
// only display snapshots with a valid tag - others are system generated snapshots
if (item.getTag() != null && item.getVersionID() != 0)
{