Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2013-10-01 06:41:01 -0400
committerEike Stepper2013-10-01 14:21:43 -0400
commit596ce42d6fe3d648f771b7a27b3af5f828f25a2a (patch)
tree7fb5d428878fec3efdf177de24df1bcd7d64e2e1 /plugins/org.eclipse.emf.cdo.server.security
parent04c53c1cb3132f7d3e674dfae3b7dbddafce6e03 (diff)
downloadcdo-596ce42d6fe3d648f771b7a27b3af5f828f25a2a.tar.gz
cdo-596ce42d6fe3d648f771b7a27b3af5f828f25a2a.tar.xz
cdo-596ce42d6fe3d648f771b7a27b3af5f828f25a2a.zip
[418267] [Security] Cached permissions are not always properly updated
after commits https://bugs.eclipse.org/bugs/show_bug.cgi?id=418267
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.security')
-rw-r--r--plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/internal/security/SecurityManager.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/AnnotationHandler.java6
-rw-r--r--plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/HomeFolderHandler.java104
3 files changed, 76 insertions, 35 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/internal/security/SecurityManager.java b/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/internal/security/SecurityManager.java
index 08ba264124..a30f362278 100644
--- a/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/internal/security/SecurityManager.java
+++ b/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/internal/security/SecurityManager.java
@@ -456,6 +456,7 @@ public class SecurityManager extends Lifecycle implements InternalSecurityManage
try
{
handler.init(this, firstTime);
+ OM.LOG.info("Security realm handled by " + handler);
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/AnnotationHandler.java b/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/AnnotationHandler.java
index a6d7d0e86f..14e4176cc3 100644
--- a/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/AnnotationHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/AnnotationHandler.java
@@ -158,6 +158,12 @@ public class AnnotationHandler implements InternalSecurityManager.CommitHandler
}
}
+ @Override
+ public String toString()
+ {
+ return getClass().getSimpleName();
+ }
+
/**
* @author Eike Stepper
* @since 4.3
diff --git a/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/HomeFolderHandler.java b/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/HomeFolderHandler.java
index bc25ea01c6..ad9fd74e3a 100644
--- a/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/HomeFolderHandler.java
+++ b/plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/HomeFolderHandler.java
@@ -25,6 +25,9 @@ import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.view.CDOView;
+import org.eclipse.net4j.util.concurrent.ExecutorServiceFactory;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.container.IManagedContainer.ContainerAware;
import org.eclipse.net4j.util.factory.ProductCreationException;
import org.eclipse.emf.common.util.BasicEList;
@@ -32,6 +35,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import java.util.List;
+import java.util.concurrent.ExecutorService;
/**
* If the meaning of this type isn't clear, there really should be more of a description here...
@@ -47,6 +51,8 @@ public class HomeFolderHandler implements InternalSecurityManager.CommitHandler2
private final String homeFolder;
+ private ExecutorService executorService;
+
public HomeFolderHandler(String homeFolder)
{
this.homeFolder = homeFolder == null || homeFolder.length() == 0 ? DEFAULT_HOME_FOLDER : homeFolder;
@@ -62,6 +68,16 @@ public class HomeFolderHandler implements InternalSecurityManager.CommitHandler2
return homeFolder;
}
+ public ExecutorService getExecutorService()
+ {
+ return executorService;
+ }
+
+ public void setExecutorService(ExecutorService executorService)
+ {
+ this.executorService = executorService;
+ }
+
public void init(InternalSecurityManager securityManager, boolean firstTime)
{
if (firstTime)
@@ -134,51 +150,58 @@ public class HomeFolderHandler implements InternalSecurityManager.CommitHandler2
}
}
- protected void handleUsers(InternalSecurityManager securityManager, final List<String> userIDs, final boolean init)
+ protected void handleUsers(final InternalSecurityManager securityManager, final List<String> userIDs,
+ final boolean init)
{
- securityManager.modify(new RealmOperation()
+ executorService.submit(new Runnable()
{
- public void execute(Realm realm)
+ public void run()
{
- String roleID = "Home Folder " + homeFolder;
- Role role;
-
- if (init)
- {
- role = realm.addRole(roleID);
- initRole(role);
- }
- else
+ securityManager.modify(new RealmOperation()
{
- role = realm.getRole(roleID);
- if (role == null)
+ public void execute(Realm realm)
{
- OM.LOG.warn("Role '" + roleID + "' not found in " + HomeFolderHandler.this);
- return;
- }
- }
-
- CDOTransaction transaction = (CDOTransaction)realm.cdoView();
+ String roleID = "Home Folder " + homeFolder;
+ Role role;
- for (String userID : userIDs)
- {
- try
- {
- User user = realm.getUser(userID);
- if (user == null)
+ if (init)
{
- OM.LOG.warn("User '" + userID + "' not found in " + HomeFolderHandler.this);
+ role = realm.addRole(roleID);
+ initRole(role);
}
else
{
- handleUser(transaction, realm, role, user);
+ role = realm.getRole(roleID);
+ if (role == null)
+ {
+ OM.LOG.warn("Role '" + roleID + "' not found in " + HomeFolderHandler.this);
+ return;
+ }
+ }
+
+ CDOTransaction transaction = (CDOTransaction)realm.cdoView();
+
+ for (String userID : userIDs)
+ {
+ try
+ {
+ User user = realm.getUser(userID);
+ if (user == null)
+ {
+ OM.LOG.warn("User '" + userID + "' not found in " + HomeFolderHandler.this);
+ }
+ else
+ {
+ handleUser(transaction, realm, role, user);
+ }
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
}
}
- catch (Exception ex)
- {
- OM.LOG.error(ex);
- }
- }
+ });
}
});
}
@@ -198,17 +221,28 @@ public class HomeFolderHandler implements InternalSecurityManager.CommitHandler2
/**
* @author Eike Stepper
*/
- public static class Factory extends InternalSecurityManager.CommitHandler.Factory
+ public static class Factory extends InternalSecurityManager.CommitHandler.Factory implements ContainerAware
{
+ private IManagedContainer container;
+
public Factory()
{
super("home");
}
+ public void setManagedContainer(IManagedContainer container)
+ {
+ this.container = container;
+ }
+
@Override
public CommitHandler create(String homeFolder) throws ProductCreationException
{
- return new HomeFolderHandler(homeFolder);
+ ExecutorService executorService = ExecutorServiceFactory.get(container);
+
+ HomeFolderHandler handler = new HomeFolderHandler(homeFolder);
+ handler.setExecutorService(executorService);
+ return handler;
}
}
}

Back to the top