fix reference query

This commit is contained in:
Efstratios Giannopoulos 2024-06-18 12:22:11 +03:00
parent 810e249a61
commit ef31da52f3
4 changed files with 13 additions and 6 deletions

View File

@ -131,6 +131,7 @@ public final class Permission {
//Reference //Reference
public static String BrowseReference = "BrowseReference"; public static String BrowseReference = "BrowseReference";
public static String BrowseExternalReference = "BrowseExternalReference";
public static String EditReference = "EditReference"; public static String EditReference = "EditReference";
public static String DeleteReference = "DeleteReference"; public static String DeleteReference = "DeleteReference";

View File

@ -11,7 +11,7 @@ public class AdditionalInfoEntity {
private UUID organizationId; private UUID organizationId;
public String getAvatarUrl() { public String getAvatarUrl() {
return avatarUrl; return this.avatarUrl;
} }
public void setAvatarUrl(String avatarUrl) { public void setAvatarUrl(String avatarUrl) {
@ -19,7 +19,7 @@ public class AdditionalInfoEntity {
} }
public String getTimezone() { public String getTimezone() {
return timezone; return this.timezone;
} }
public void setTimezone(String timezone) { public void setTimezone(String timezone) {
@ -27,7 +27,7 @@ public class AdditionalInfoEntity {
} }
public String getCulture() { public String getCulture() {
return culture; return this.culture;
} }
public void setCulture(String culture) { public void setCulture(String culture) {
@ -35,7 +35,7 @@ public class AdditionalInfoEntity {
} }
public String getLanguage() { public String getLanguage() {
return language; return this.language;
} }
public void setLanguage(String language) { public void setLanguage(String language) {
@ -43,7 +43,7 @@ public class AdditionalInfoEntity {
} }
public UUID getOrganizationId() { public UUID getOrganizationId() {
return organizationId; return this.organizationId;
} }
public void setOrganizationId(UUID organizationId) { public void setOrganizationId(UUID organizationId) {
@ -51,7 +51,7 @@ public class AdditionalInfoEntity {
} }
public String getRoleOrganization() { public String getRoleOrganization() {
return roleOrganization; return this.roleOrganization;
} }
public void setRoleOrganization(String roleOrganization) { public void setRoleOrganization(String roleOrganization) {

View File

@ -232,6 +232,7 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
List<Predicate> predicates = new ArrayList<>(); List<Predicate> predicates = new ArrayList<>();
if (userId != null || usePublic) { if (userId != null || usePublic) {
predicates.add(queryContext.CriteriaBuilder.or( predicates.add(queryContext.CriteriaBuilder.or(
this.authService.authorize(Permission.BrowseExternalReference) ? queryContext.CriteriaBuilder.equal(queryContext.Root.get(ReferenceEntity._sourceType), ReferenceSourceType.External) : queryContext.CriteriaBuilder.or(),
userId != null ? queryContext.CriteriaBuilder.equal(queryContext.Root.get(ReferenceEntity._createdById), userId) : queryContext.CriteriaBuilder.or(), //Creates a false query userId != null ? queryContext.CriteriaBuilder.equal(queryContext.Root.get(ReferenceEntity._createdById), userId) : queryContext.CriteriaBuilder.or(), //Creates a false query
queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._id)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DmpReferenceEntity.class, UUID.class) queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._id)).value(this.queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DmpReferenceEntity.class, UUID.class)
.query(queryContext.Query) .query(queryContext.Query)

View File

@ -677,6 +677,11 @@ permissions:
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
BrowseExternalReference:
roles: [ ]
clients: [ ]
allowAnonymous: false
allowAuthenticated: true
EditReference: EditReference:
roles: roles:
- Admin - Admin