From 004c54a1739205087f4edd17f56580eb2aa62fdf Mon Sep 17 00:00:00 2001 From: anhefti Date: Thu, 21 Jan 2021 15:04:31 +0100 Subject: [PATCH] SEBSERV-142 fixes --- .../gui/content/UserAccountDeletePopup.java | 26 ++++++++++--------- .../gui/content/UserAccountForm.java | 2 +- .../impl/AuthorizationServiceImpl.java | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountDeletePopup.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountDeletePopup.java index bce41a18..56853ab9 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountDeletePopup.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountDeletePopup.java @@ -286,18 +286,20 @@ public class UserAccountDeletePopup { final Form form = formHandle.getForm(); - form.getFieldInput(ARG_ALL_DEPENDENCIES) - .addListener(SWT.Selection, event -> { - if (Constants.TRUE_STRING.equals(form.getFieldValue(ARG_ALL_DEPENDENCIES))) { - form.setFieldValue(ARG_EXAMS_AND_DEPENDENCIES, Constants.FALSE_STRING); - } - }); - form.getFieldInput(ARG_EXAMS_AND_DEPENDENCIES) - .addListener(SWT.Selection, event -> { - if (Constants.TRUE_STRING.equals(form.getFieldValue(ARG_EXAMS_AND_DEPENDENCIES))) { - form.setFieldValue(ARG_ALL_DEPENDENCIES, Constants.FALSE_STRING); - } - }); + if (showDeps) { + form.getFieldInput(ARG_ALL_DEPENDENCIES) + .addListener(SWT.Selection, event -> { + if (Constants.TRUE_STRING.equals(form.getFieldValue(ARG_ALL_DEPENDENCIES))) { + form.setFieldValue(ARG_EXAMS_AND_DEPENDENCIES, Constants.FALSE_STRING); + } + }); + form.getFieldInput(ARG_EXAMS_AND_DEPENDENCIES) + .addListener(SWT.Selection, event -> { + if (Constants.TRUE_STRING.equals(form.getFieldValue(ARG_EXAMS_AND_DEPENDENCIES))) { + form.setFieldValue(ARG_ALL_DEPENDENCIES, Constants.FALSE_STRING); + } + }); + } return () -> pageContext .withAttribute(ARG_ALL_DEPENDENCIES, form.getFieldValue(ARG_ALL_DEPENDENCIES)) diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountForm.java index c8706cd9..17a1857c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/UserAccountForm.java @@ -271,7 +271,7 @@ public class UserAccountForm implements TemplateComposer { .newAction(ActionDefinition.USER_ACCOUNT_DELETE) .withEntityKey(entityKey) .withExec(this.userAccountDeletePopup.deleteWizardFunction(pageContext)) - .publishIf(() -> (writeGrant || ownAccount) && readonly && institutionActive) + .publishIf(() -> writeGrant && readonly && institutionActive) .newAction(ActionDefinition.USER_ACCOUNT_SAVE) .withEntityKey(entityKey) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/AuthorizationServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/AuthorizationServiceImpl.java index 6dae3b3b..2d82592c 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/AuthorizationServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/authorization/impl/AuthorizationServiceImpl.java @@ -77,7 +77,7 @@ public class AuthorizationServiceImpl implements AuthorizationService { .withInstitutionalPrivilege(PrivilegeType.READ) .withOwnerPrivilege(PrivilegeType.MODIFY) .andForRole(UserRole.EXAM_SUPPORTER) - .withOwnerPrivilege(PrivilegeType.WRITE) + .withOwnerPrivilege(PrivilegeType.MODIFY) .create(); // grants for seb client config