Skip to content
Snippets Groups Projects
Commit e917ab76 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'f-datatype-override' into 'dev'

Fix #217 and #221

Closes #217 and #221

See merge request !56
parents 400e1c18 50ada2b1
Branches
Tags
2 merge requests!58REL: prepare release 0.7.2,!56Fix #217 and #221
Pipeline #20368 passed
...@@ -31,6 +31,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -31,6 +31,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [caosdb-server#174](https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/174) * [caosdb-server#174](https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/174)
GRPC-API: Server should gracefully handle non-file entities with file-like GRPC-API: Server should gracefully handle non-file entities with file-like
attributes. attributes.
* [caosdb-server#217](https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/217)
Server gets list property datatype wrong if description is updated.
* [caosdb-server#221](https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/221)
Unknown error during update of property leaving out datatype.
### Security ### Security
......
...@@ -399,16 +399,17 @@ public class WriteTransaction extends Transaction<WritableContainer> ...@@ -399,16 +399,17 @@ public class WriteTransaction extends Transaction<WritableContainer>
|| newEntity.hasDatatype() ^ oldEntity.hasDatatype()) { || newEntity.hasDatatype() ^ oldEntity.hasDatatype()) {
needPermissions.add(EntityPermission.UPDATE_DATA_TYPE); needPermissions.add(EntityPermission.UPDATE_DATA_TYPE);
updatetable = true; updatetable = true;
} else {
newEntity.setDatatypeOverride(oldEntity.isDatatypeOverride());
} }
// entity role // entity role
if (newEntity.hasRole() if (!(newEntity instanceof Property && oldEntity instanceof Property)
&& newEntity.hasRole()
&& oldEntity.hasRole() && oldEntity.hasRole()
&& !newEntity.getRole().equals(oldEntity.getRole()) && !newEntity.getRole().equals(oldEntity.getRole())
|| newEntity.hasRole() ^ oldEntity.hasRole()) { || newEntity.hasRole() ^ oldEntity.hasRole()) {
if (!(newEntity instanceof Property && oldEntity instanceof Property)) {
needPermissions.add(EntityPermission.UPDATE_ROLE); needPermissions.add(EntityPermission.UPDATE_ROLE);
}
updatetable = true; updatetable = true;
} }
...@@ -417,7 +418,7 @@ public class WriteTransaction extends Transaction<WritableContainer> ...@@ -417,7 +418,7 @@ public class WriteTransaction extends Transaction<WritableContainer>
try { try {
newEntity.parseValue(); newEntity.parseValue();
oldEntity.parseValue(); oldEntity.parseValue();
} catch (Message m) { } catch (NullPointerException|Message m) {
// ignore, parsing is handled elsewhere // ignore, parsing is handled elsewhere
} }
if (!newEntity.getValue().equals(oldEntity.getValue())) { if (!newEntity.getValue().equals(oldEntity.getValue())) {
...@@ -436,6 +437,8 @@ public class WriteTransaction extends Transaction<WritableContainer> ...@@ -436,6 +437,8 @@ public class WriteTransaction extends Transaction<WritableContainer>
|| newEntity.hasName() ^ oldEntity.hasName()) { || newEntity.hasName() ^ oldEntity.hasName()) {
needPermissions.add(EntityPermission.UPDATE_NAME); needPermissions.add(EntityPermission.UPDATE_NAME);
updatetable = true; updatetable = true;
} else {
newEntity.setNameOverride(oldEntity.isNameOverride());
} }
// entity description // entity description
...@@ -445,6 +448,8 @@ public class WriteTransaction extends Transaction<WritableContainer> ...@@ -445,6 +448,8 @@ public class WriteTransaction extends Transaction<WritableContainer>
|| newEntity.hasDescription() ^ oldEntity.hasDescription()) { || newEntity.hasDescription() ^ oldEntity.hasDescription()) {
needPermissions.add(EntityPermission.UPDATE_DESCRIPTION); needPermissions.add(EntityPermission.UPDATE_DESCRIPTION);
updatetable = true; updatetable = true;
} else {
newEntity.setDescOverride(oldEntity.isDescOverride());
} }
// file properties // file properties
......
...@@ -276,7 +276,7 @@ public class UpdateTest { ...@@ -276,7 +276,7 @@ public class UpdateTest {
newEntity.setDescription("New description."); newEntity.setDescription("New description.");
new WriteTransaction(null).deriveUpdate(newEntity, oldEntity); new WriteTransaction(null).deriveUpdate(newEntity, oldEntity);
// check if newEntity's Property is QUALIFIED. // check if newEntity's Property VALID.
assertEquals(QUALIFIED, newEntity.getProperties().get(0).getEntityStatus()); assertEquals(VALID, newEntity.getProperties().get(0).getEntityStatus());
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment