From 0edaf31008e979f9fd269769d9bf5095baaf1cfc Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Thu, 13 Jul 2023 10:03:23 -0700 Subject: [PATCH 1/3] realigns capabilities checks for single user group removal/assignment with bulk removal/assignment checks. --- .../learner-group/cohort-user-manager.hbs | 40 +++++++++---------- app/components/learner-group/user-manager.hbs | 40 +++++++++---------- 2 files changed, 38 insertions(+), 42 deletions(-) diff --git a/app/components/learner-group/cohort-user-manager.hbs b/app/components/learner-group/cohort-user-manager.hbs index 41a4a1e38e..7612b2f5a3 100644 --- a/app/components/learner-group/cohort-user-manager.hbs +++ b/app/components/learner-group/cohort-user-manager.hbs @@ -114,27 +114,25 @@ {{/if}} - {{#if user.enabled}} - {{#if (includes user this.usersBeingMoved)}} - - {{else if (and @canUpdate (eq this.selectedUsers.length 0))}} - - {{/if}} + {{#if (includes user this.usersBeingMoved)}} + + {{else if (and @canUpdate (or user.enabled this.currentUser.isRoot) (eq this.selectedUsers.length 0))}} + {{/if}} diff --git a/app/components/learner-group/user-manager.hbs b/app/components/learner-group/user-manager.hbs index ef10623a0c..86d17a00bd 100644 --- a/app/components/learner-group/user-manager.hbs +++ b/app/components/learner-group/user-manager.hbs @@ -127,8 +127,8 @@ {{#if (includes user.content this.usersBeingRemovedFromGroup)}} - {{else if user.enabled}} - {{#if (eq this.selectedGroupUsers.length 0)}} + {{else}} + {{#if (and (or user.enabled this.currentUser.isRoot) (eq this.selectedGroupUsers.length 0))}} - {{/if}} + {{else if (and (or user.enabled this.currentUser.isRoot) (eq this.selectedNonGroupUsers.length 0))}} + {{/if}} From 1e639417de9311be00a0d87ff2039b712d64e698 Mon Sep 17 00:00:00 2001 From: Stefan Topfstedt Date: Fri, 14 Jul 2023 10:05:21 -0700 Subject: [PATCH 2/3] rm unnecessary check on whether the current user is root or not. since this check where always paired with a perms check on the given learner-group, which is always positive if the current user is root, we can safely remove it. --- .../learner-group/cohort-user-manager.hbs | 10 +++++----- app/components/learner-group/user-manager.hbs | 20 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/components/learner-group/cohort-user-manager.hbs b/app/components/learner-group/cohort-user-manager.hbs index 7612b2f5a3..fbe1d54301 100644 --- a/app/components/learner-group/cohort-user-manager.hbs +++ b/app/components/learner-group/cohort-user-manager.hbs @@ -57,7 +57,7 @@ {{#each (sort-by @sortBy this.filteredUsers) as |user index|}} - {{#if (and @canUpdate (or user.enabled this.currentUser.isRoot))}} + {{#if (and @canUpdate user.enabled)}} - {{#if (and @canUpdate (or user.enabled this.currentUser.isRoot))}} + {{#if (and @canUpdate user.enabled)}} - {{else}} + - {{#if user.enabled}} - - {{else}} + - {{#if user.enabled}} - - {{else}} + {{else}} - {{#if (and user.enabled (eq this.selectedGroupUsers.length 0))}} + {{#if (eq this.selectedGroupUsers.length 0)}} - {{else}} + - {{#if user.enabled}} - - {{else}} + - {{#if user.enabled}} - - {{else}} + {{#if (includes user.content this.usersBeingAddedToGroup)}} - {{else if (and user.enabled (eq this.selectedNonGroupUsers.length 0))}} + {{else if (eq this.selectedNonGroupUsers.length 0)}}