[exo-jcr-commits] exo-jcr SVN: r5267 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Dec 6 03:07:06 EST 2011


Author: tolusha
Date: 2011-12-06 03:07:06 -0500 (Tue, 06 Dec 2011)
New Revision: 5267

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
Log:
EXOJCR-1603:  Code that invokes methods of DBCleanService must have JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION permission;

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java	2011-12-06 08:06:15 UTC (rev 5266)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java	2011-12-06 08:07:06 UTC (rev 5267)
@@ -79,6 +79,13 @@
    public static void cleanWorkspaceData(WorkspaceEntry wsEntry) throws RepositoryConfigurationException,
       NamingException, SQLException
    {
+      // Need privileges to manage repository.
+      SecurityManager security = System.getSecurityManager();
+      if (security != null)
+      {
+         security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+      }
+
       String dsName = wsEntry.getContainer().getParameterValue(JDBCWorkspaceDataContainer.SOURCE_NAME);
 
       final DataSource ds = (DataSource)new InitialContext().lookup(dsName);
@@ -114,6 +121,13 @@
    public static void cleanRepositoryData(RepositoryEntry rEntry) throws RepositoryConfigurationException,
       NamingException, SQLException
    {
+      // Need privileges to manage repository.
+      SecurityManager security = System.getSecurityManager();
+      if (security != null)
+      {
+         security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+      }
+
       if (rEntry.getWorkspaceEntries().size() == 0)
       {
          // nothing to clean



More information about the exo-jcr-commits mailing list