diff --git a/source/java/org/alfresco/repo/jscript/Node.java b/source/java/org/alfresco/repo/jscript/Node.java index 6bdbf8553c..ad5e08e2ec 100644 --- a/source/java/org/alfresco/repo/jscript/Node.java +++ b/source/java/org/alfresco/repo/jscript/Node.java @@ -58,6 +58,7 @@ import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.TemplateImageResolver; import org.alfresco.service.cmr.search.QueryParameterDefinition; +import org.alfresco.service.cmr.security.AccessPermission; import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.cmr.version.Version; @@ -549,30 +550,6 @@ public class Node implements Serializable, Scopeable return getAspects().contains(createQName(aspect)); } - /** - * Return true if the user has the specified permission on the node. - *
- * The default permissions are found in org.alfresco.service.cmr.security.PermissionService
.
- * Most commonly used are "Write", "Delete" and "AddChildren".
- *
- * @param permission as found in org.alfresco.service.cmr.security.PermissionService
- * @return true if the user has the specified permission on the node.
- */
- public boolean hasPermission(String permission)
- {
- ParameterCheck.mandatory("Permission Name", permission);
-
- boolean allowed = false;
-
- if (permission != null && permission.length() != 0)
- {
- AccessStatus status = this.services.getPermissionService().hasPermission(this.nodeRef, permission);
- allowed = (AccessStatus.ALLOWED == status);
- }
-
- return allowed;
- }
-
/**
* @return Display path to this node
*/
@@ -829,6 +806,54 @@ public class Node implements Serializable, Scopeable
// ------------------------------------------------------------------------------
// Security API
+ /**
+ * Return true if the user has the specified permission on the node.
+ *
+ * The default permissions are found in org.alfresco.service.cmr.security.PermissionService
.
+ * Most commonly used are "Write", "Delete" and "AddChildren".
+ *
+ * @param permission as found in org.alfresco.service.cmr.security.PermissionService
+ * @return true if the user has the specified permission on the node.
+ */
+ public boolean hasPermission(String permission)
+ {
+ ParameterCheck.mandatory("Permission Name", permission);
+
+ boolean allowed = false;
+
+ if (permission != null && permission.length() != 0)
+ {
+ AccessStatus status = this.services.getPermissionService().hasPermission(this.nodeRef, permission);
+ allowed = (AccessStatus.ALLOWED == status);
+ }
+
+ return allowed;
+ }
+
+ /**
+ * @return Array of permissions applied to this Node.
+ * Strings returned are of the format [ALLOWED|DENIED];[USERNAME|GROUPNAME];PERMISSION for example
+ * ALLOWED;kevinr;Consumer so can be easily tokenized on the ';' character.
+ */
+ public String[] getPermissions()
+ {
+ String userName = this.services.getAuthenticationService().getCurrentUserName();
+ Set