Skip to content
Snippets Groups Projects
Verified Commit a59372da authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Merge branch 'dev' into f-220

parents ced4a940 ebe369fc
No related branches found
No related tags found
2 merge requests!58REL: prepare release 0.7.2,!57F 220
...@@ -31,8 +31,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -31,8 +31,12 @@ 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#220](https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/220) * [caosdb-server#220](https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/220)
Entities can be retrieved via GRPC despite insufficient permissions. Entities can be retrieved via GRPC despite insufficient permissions.
* [caosdb-server#221](https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/221)
Unknown error during update of property leaving out datatype.
* [caosdb-server#223](https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/223) * [caosdb-server#223](https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/223)
State is being leaked even though RETRIEVE:ENTITY permission is not granted. State is being leaked even though RETRIEVE:ENTITY permission is not granted.
......
...@@ -370,6 +370,8 @@ public class WriteTransaction extends Transaction<WritableContainer> ...@@ -370,6 +370,8 @@ public class WriteTransaction extends Transaction<WritableContainer>
final HashSet<Permission> needPermissions = new HashSet<>(); final HashSet<Permission> needPermissions = new HashSet<>();
boolean updatetable = false; boolean updatetable = false;
// @review Florian Spreckelsen 2022-03-15
// new acl? // new acl?
if (newEntity.hasEntityACL() && !newEntity.getEntityACL().equals(oldEntity.getEntityACL())) { if (newEntity.hasEntityACL() && !newEntity.getEntityACL().equals(oldEntity.getEntityACL())) {
oldEntity.checkPermission(EntityPermission.EDIT_ACL); oldEntity.checkPermission(EntityPermission.EDIT_ACL);
...@@ -399,16 +401,17 @@ public class WriteTransaction extends Transaction<WritableContainer> ...@@ -399,16 +401,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 +420,7 @@ public class WriteTransaction extends Transaction<WritableContainer> ...@@ -417,7 +420,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 +439,8 @@ public class WriteTransaction extends Transaction<WritableContainer> ...@@ -436,6 +439,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 +450,8 @@ public class WriteTransaction extends Transaction<WritableContainer> ...@@ -445,6 +450,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
......
...@@ -260,6 +260,7 @@ public class UpdateTest { ...@@ -260,6 +260,7 @@ public class UpdateTest {
@Test @Test
public void testDeriveUpdate_UpdateList() public void testDeriveUpdate_UpdateList()
throws NoSuchAlgorithmException, CaosDBException, IOException { throws NoSuchAlgorithmException, CaosDBException, IOException {
// @review Florian Spreckelsen 2022-03-15
final Property oldProperty = new Property(1); final Property oldProperty = new Property(1);
final Property newProperty = new Property(1); final Property newProperty = new Property(1);
oldProperty.setDatatype("List<Person>"); oldProperty.setDatatype("List<Person>");
...@@ -276,7 +277,7 @@ public class UpdateTest { ...@@ -276,7 +277,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