diff options
author | Alex Lagarde | 2013-09-18 08:32:47 +0000 |
---|---|---|
committer | Alex Lagarde | 2013-09-18 08:32:47 +0000 |
commit | cefe9f91c8946202a0a27384a3c6d9d4710b46dc (patch) | |
tree | 98da6ce29a3a9559d78d63dbe93cc9c675dacbde /plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf | |
parent | d862129313e1c8bf3fbcc807f29943ecb25cffe2 (diff) | |
download | cdo-committers/alagarde/bugzilla417483.tar.gz cdo-committers/alagarde/bugzilla417483.tar.xz cdo-committers/alagarde/bugzilla417483.zip |
[417483] [Security] Issues in invalidation when missing write Permissioncommitters/alagarde/bugzilla417483
https://bugs.eclipse.org/bugs/show_bug.cgi?id=417483
- Modify CDORevisionImpl to avoid throwing NoPermissionExceptions when
copying a new revision out of an existing one
- Modify CDOSessionImpl to avoid throwing NoPermissionExceptions when
revising revisisons
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf')
-rw-r--r-- | plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java index 2475856f85..2b7c718966 100644 --- a/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java +++ b/plugins/org.eclipse.emf.cdo.common/src/org/eclipse/emf/cdo/internal/common/revision/CDORevisionImpl.java @@ -31,6 +31,11 @@ public class CDORevisionImpl extends BaseCDORevision { private Object[] values; + /** + * Indicates if the revision is being copied from another revision. In that case isWritable() will allways return true. + */ + private boolean isCopying; + public CDORevisionImpl(EClass eClass) { super(eClass); @@ -42,23 +47,31 @@ public class CDORevisionImpl extends BaseCDORevision EStructuralFeature[] features = clearValues(); int length = features.length; - for (int i = 0; i < length; i++) + isCopying = true; + try { - EStructuralFeature feature = features[i]; - if (feature.isMany()) + for (int i = 0; i < length; i++) { - InternalCDOList sourceList = (InternalCDOList)source.values[i]; - if (sourceList != null) + EStructuralFeature feature = features[i]; + if (feature.isMany()) { - EClassifier classifier = feature.getEType(); - setValue(i, sourceList.clone(classifier)); + InternalCDOList sourceList = (InternalCDOList)source.values[i]; + if (sourceList != null) + { + EClassifier classifier = feature.getEType(); + setValue(i, sourceList.clone(classifier)); + } + } + else + { + CDOType type = CDOModelUtil.getType(feature); + setValue(i, type.copyValue(source.values[i])); } } - else - { - CDOType type = CDOModelUtil.getType(feature); - setValue(i, type.copyValue(source.values[i])); - } + } + finally + { + isCopying = false; } } @@ -84,4 +97,22 @@ public class CDORevisionImpl extends BaseCDORevision { values[featureIndex] = value; } + + /** + * + * {@inheritDoc} + * + * @see org.eclipse.emf.cdo.spi.common.revision.AbstractCDORevision#isWritable() + */ + @Override + public boolean isWritable() + { + // If we are copying another revision ( + if (isCopying) + { + return true; + } + return super.isWritable(); + } + } |