Merged V2.2 to HEAD

8049: Fix for WCM-1033: Only admin users can create web projects
   8051: Merged V2.1 to V2.2
      8006: Merged V2.1-A to V2.1 (Virtual Server fixes)
         7723: The JMX server connector is now lazily instantiated in the server context.
         7734: Fix for WCM-934.
         7735: The linkvalidation service now provides a public API
         7742: Possible fix for ACT #361
      8012: Merged V2.1-A to V2.1
         7749: Fix stack overflow
         7955: Fix for issue ADB-18 Forward slash '/' in username causes Advanced Search failure
         7975: AR-1832: Allow setting of timeout value in the Java webservices client
         7995: Include the alf_child_assoc.type_qname in the check for duplicate children.
   8052: Build fix
   8054: Merged V2.1 to V2.2
      8045: Patch fix to solve WCM-1051 - also reruns fixed patch on previously patched repos (see CHK-2143)
   8058: Fixed compilation issues following merge


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8466 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-03-07 13:39:01 +00:00
parent 64c26a899f
commit a0450bf1a8
4 changed files with 64 additions and 29 deletions

View File

@@ -24,7 +24,6 @@
*/
package org.alfresco.web.bean.search;
import java.io.Serializable;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -888,14 +887,12 @@ public class AdvancedSearchDialog extends BaseDialogBean
{
// attempt to create folder for this user for first time
// create the preferences Node for this user
Map<QName, Serializable> props = new HashMap<QName, Serializable>(2, 1.0f);
props.put(ContentModel.PROP_NAME, user.getUserName());
ChildAssociationRef childRef = getNodeService().createNode(
globalRef,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.APP_MODEL_1_0_URI, QName.createValidLocalName(user.getUserName())),
ContentModel.TYPE_FOLDER,
props);
null);
properties.setUserSearchesRef(childRef.getChildRef());
}

View File

@@ -280,6 +280,9 @@ public class CreateWebsiteWizard extends BaseWizardBean
WCMAppModel.ASPECT_WEBAPP);
}
// now the sandbox is created set the permissions masks for the store
SandboxFactory.setStagingPermissionMasks(avmStore);
// set the property on the node to reference the root AVM store
getNodeService().setProperty(nodeRef, WCMAppModel.PROP_AVMSTORE, avmStore);

View File

@@ -148,6 +148,13 @@ public class InviteWebsiteUsersWizard extends BaseInviteUsersWizard
{
this.userGroupRoles.add(new UserGroupRole(currentUser, AVMUtil.ROLE_CONTENT_MANAGER, null));
managers.add(currentUser);
// assign permissions explicitly for the current user
this.getPermissionService().setPermission(
nodeRef,
currentUser,
AVMUtil.ROLE_CONTENT_MANAGER,
true);
}
}
else
@@ -199,6 +206,8 @@ public class InviteWebsiteUsersWizard extends BaseInviteUsersWizard
SandboxInfo info = SandboxFactory.createUserSandbox(
getAvmStore(), managers, userAuth, userRole.getRole());
SandboxFactory.addStagingAreaUser(getAvmStore(), userAuth, userRole.getRole());
this.sandboxInfoList.add(info);
// create an app:webuser instance for each authority and assoc to the website node

View File

@@ -45,6 +45,7 @@ import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.util.DNSNameMangler;
import org.alfresco.util.GUID;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -185,38 +186,48 @@ public final class SandboxFactory
return new SandboxInfo( new String[] { stagingStoreName, previewStoreName } );
}
public static void setStagingPermissions(String storeId,
NodeRef webProjectNodeRef)
{
String storeName = AVMUtil.buildStagingStoreName(storeId);
ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
AVMService avmService = services.getAVMService();
PermissionService permissionService = services.getPermissionService();
NodeService nodeService = services.getNodeService();
ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
PermissionService permissionService = services.getPermissionService();
NodeService nodeService = services.getNodeService();
String storeName = AVMUtil.buildStagingStoreName(storeId);
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(storeName));
// apply READ permissions for all users
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(storeName));
permissionService.setPermission(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
// Set store permission mask
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
// Apply sepcific user permissions as set on the web project
// All these will be masked out
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(
// Apply sepcific user permissions as set on the web project
// All these will be masked out
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(
webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef ref : userInfoRefs)
{
NodeRef userInfoRef = ref.getChildRef();
String username = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
String userrole = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
permissionService.setPermission(dirRef, username, userrole, true);
}
for (ChildAssociationRef ref : userInfoRefs)
{
NodeRef userInfoRef = ref.getChildRef();
String username = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
String userrole = (String)nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
permissionService.setPermission(dirRef, username, userrole, true);
}
}
public static void setStagingPermissionMasks(String storeId)
{
FacesContext context = FacesContext.getCurrentInstance();
ServiceRegistry services = Repository.getServiceRegistry(context);
PermissionService permissionService = services.getPermissionService();
String storeName = AVMUtil.buildStagingStoreName(storeId);
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(storeName));
// apply READ permissions for all users
permissionService.setPermission(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
// Set store permission masks
String currentUser = Application.getCurrentUser(context).getUserName();
permissionService.setPermission(dirRef.getStoreRef(), currentUser, PermissionService.CHANGE_PERMISSIONS, true);
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
}
public static void updateStagingAreaManagers(String storeId,
NodeRef webProjectNodeRef, final List<String> managers)
@@ -230,9 +241,24 @@ public final class SandboxFactory
for (String manager : managers)
{
permissionService.setPermission(dirRef, manager, AVMUtil.ROLE_CONTENT_MANAGER, true);
// give the manager change permissions permission in the staging area store
permissionService.setPermission(dirRef.getStoreRef(), manager,
PermissionService.CHANGE_PERMISSIONS, true);
}
}
public static void addStagingAreaUser(String storeId, String authority, String role)
{
// The stores have the mask set in updateSandboxManagers
String storeName = AVMUtil.buildStagingStoreName(storeId);
ServiceRegistry services = Repository.getServiceRegistry(FacesContext.getCurrentInstance());
PermissionService permissionService = services.getPermissionService();
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, AVMUtil.buildStoreRootPath(storeName));
permissionService.setPermission(dirRef, authority, role, true);
}
/**
* Create a user sandbox for the named store.
*