mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
. Fix to issue in login page redirect code where URL arguments (e.g. for templates and scripts) were removed and not passed through.
- this only affected the template/command servlets that were using parameters and had not already logged in . Support for 'path' argument on DownloadContentServlet for example /alfresco/download/direct?path=/Company%20Home/Kev's%20Home%20Space/myimage.jpg - paths are specified in a similar way to webdav path - they are 'cm:name' based URL encoded strings - this means we no longer need to have the NodeRef to a document to download it . Support for 'templatePath' and 'contextPath' URL arguments in TemplateContentServlet for example: /alfresco/template?templatePath=/Company%20Home/Data%20Dictionary/Presentation%20Templates/doc_info.ftl&contextPath=/Company%20Home/file.txt - the 'templatePath' argument specifies the cm:name based path to the template to execute - the 'contextPath' argument specifies the cm:name based path to the context for the template . Support for 'scriptPath' and 'contextPath' URL arguments in Script CommandProcessor for example: /alfresco/command/script/execute?scriptPath=/Company%20Home/Data%20Dictionary/Scripts/append%20copyright.js&contextPath=/Company%20Home/file.txt - the 'scriptPath' argument specifies the cm:name based path to the script to execute - the 'contextPath' argument specifies the cm:name based path to the context for the script . Adding debugging output to get timings for executing templates and scripts . Enhancements and additions to JavaScript API: setPermission() removePermission() get/setInheritsPermissions() git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3297 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -47,6 +47,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||
import org.alfresco.service.cmr.security.AccessStatus;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
@@ -488,6 +489,66 @@ public final class Node implements Serializable
|
||||
return allowed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the node inherits permissions from the parent node, false otherwise
|
||||
*/
|
||||
public boolean inheritsPermissions()
|
||||
{
|
||||
return this.services.getPermissionService().getInheritParentPermissions(this.nodeRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether this node should inherit permissions from the parent node.
|
||||
*
|
||||
* @param inherit True to inherit parent permissions, false otherwise.
|
||||
*/
|
||||
public void setInheritsPermissions(boolean inherit)
|
||||
{
|
||||
this.services.getPermissionService().setInheritParentPermissions(this.nodeRef, inherit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a permission for ALL users to the node.
|
||||
*
|
||||
* @param permission Permission to apply @see org.alfresco.service.cmr.security.PermissionService
|
||||
*/
|
||||
public void setPermission(String permission)
|
||||
{
|
||||
this.services.getPermissionService().setPermission(this.nodeRef, PermissionService.ALL_AUTHORITIES, permission, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a permission for the specified authority (e.g. username or group) to the node.
|
||||
*
|
||||
* @param permission Permission to apply @see org.alfresco.service.cmr.security.PermissionService
|
||||
* @param authority Authority (generally a username or group name) to apply the permission for
|
||||
*/
|
||||
public void setPermission(String permission, String authority)
|
||||
{
|
||||
this.services.getPermissionService().setPermission(this.nodeRef, authority, permission, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a permission for ALL user from the node.
|
||||
*
|
||||
* @param permission Permission to remove @see org.alfresco.service.cmr.security.PermissionService
|
||||
*/
|
||||
public void removePermission(String permission)
|
||||
{
|
||||
this.services.getPermissionService().deletePermission(this.nodeRef, PermissionService.ALL_AUTHORITIES, permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a permission for the specified authority (e.g. username or group) from the node.
|
||||
*
|
||||
* @param permission Permission to remove @see org.alfresco.service.cmr.security.PermissionService
|
||||
* @param authority Authority (generally a username or group name) to apply the permission for
|
||||
*/
|
||||
public void removePermission(String permission, String authority)
|
||||
{
|
||||
this.services.getPermissionService().deletePermission(this.nodeRef, authority, permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Display path to this node
|
||||
*/
|
||||
|
@@ -35,6 +35,7 @@ import org.alfresco.service.cmr.repository.ScriptException;
|
||||
import org.alfresco.service.cmr.repository.ScriptService;
|
||||
import org.alfresco.service.cmr.repository.TemplateImageResolver;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.mozilla.javascript.Context;
|
||||
import org.mozilla.javascript.ImporterTopLevel;
|
||||
import org.mozilla.javascript.Scriptable;
|
||||
@@ -47,6 +48,8 @@ import org.mozilla.javascript.ScriptableObject;
|
||||
*/
|
||||
public class RhinoScriptService implements ScriptService
|
||||
{
|
||||
private static final Logger logger = Logger.getLogger(RhinoScriptService.class);
|
||||
|
||||
/** The permission-safe node service */
|
||||
private NodeService nodeService;
|
||||
|
||||
@@ -191,7 +194,13 @@ public class RhinoScriptService implements ScriptService
|
||||
*/
|
||||
private Object executeScriptImpl(Reader reader, Map<String, Object> model)
|
||||
throws AlfrescoRuntimeException
|
||||
{
|
||||
{
|
||||
long startTime = 0;
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
// check that rhino script engine is available
|
||||
Context cx = Context.enter();
|
||||
try
|
||||
@@ -226,6 +235,12 @@ public class RhinoScriptService implements ScriptService
|
||||
finally
|
||||
{
|
||||
cx.exit();
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
long endTime = System.currentTimeMillis();
|
||||
logger.debug("Time to execute script: " + (endTime - startTime) + "ms");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user