jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1430959 - /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/jackrabbit/authorization/AccessControlUtils.java
Date Wed, 09 Jan 2013 17:02:49 GMT
Author: angela
Date: Wed Jan  9 17:02:49 2013
New Revision: 1430959

URL: http://svn.apache.org/viewvc?rev=1430959&view=rev
Log:
extend AccessControlUtils with method to retrieve the names from a privilege array

Modified:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/jackrabbit/authorization/AccessControlUtils.java

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/jackrabbit/authorization/AccessControlUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/jackrabbit/authorization/AccessControlUtils.java?rev=1430959&r1=1430958&r2=1430959&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/jackrabbit/authorization/AccessControlUtils.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/jackrabbit/authorization/AccessControlUtils.java
Wed Jan  9 17:02:49 2013
@@ -56,6 +56,24 @@ public class AccessControlUtils {
     }
 
     /**
+     * Retrieves the names of the specified privileges.
+     *
+     * @param privileges One or more privileges.
+     * @return The names of the specified privileges.
+     */
+    public static String[] namesFromPrivileges(Privilege... privileges) {
+        if (privileges == null || privileges.length == 0) {
+            return new String[0];
+        } else {
+            String[] names = new String[privileges.length];
+            for (int i = 0; i < privileges.length; i++) {
+                names[i] = privileges[i].getName();
+            }
+            return names;
+        }
+    }
+
+    /**
      * Utility that combines {@link AccessControlManager#getApplicablePolicies(String)}
      * and {@link AccessControlManager#getPolicies(String)} to retrieve
      * a modifiable {@code JackrabbitAccessControlList} for the given path.<br>



Mime
View raw message