[exo-jcr-commits] exo-jcr SVN: r4232 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Apr 13 07:19:32 EDT 2011
Author: tolusha
Date: 2011-04-13 07:19:32 -0400 (Wed, 13 Apr 2011)
New Revision: 4232
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java
Log:
EXOJCR-1301: Allow to use external backup tools in a secure manner
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java 2011-04-13 11:16:17 UTC (rev 4231)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/RepositorySuspendController.java 2011-04-13 11:19:32 UTC (rev 4232)
@@ -23,6 +23,7 @@
import org.exoplatform.management.jmx.annotations.NameTemplate;
import org.exoplatform.management.jmx.annotations.Property;
import org.exoplatform.services.jcr.core.ManageableRepository;
+import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
import org.picocontainer.Startable;
@@ -54,7 +55,7 @@
/**
* Undefined state.
*/
- public final String UNDEFINED = "undefined";
+ private final String UNDEFINED = "undefined";
private final ManageableRepository repository;
@@ -80,6 +81,13 @@
@ManagedDescription("Suspend repository which means that allow only read operations. All writing threads will wait until resume operations invoked.")
public String suspend()
{
+ // Need privileges to manage repository.
+ SecurityManager security = System.getSecurityManager();
+ if (security != null)
+ {
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+ }
+
for (Suspendable component : getSuspendableComponents())
{
try
@@ -104,6 +112,13 @@
@ManagedDescription("Resume repository. All previously suspended threads continue working.")
public String resume()
{
+ // Need privileges to manage repository.
+ SecurityManager security = System.getSecurityManager();
+ if (security != null)
+ {
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
+ }
+
List<Suspendable> components = getSuspendableComponents();
Collections.reverse(components);
More information about the exo-jcr-commits
mailing list