From b0ce72b7a7733eea9510c2508e18f7eb47cbe1b9 Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Mon, 30 Oct 2023 11:58:41 +0100 Subject: [PATCH] refact: variable renamings --- .../generators/ManageLabelsForPersonGenerator.java | 4 ++-- .../freemarker/CreateAndLinkResourceController.java | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForPersonGenerator.java b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForPersonGenerator.java index 54a23b00d..e69ec98fe 100644 --- a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForPersonGenerator.java +++ b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForPersonGenerator.java @@ -334,14 +334,14 @@ public int compare(HashMap h1, HashMap h2) { private Object isEditable(VitroRequest vreq, EditConfigurationVTwo config) { Individual individual = EditConfigurationUtils.getIndividual(vreq, config.getSubjectUri()); - DataPropertyStatementAccessObject adps = new DataPropertyStatementAccessObject( + DataPropertyStatementAccessObject dpsAccessObject = new DataPropertyStatementAccessObject( vreq.getJenaOntModel(), individual.getURI(), SOME_URI, SOME_LITERAL); ObjectPropertyStatementAccessObject aops = new ObjectPropertyStatementAccessObject( vreq.getJenaOntModel(), individual.getURI(), SOME_PREDICATE, SOME_URI); - return PolicyHelper.isAuthorizedForActions(vreq, AuthorizationRequest.or(new SimpleAuthorizationRequest(adps, AccessOperation.ADD), new SimpleAuthorizationRequest(aops, AccessOperation.ADD))); + return PolicyHelper.isAuthorizedForActions(vreq, AuthorizationRequest.or(new SimpleAuthorizationRequest(dpsAccessObject, AccessOperation.ADD), new SimpleAuthorizationRequest(aops, AccessOperation.ADD))); } diff --git a/api/src/main/java/org/vivoweb/webapp/controller/freemarker/CreateAndLinkResourceController.java b/api/src/main/java/org/vivoweb/webapp/controller/freemarker/CreateAndLinkResourceController.java index f6e542649..e6c14905d 100644 --- a/api/src/main/java/org/vivoweb/webapp/controller/freemarker/CreateAndLinkResourceController.java +++ b/api/src/main/java/org/vivoweb/webapp/controller/freemarker/CreateAndLinkResourceController.java @@ -297,12 +297,13 @@ protected ResponseValues processRequest(VitroRequest vreq) { // Check that we have back end editing priveleges if (!PolicyHelper.isAuthorizedForActions(vreq, SimplePermission.DO_BACK_END_EDITING.ACTION)) { // If all else fails, can we add statements to this individual? - DataPropertyStatementAccessObject adps = new DataPropertyStatementAccessObject(vreq.getJenaOntModel(), profileUri, SOME_URI, SOME_LITERAL); - ObjectPropertyStatementAccessObject aops = new ObjectPropertyStatementAccessObject(vreq.getJenaOntModel(), profileUri, SOME_PREDICATE, SOME_URI); - if (!PolicyHelper.isAuthorizedForActions(vreq, - AuthorizationRequest.or( - new SimpleAuthorizationRequest(adps, AccessOperation.ADD), - new SimpleAuthorizationRequest(aops, AccessOperation.ADD)))) { + DataPropertyStatementAccessObject dpsAccessObject = new DataPropertyStatementAccessObject( + vreq.getJenaOntModel(), profileUri, SOME_URI, SOME_LITERAL); + ObjectPropertyStatementAccessObject opsAccessObject = new ObjectPropertyStatementAccessObject( + vreq.getJenaOntModel(), profileUri, SOME_PREDICATE, SOME_URI); + if (!PolicyHelper.isAuthorizedForActions(vreq, + AuthorizationRequest.or(new SimpleAuthorizationRequest(dpsAccessObject, AccessOperation.ADD), + new SimpleAuthorizationRequest(opsAccessObject, AccessOperation.ADD)))) { return new TemplateResponseValues("unauthorizedForProfile.ftl"); } }