[exo-jcr-commits] exo-jcr SVN: r5460 - kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Jan 17 05:14:23 EST 2012


Author: tolusha
Date: 2012-01-17 05:14:22 -0500 (Tue, 17 Jan 2012)
New Revision: 5460

Modified:
   kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java
Log:
EXOJCR-1707: Refactoring DBCleanService. added method for validation runtime permissions

Modified: kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java
===================================================================
--- kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java	2012-01-17 09:20:02 UTC (rev 5459)
+++ kernel/branches/2.4.x/exo.kernel.commons/src/main/java/org/exoplatform/commons/utils/SecurityHelper.java	2012-01-17 10:14:22 UTC (rev 5460)
@@ -22,7 +22,9 @@
 
 import java.io.IOException;
 import java.net.MalformedURLException;
+import java.security.AccessControlException;
 import java.security.AccessController;
+import java.security.Permission;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
@@ -317,4 +319,21 @@
          throw new PrivilegedActionException(e);
       }
    }
+
+   /**
+    * Validate permissions.
+    * 
+    * @throws AccessControlException 
+    */
+   public static void validateSecurityPermissions(RuntimePermission... perms)
+   {
+      SecurityManager security = System.getSecurityManager();
+      if (security != null)
+      {
+         for (Permission permission : perms)
+         {
+            security.checkPermission(permission);
+         }
+      }
+   }
 }



More information about the exo-jcr-commits mailing list