Author: tolusha
Date: 2010-06-10 05:11:39 -0400 (Thu, 10 Jun 2010)
New Revision: 2533
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/JCRRuntimePermissions.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
Log:
EXOJCR-756: add JCRRuntimePermissions class
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/JCRRuntimePermissions.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/JCRRuntimePermissions.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/core/security/JCRRuntimePermissions.java 2010-06-10
09:11:39 UTC (rev 2533)
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.core.security;
+
+/**
+ * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy
Bazko</a>
+ * @version $Id: JCRRuntimePermissions.java 111 2010-11-11 11:11:11Z tolusha $
+ */
+public class JCRRuntimePermissions
+{
+
+ public static final RuntimePermission GET_SYSTEM_SESSION_PERMISSION = new
RuntimePermission("getJCRSystemSession");
+
+ public static final RuntimePermission MANAGE_REPOSITORY_PERMISSION = new
RuntimePermission("manageRepository");
+
+}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2010-06-10
09:01:19 UTC (rev 2532)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/RepositoryImpl.java 2010-06-10
09:11:39 UTC (rev 2533)
@@ -27,6 +27,7 @@
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.core.WorkspaceContainerFacade;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
+import org.exoplatform.services.jcr.core.security.JCRRuntimePermissions;
import org.exoplatform.services.jcr.dataflow.PersistentDataManager;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
import org.exoplatform.services.jcr.datamodel.NodeData;
@@ -67,10 +68,6 @@
public class RepositoryImpl implements ManageableRepository
{
- private static final RuntimePermission GET_SYSTEM_SESSION_PERMISSION = new
RuntimePermission("getJCRSystemSession");
-
- private static final RuntimePermission MANAGE_REPOSITORY_PERMISSION = new
RuntimePermission("manageRepository");
-
/**
* Repository descriptors.
*/
@@ -164,7 +161,7 @@
SecurityManager security = System.getSecurityManager();
if (security != null)
{
- security.checkPermission(MANAGE_REPOSITORY_PERMISSION);
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
}
PersistentDataManager pmanager =
@@ -201,7 +198,7 @@
SecurityManager security = System.getSecurityManager();
if (security != null)
{
- security.checkPermission(MANAGE_REPOSITORY_PERMISSION);
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
}
if (isWorkspaceInitialized(wsConfig.getName()))
@@ -252,7 +249,7 @@
SecurityManager security = System.getSecurityManager();
if (security != null)
{
- security.checkPermission(MANAGE_REPOSITORY_PERMISSION);
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
}
if (isWorkspaceInitialized(workspaceName))
@@ -283,7 +280,7 @@
SecurityManager security = System.getSecurityManager();
if (security != null)
{
- security.checkPermission(MANAGE_REPOSITORY_PERMISSION);
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
}
return config;
@@ -362,7 +359,7 @@
SecurityManager security = System.getSecurityManager();
if (security != null)
{
- security.checkPermission(GET_SYSTEM_SESSION_PERMISSION);
+ security.checkPermission(JCRRuntimePermissions.GET_SYSTEM_SESSION_PERMISSION);
}
if (getState() == OFFLINE)
@@ -458,7 +455,7 @@
SecurityManager security = System.getSecurityManager();
if (security != null)
{
- security.checkPermission(MANAGE_REPOSITORY_PERMISSION);
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
}
WorkspaceContainer workspaceContainer = null;
@@ -609,7 +606,7 @@
SecurityManager security = System.getSecurityManager();
if (security != null)
{
- security.checkPermission(MANAGE_REPOSITORY_PERMISSION);
+ security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
}
switch (state)