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
No related branches found
No related tags found
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
* [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
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
......
......@@ -399,16 +399,17 @@ public class WriteTransaction extends Transaction<WritableContainer>
|| newEntity.hasDatatype() ^ oldEntity.hasDatatype()) {
needPermissions.add(EntityPermission.UPDATE_DATA_TYPE);
updatetable = true;
} else {
newEntity.setDatatypeOverride(oldEntity.isDatatypeOverride());
}
// entity role
if (newEntity.hasRole()
if (!(newEntity instanceof Property && oldEntity instanceof Property)
&& newEntity.hasRole()
&& oldEntity.hasRole()
&& !newEntity.getRole().equals(oldEntity.getRole())
|| newEntity.hasRole() ^ oldEntity.hasRole()) {
if (!(newEntity instanceof Property && oldEntity instanceof Property)) {
needPermissions.add(EntityPermission.UPDATE_ROLE);
}
needPermissions.add(EntityPermission.UPDATE_ROLE);
updatetable = true;
}
......@@ -417,7 +418,7 @@ public class WriteTransaction extends Transaction<WritableContainer>
try {
newEntity.parseValue();
oldEntity.parseValue();
} catch (Message m) {
} catch (NullPointerException|Message m) {
// ignore, parsing is handled elsewhere
}
if (!newEntity.getValue().equals(oldEntity.getValue())) {
......@@ -436,6 +437,8 @@ public class WriteTransaction extends Transaction<WritableContainer>
|| newEntity.hasName() ^ oldEntity.hasName()) {
needPermissions.add(EntityPermission.UPDATE_NAME);
updatetable = true;
} else {
newEntity.setNameOverride(oldEntity.isNameOverride());
}
// entity description
......@@ -445,6 +448,8 @@ public class WriteTransaction extends Transaction<WritableContainer>
|| newEntity.hasDescription() ^ oldEntity.hasDescription()) {
needPermissions.add(EntityPermission.UPDATE_DESCRIPTION);
updatetable = true;
} else {
newEntity.setDescOverride(oldEntity.isDescOverride());
}
// file properties
......
......@@ -276,7 +276,7 @@ public class UpdateTest {
newEntity.setDescription("New description.");
new WriteTransaction(null).deriveUpdate(newEntity, oldEntity);
// check if newEntity's Property is QUALIFIED.
assertEquals(QUALIFIED, newEntity.getProperties().get(0).getEntityStatus());
// check if newEntity's Property VALID.
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