Fix vaious issues with organizations

This commit is contained in:
George Kalampokis 2021-04-30 14:45:00 +03:00
parent a8f75aafb9
commit fe8a0ff109
2 changed files with 2 additions and 2 deletions

View File

@ -64,7 +64,7 @@ public class OrganisationDaoImpl extends DatabaseAccess<Organisation> implements
} }
public QueryableList<Organisation> getAuthenticated(QueryableList<Organisation> query, UserInfo principal) { public QueryableList<Organisation> getAuthenticated(QueryableList<Organisation> query, UserInfo principal) {
query.where((builder, root) -> builder.equal(root.join("dmps").get("creator"), principal)); query.where((builder, root) -> builder.equal(root.join("dmps").join("users").get("user"), principal));
return query; return query;
} }

View File

@ -81,7 +81,7 @@ public class Organisation implements DataModel<eu.eudat.data.entities.Organisati
public eu.eudat.data.entities.Organisation toDataModel() { public eu.eudat.data.entities.Organisation toDataModel() {
eu.eudat.data.entities.Organisation organisationEntity = new eu.eudat.data.entities.Organisation(); eu.eudat.data.entities.Organisation organisationEntity = new eu.eudat.data.entities.Organisation();
if (this.key != null && this.reference != null) { if (this.key != null && this.reference != null) {
if ((this.key + ":").equals(this.reference.substring(0, this.key.length() + 1))) { if (this.reference.startsWith(this.key + ":")) {
organisationEntity.setReference(this.reference); organisationEntity.setReference(this.reference);
} else { } else {
organisationEntity.setReference(this.key + ":" + this.reference); organisationEntity.setReference(this.key + ":" + this.reference);