mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V1.3 to HEAD (3068:3083, 3084:3086)
svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3068 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3083 . svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3084 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3086 . git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3342 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -483,6 +483,12 @@
|
|||||||
<property name="searchService">
|
<property name="searchService">
|
||||||
<ref bean="SearchService" />
|
<ref bean="SearchService" />
|
||||||
</property>
|
</property>
|
||||||
|
<property name="permissionService">
|
||||||
|
<ref bean="PermissionService" />
|
||||||
|
</property>
|
||||||
|
<property name="authenticationService">
|
||||||
|
<ref bean="AuthenticationService" />
|
||||||
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
@@ -47,6 +47,10 @@ import org.alfresco.service.cmr.repository.StoreRef;
|
|||||||
import org.alfresco.service.cmr.rule.RuleService;
|
import org.alfresco.service.cmr.rule.RuleService;
|
||||||
import org.alfresco.service.cmr.search.ResultSet;
|
import org.alfresco.service.cmr.search.ResultSet;
|
||||||
import org.alfresco.service.cmr.search.SearchService;
|
import org.alfresco.service.cmr.search.SearchService;
|
||||||
|
import org.alfresco.service.cmr.security.AccessPermission;
|
||||||
|
import org.alfresco.service.cmr.security.AccessStatus;
|
||||||
|
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||||
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.namespace.NamespaceService;
|
import org.alfresco.service.namespace.NamespaceService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||||
@@ -74,6 +78,12 @@ public class CopyServiceImpl implements CopyService
|
|||||||
/** Rule service */
|
/** Rule service */
|
||||||
private RuleService ruleService;
|
private RuleService ruleService;
|
||||||
|
|
||||||
|
/** Permission service */
|
||||||
|
private PermissionService permissionService;
|
||||||
|
|
||||||
|
/** Authentication service */
|
||||||
|
private AuthenticationService authenticationService;
|
||||||
|
|
||||||
/** Policy delegates */
|
/** Policy delegates */
|
||||||
private ClassPolicyDelegate<CopyServicePolicies.OnCopyNodePolicy> onCopyNodeDelegate;
|
private ClassPolicyDelegate<CopyServicePolicies.OnCopyNodePolicy> onCopyNodeDelegate;
|
||||||
private ClassPolicyDelegate<CopyServicePolicies.OnCopyCompletePolicy> onCopyCompleteDelegate;
|
private ClassPolicyDelegate<CopyServicePolicies.OnCopyCompletePolicy> onCopyCompleteDelegate;
|
||||||
@@ -128,6 +138,26 @@ public class CopyServiceImpl implements CopyService
|
|||||||
this.ruleService = ruleService;
|
this.ruleService = ruleService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the permission service
|
||||||
|
*
|
||||||
|
* @param permissionService the permission service
|
||||||
|
*/
|
||||||
|
public void setPermissionService(PermissionService permissionService)
|
||||||
|
{
|
||||||
|
this.permissionService = permissionService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the authentication service
|
||||||
|
*
|
||||||
|
* @param authenticationService the authentication service
|
||||||
|
*/
|
||||||
|
public void setAuthenticationService(AuthenticationService authenticationService)
|
||||||
|
{
|
||||||
|
this.authenticationService = authenticationService;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise method
|
* Initialise method
|
||||||
*/
|
*/
|
||||||
@@ -395,6 +425,9 @@ public class CopyServiceImpl implements CopyService
|
|||||||
|
|
||||||
// Copy the associations
|
// Copy the associations
|
||||||
copyAssociations(destinationNodeRef, copyDetails, copyChildren, copiedChildren);
|
copyAssociations(destinationNodeRef, copyDetails, copyChildren, copiedChildren);
|
||||||
|
|
||||||
|
// Copy permissions
|
||||||
|
copyPermissions(sourceNodeRef, destinationNodeRef);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -404,6 +437,34 @@ public class CopyServiceImpl implements CopyService
|
|||||||
return destinationNodeRef;
|
return destinationNodeRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies the permissions of the source node reference onto the destination node reference
|
||||||
|
*
|
||||||
|
* @param sourceNodeRef the source node reference
|
||||||
|
* @param destinationNodeRef the destination node reference
|
||||||
|
*/
|
||||||
|
private void copyPermissions(NodeRef sourceNodeRef, NodeRef destinationNodeRef)
|
||||||
|
{
|
||||||
|
// Get the permission details of the source node reference
|
||||||
|
Set<AccessPermission> permissions = this.permissionService.getAllSetPermissions(sourceNodeRef);
|
||||||
|
boolean includeInherited = this.permissionService.getInheritParentPermissions(sourceNodeRef);
|
||||||
|
|
||||||
|
AccessStatus writePermission = permissionService.hasPermission(destinationNodeRef, PermissionService.CHANGE_PERMISSIONS);
|
||||||
|
if (this.authenticationService.isCurrentUserTheSystemUser() || writePermission.equals(AccessStatus.ALLOWED))
|
||||||
|
{
|
||||||
|
// Set the permission values on the destination node
|
||||||
|
for (AccessPermission permission : permissions)
|
||||||
|
{
|
||||||
|
this.permissionService.setPermission(
|
||||||
|
destinationNodeRef,
|
||||||
|
permission.getAuthority(),
|
||||||
|
permission.getPermission(),
|
||||||
|
permission.getAccessStatus().equals(AccessStatus.ALLOWED));
|
||||||
|
}
|
||||||
|
this.permissionService.setInheritParentPermissions(destinationNodeRef, includeInherited);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the copy details. This calls the appropriate policies that have been registered
|
* Gets the copy details. This calls the appropriate policies that have been registered
|
||||||
* against the node and aspect types in order to pick-up any type specific copy behaviour.
|
* against the node and aspect types in order to pick-up any type specific copy behaviour.
|
||||||
|
@@ -847,6 +847,25 @@ public final class Node implements Serializable
|
|||||||
for (String key : this.properties.keySet())
|
for (String key : this.properties.keySet())
|
||||||
{
|
{
|
||||||
Serializable value = (Serializable)this.properties.get(key);
|
Serializable value = (Serializable)this.properties.get(key);
|
||||||
|
|
||||||
|
// perform the conversion from script wrapper object to repo serializable values
|
||||||
|
value = convertValue(value);
|
||||||
|
|
||||||
|
props.put(createQName(key), value);
|
||||||
|
}
|
||||||
|
this.nodeService.setProperties(this.nodeRef, props);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert an object from any script wrapper value to a valid repository serializable value.
|
||||||
|
* This includes converting JavaScript Array objects to Lists of valid objects.
|
||||||
|
*
|
||||||
|
* @param value Value to convert from script wrapper object to repo serializable value
|
||||||
|
*
|
||||||
|
* @return valid repo value
|
||||||
|
*/
|
||||||
|
private static Serializable convertValue(Serializable value)
|
||||||
|
{
|
||||||
if (value instanceof Node)
|
if (value instanceof Node)
|
||||||
{
|
{
|
||||||
// convert back to NodeRef
|
// convert back to NodeRef
|
||||||
@@ -860,7 +879,8 @@ public final class Node implements Serializable
|
|||||||
else if (value instanceof Wrapper)
|
else if (value instanceof Wrapper)
|
||||||
{
|
{
|
||||||
// unwrap a Java object from a JavaScript wrapper
|
// unwrap a Java object from a JavaScript wrapper
|
||||||
value = (Serializable)((Wrapper)value).unwrap();
|
// recursively call this method to convert the unwrapped value
|
||||||
|
value = convertValue((Serializable)((Wrapper)value).unwrap());
|
||||||
}
|
}
|
||||||
else if (value instanceof ScriptableObject)
|
else if (value instanceof ScriptableObject)
|
||||||
{
|
{
|
||||||
@@ -879,23 +899,15 @@ public final class Node implements Serializable
|
|||||||
// we are only interested in keys that indicate a list of values
|
// we are only interested in keys that indicate a list of values
|
||||||
if (propId instanceof Integer)
|
if (propId instanceof Integer)
|
||||||
{
|
{
|
||||||
// get the value out for the specified key - make sure it is Serializable
|
// get the value out for the specified key
|
||||||
Object val = values.get((Integer)propId, values);
|
Serializable val = (Serializable)values.get((Integer)propId, values);
|
||||||
if (val instanceof Wrapper)
|
// recursively call this method to convert the value
|
||||||
{
|
propValues.add(convertValue(val));
|
||||||
val = ((Wrapper)val).unwrap();
|
|
||||||
}
|
|
||||||
if (val instanceof Serializable)
|
|
||||||
{
|
|
||||||
propValues.add((Serializable)val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
value = (Serializable)propValues;
|
value = (Serializable)propValues;
|
||||||
}
|
}
|
||||||
props.put(createQName(key), value);
|
return value;
|
||||||
}
|
|
||||||
this.nodeService.setProperties(this.nodeRef, props);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user