Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPermissionsRequest.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ResourceFilterImpl.java28
-rw-r--r--plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java23
-rw-r--r--plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/internal/security/SecurityManager.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.server.security/src/org/eclipse/emf/cdo/server/spi/security/HomeFolderHandler.java7
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java2
7 files changed, 69 insertions, 22 deletions
diff --git a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPermissionsRequest.java b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPermissionsRequest.java
index 897032044d..6f67e04715 100644
--- a/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPermissionsRequest.java
+++ b/plugins/org.eclipse.emf.cdo.net4j/src/org/eclipse/emf/cdo/internal/net4j/protocol/LoadPermissionsRequest.java
@@ -81,7 +81,9 @@ public class LoadPermissionsRequest extends CDOClientRequest<Map<CDORevision, CD
}
else if (newPermission == CDOPermission.NONE)
{
- revision.clearValues();
+ // TODO Handle newPermission == CDOPermission.NONE
+ // clearValues() also wipes out CDOResourceNode.name and CDOResourceFolder.nodes!
+ // revision.clearValues();
}
}
finally
diff --git a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ResourceFilterImpl.java b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ResourceFilterImpl.java
index 4651a79078..68c02f6e53 100644
--- a/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ResourceFilterImpl.java
+++ b/plugins/org.eclipse.emf.cdo.security/src/org/eclipse/emf/cdo/security/impl/ResourceFilterImpl.java
@@ -69,6 +69,8 @@ public class ResourceFilterImpl extends PermissionFilterImpl implements Resource
private transient BasicEList<Matcher> matchers;
+ private transient int lastVersion;
+
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -424,16 +426,28 @@ public class ResourceFilterImpl extends PermissionFilterImpl implements Resource
private BasicEList<Matcher> getMatchers()
{
- if (matchers != null)
+ InternalCDORevision revision = cdoRevision();
+ if (revision != null)
{
- return matchers;
+ int currentVersion = revision.getVersion();
+ if (currentVersion > lastVersion)
+ {
+ userTokenPos = USER_TOKEN_UNINITIALIZED;
+ matchers = null;
+ lastVersion = currentVersion;
+ }
+
+ if (matchers != null)
+ {
+ return matchers;
+ }
}
String path = getPath();
PatternStyle patternStyle = getPatternStyle();
boolean includeParents = isIncludeParents();
- if (userTokenPos == USER_TOKEN_UNINITIALIZED)
+ if (userTokenPos == USER_TOKEN_UNINITIALIZED || revision == null)
{
userTokenPos = path.indexOf(USER_TOKEN);
}
@@ -503,18 +517,18 @@ public class ResourceFilterImpl extends PermissionFilterImpl implements Resource
public static boolean isResourceTreeImpacted(CommitImpactContext context)
{
InternalCDORevisionDelta[] revisionDeltas = (InternalCDORevisionDelta[])context.getDirtyObjectDeltas();
-
+
for (int i = 0; i < revisionDeltas.length; i++)
{
InternalCDORevisionDelta revisionDelta = revisionDeltas[i];
-
+
// Any tree move might impact this permission
CDOFeatureDelta containerDelta = revisionDelta.getFeatureDelta(CDOContainerFeatureDelta.CONTAINER_FEATURE);
if (containerDelta != null)
{
return true;
}
-
+
// Any change of a resource node name might impact this permission
CDOFeatureDelta nameDelta = revisionDelta.getFeatureDelta(EresourcePackage.Literals.CDO_RESOURCE_NODE__NAME);
if (nameDelta != null)
@@ -522,7 +536,7 @@ public class ResourceFilterImpl extends PermissionFilterImpl implements Resource
return true;
}
}
-
+
return false;
}
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
index 73157b8824..0a15407ab3 100644
--- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
+++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CommitTransactionIndication.java
@@ -24,6 +24,7 @@ import org.eclipse.emf.cdo.common.lock.CDOLockUtil;
import org.eclipse.emf.cdo.common.model.EMFUtil;
import org.eclipse.emf.cdo.common.protocol.CDODataInput;
import org.eclipse.emf.cdo.common.protocol.CDODataOutput;
+import org.eclipse.emf.cdo.common.protocol.CDOProtocol.CommitNotificationInfo;
import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants;
import org.eclipse.emf.cdo.common.security.CDOPermission;
import org.eclipse.emf.cdo.etypes.EtypesPackage;
@@ -419,18 +420,22 @@ public class CommitTransactionIndication extends CDOServerIndicationWithMonitori
IPermissionManager permissionManager = session.getManager().getPermissionManager();
if (permissionManager != null)
{
- InternalCDORevision[] newObjects = commitContext.getNewObjects();
- InternalCDORevision[] dirtyObjects = commitContext.getDirtyObjects();
+ if (commitContext.getSecurityImpact() != CommitNotificationInfo.IMPACT_REALM)
+ {
+ out.writeBoolean(true);
- out.writeInt(newObjects.length + dirtyObjects.length);
+ InternalCDORevision[] newObjects = commitContext.getNewObjects();
+ InternalCDORevision[] dirtyObjects = commitContext.getDirtyObjects();
- respondingNewPermissions(out, permissionManager, session, newObjects);
- respondingNewPermissions(out, permissionManager, session, dirtyObjects);
- }
- else
- {
- out.writeBoolean(false);
+ out.writeInt(newObjects.length + dirtyObjects.length);
+ respondingNewPermissions(out, permissionManager, session, newObjects);
+ respondingNewPermissions(out, permissionManager, session, dirtyObjects);
+
+ return;
+ }
}
+
+ out.writeBoolean(false);
}
protected void respondingNewPermissions(CDODataOutput out, IPermissionManager permissionManager,
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 a30f362278..fc4e8d5595 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
@@ -182,6 +182,8 @@ public class SecurityManager extends Lifecycle implements InternalSecurityManage
private CDOID realmID;
+ private long lastRealmModification = CDOBranchPoint.UNSPECIFIED_DATE;
+
public SecurityManager(String realmPath, IManagedContainer container)
{
this.realmPath = realmPath;
@@ -657,6 +659,12 @@ public class SecurityManager extends Lifecycle implements InternalSecurityManage
protected CDOPermission authorize(CDORevision revision, CDORevisionProvider revisionProvider,
CDOBranchPoint securityContext, ISession session, Access defaultAccess, Permission[] permissions)
{
+ if (lastRealmModification != CDOBranchPoint.UNSPECIFIED_DATE)
+ {
+ systemView.waitForUpdate(lastRealmModification);
+ lastRealmModification = CDOBranchPoint.UNSPECIFIED_DATE;
+ }
+
boolean setUser = defaultAccess == null;
if (setUser)
{
@@ -777,6 +785,8 @@ public class SecurityManager extends Lifecycle implements InternalSecurityManage
{
synchronized (userInfos)
{
+ // System.out.println("clearUserInfos()");
+
userInfos.clear();
permissionBag.clear();
permissionArray = null;
@@ -902,7 +912,9 @@ public class SecurityManager extends Lifecycle implements InternalSecurityManage
try
{
- return authorize(revision, revisionProvider, securityContext, session, null, null);
+ CDOPermission permission = authorize(revision, revisionProvider, securityContext, session, null, null);
+ // System.out.println("Loading from " + session + ": " + permission + " --> " + revision);
+ return permission;
}
finally
{
@@ -1060,6 +1072,11 @@ public class SecurityManager extends Lifecycle implements InternalSecurityManage
public void handleTransactionAfterCommitted(ITransaction transaction, final CommitContext commitContext,
OMMonitor monitor)
{
+ if (commitContext.getSecurityImpact() == CommitNotificationInfo.IMPACT_REALM)
+ {
+ lastRealmModification = commitContext.getBranchPoint().getTimeStamp();
+ }
+
handleCommitted(commitContext);
}
}
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 ad9fd74e3a..7b030e52f9 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
@@ -208,8 +208,11 @@ public class HomeFolderHandler implements InternalSecurityManager.CommitHandler2
protected void handleUser(CDOTransaction transaction, Realm realm, Role role, User user) throws Exception
{
- user.getRoles().add(role);
- transaction.createResourceFolder(getHomeFolder() + "/" + user.getId());
+ EList<Role> roles = user.getRoles();
+ roles.add(role);
+
+ String path = getHomeFolder() + "/" + user.getId();
+ transaction.getOrCreateResourceFolder(path);
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
index a0e1968f32..0143be5079 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
@@ -527,7 +527,13 @@ public class Session extends Container<IView> implements InternalSession
@Override
public String toString()
{
- return MessageFormat.format("Session[{0}]", sessionID); //$NON-NLS-1$
+ String name = manager.getRepository().getName();
+ if (userID != null && userID.length() != 0)
+ {
+ name = userID + "@" + name;
+ }
+
+ return MessageFormat.format("Session{0} [{1}]", sessionID, name); //$NON-NLS-1$
}
/**
diff --git a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java
index e38d04a193..bf4f0a519d 100644
--- a/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java
+++ b/plugins/org.eclipse.emf.cdo.ui/src/org/eclipse/emf/cdo/internal/ui/dialogs/OpenSessionDialog.java
@@ -35,7 +35,7 @@ public class OpenSessionDialog extends TitleAreaDialog
public OpenSessionDialog(IWorkbenchPage page)
{
- super(new Shell(page.getWorkbenchWindow().getShell()));
+ super(page.getWorkbenchWindow().getShell());
this.page = page;
setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL | SWT.MAX | SWT.TITLE | SWT.RESIZE);
}

Back to the top