mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. 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:
@@ -986,8 +986,8 @@ delete_sandbox=Delete Sandbox
|
||||
delete_sandbox_info=To remove this sandbox and the user from the Web Project, click OK.
|
||||
delete_sandbox_confirm=Are you sure you want to remove the user sandbox \"{0}\" from the Web Project?
|
||||
submit_submission_info=Submission Info
|
||||
submit_comment=Comment
|
||||
submit_snapshotlabel=Snapshot Label
|
||||
submit_comment=Name
|
||||
submit_snapshotlabel=Description
|
||||
submit_workflow_selection=Use the following workflow to submit all modified items
|
||||
submit_not_submit_warning=The following items cannot be submitted as they are already part of a workflow.
|
||||
submit_no_workflow_warning=No suitable workflows could be found for the modified items below
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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()))
|
||||
{
|
||||
if (currentUser.equals(userAuth))
|
||||
{
|
||||
foundCurrentUser = true;
|
||||
}
|
||||
if (SandboxFactory.ROLE_CONTENT_MANAGER.equals(userRole.getRole()))
|
||||
{
|
||||
this.managers.add(authority);
|
||||
this.managers.add(userAuth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundCurrentUser == false)
|
||||
{
|
||||
this.userGroupRoles.add(new UserGroupRole(currentUser, SandboxFactory.ROLE_CONTENT_MANAGER, null));
|
||||
@@ -127,12 +132,16 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
|
||||
// website already exists - we are only adding to the existing sandboxes
|
||||
// so retrieve the list of managers from the existing users and the selected invitees
|
||||
for (UserGroupRole userRole : this.userGroupRoles)
|
||||
{
|
||||
for (String userAuth : findNestedUserAuthorities(userRole.getAuthority()))
|
||||
{
|
||||
if (SandboxFactory.ROLE_CONTENT_MANAGER.equals(userRole.getRole()))
|
||||
{
|
||||
this.managers.add(userRole.getAuthority());
|
||||
this.managers.add(userAuth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<ChildAssociationRef> userInfoRefs = this.nodeService.getChildAssocs(
|
||||
getNode().getNodeRef(), WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : userInfoRefs)
|
||||
@@ -140,41 +149,35 @@ 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());
|
||||
if (excludeUsers.contains(userAuth) == false)
|
||||
{
|
||||
SandboxInfo info = SandboxFactory.createUserSandbox(
|
||||
getAvmStore(), this.managers, userAuth, 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_WEBUSERNAME, userAuth);
|
||||
props.put(WCMAppModel.PROP_WEBUSERROLE, userRole.getRole());
|
||||
this.nodeService.createNode(getNode().getNodeRef(),
|
||||
WCMAppModel.ASSOC_WEBUSER,
|
||||
@@ -183,19 +186,15 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
|
||||
props);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// reload virtualisation server for webapp in this web project
|
||||
if (isStandalone())
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -203,6 +202,47 @@ public class InviteWebsiteUsersWizard extends InviteUsersWizard
|
||||
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
|
||||
*/
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -203,8 +203,8 @@
|
||||
<f:facet name="header">
|
||||
<h:outputText value="#{msg.actions}"/>
|
||||
</f:facet>
|
||||
<a:actionLink id="view-link" value="#{msg.view}" href="#{r.url}" target="new" />
|
||||
<a:actionLink id="revert-link" value="#{msg.revert}" style="padding-left:4px" actionListener="#{FileDetailsBean.revertNode}">
|
||||
<a:actionLink id="view-link" value="#{msg.view}" href="#{r.url}" target="new" image="#{r.fileType16}" style="padding-right:8px" />
|
||||
<a:actionLink id="revert-link" value="#{msg.revert}" actionListener="#{FileDetailsBean.revertNode}" action="dialog:close" image="/images/icons/revert.gif">
|
||||
<f:param name="version" value="#{r.strVersion}" />
|
||||
</a:actionLink>
|
||||
</a:column>
|
||||
|
@@ -60,10 +60,10 @@
|
||||
</h:panelGrid>
|
||||
|
||||
<h:panelGrid columns="2" cellpadding="2" cellpadding="2" width="100%" style="margin-left:8px">
|
||||
<h:outputText value="#{msg.submit_comment}"/>
|
||||
<h:outputText value="#{msg.submit_comment}:"/>
|
||||
<h:inputText id="comment" value="#{DialogManager.bean.comment}" maxlength="1024" size="35"
|
||||
onkeyup="javascript:checkButtonState();" />
|
||||
<h:outputText value="#{msg.submit_snapshotlabel}"/>
|
||||
<h:outputText value="#{msg.submit_snapshotlabel}:"/>
|
||||
<h:inputText id="label" value="#{DialogManager.bean.label}" maxlength="1024" size="35"
|
||||
onkeyup="javascript:checkButtonState();" />
|
||||
</h:panelGrid>
|
||||
|
Reference in New Issue
Block a user