Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Garzone2019-04-18 10:47:36 -0400
committerGuillaume Garzone2019-04-18 10:47:36 -0400
commita1a083e8e4b9a4cef88c91ee99cf515573334554 (patch)
tree86e2c2b226bf6fac955ac4d3156593e8364d0d28
parentc6584d86a53b85f77abcf86a87bf332e5da6f5bc (diff)
downloadorg.eclipse.om2m-dev.tar.gz
org.eclipse.om2m-dev.tar.xz
org.eclipse.om2m-dev.zip
Fix Bug 529725 corrections on ACP DAO Update and fix in ACP Utilsdev
Change-Id: I9163125da5877490036553ee3aafd82229852535 Signed-off-by: Guillaume Garzone <guillaume.garzone@laas.fr>
-rw-r--r--org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/utils/AcpUtils.java8
-rw-r--r--org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java13
2 files changed, 18 insertions, 3 deletions
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/utils/AcpUtils.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/utils/AcpUtils.java
index 71f75a0b..7e5bf517 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/utils/AcpUtils.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/utils/AcpUtils.java
@@ -107,9 +107,11 @@ public class AcpUtils {
// For each originator in ACR
for (String originator : rule.getAccessControlOriginators()){
- AccessControlOriginatorEntity originatorEntity = new AccessControlOriginatorEntity(originator);
- ruleEntity.getAccessControlOriginators().add(originatorEntity);
- }
+ for (String splitted: originator.split(" ")) {
+ AccessControlOriginatorEntity originatorEntity = new AccessControlOriginatorEntity(splitted);
+ ruleEntity.getAccessControlOriginators().add(originatorEntity);
+ }
+ }
result.add(ruleEntity);
}
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java
index 8eb9afec..060ea319 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java
@@ -69,6 +69,19 @@ public class AccessControlPolicyDAO extends AbstractDAO<AccessControlPolicyEntit
DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
List<LabelEntity> lbls = processLabels(dbTransaction, resource.getLabelsEntities());
resource.setLabelsEntities(lbls);
+
+ // persist self privilege
+ for(AccessControlRuleEntity acre : resource.getSelfPrivileges()) {
+ acre.setSelfAccessControlPolicy(resource);
+ transaction.getEm().persist(acre);
+ }
+
+ // persist privileges
+ for(AccessControlRuleEntity acre : resource.getPrivileges()) {
+ acre.setAccessControlPolicy(resource);
+ transaction.getEm().persist(acre);
+ }
+
transaction.getEm().merge(resource);
}

Back to the top