-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add institution info for network/users.php page #159
base: dev
Are you sure you want to change the base?
Conversation
@@ -65,7 +65,7 @@ public function handlePagesPermissions($institution, $institutionalManagers, $in | |||
*/ | |||
|
|||
add_filter('can_edit_network', function ($canEdit) use ($allowedBooks) { | |||
if (is_network_admin() && !in_array($_REQUEST['id'], $allowedBooks)) { | |||
if (is_network_admin() && isset($_REQUEST['id']) && !in_array($_REQUEST['id'], $allowedBooks)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got PHP Warning: Undefined array key "id" in /app/web/app/plugins/pressbooks-multi-institution/src/Services/PermissionsManager.php on line 68
when going to user.php (standard list) as an IM.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## dev #159 +/- ##
============================================
- Coverage 82.63% 82.58% -0.05%
- Complexity 289 307 +18
============================================
Files 32 33 +1
Lines 1589 1642 +53
============================================
+ Hits 1313 1356 +43
- Misses 276 286 +10 |
@@ -188,8 +188,10 @@ private function currentUserHasAccess(string $currentPageParam, array $allowedBo | |||
$institutionalUsers = apply_filters('pb_institutional_users', []); | |||
|
|||
if ($currentPageParam === 'pb_network_analytics_userlist' || $pagenow === 'users.php' || $pagenow === 'user-edit.php') { | |||
if (isset($_REQUEST['user_id']) && in_array($_REQUEST['user_id'], $institutionalUsers)) { | |||
$isAccessAllowed = true; | |||
$isAccessAllowed = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can go to users.php
list without having any $_REQUEST value as it has in edit/delete actions. In that case, we want to allow it.
Issue: #42
This PR modifies the WP network user list in order to add an "Institution" sortable column with the institution name. If the user displayed in the list does not belong to any institution, it displays
Unnasigned
text.Testing case
Institution
column is displayed after theEmail
one with the correct value.Institution
column and make sure the ordering is correct.<NETWORK_URL>/network/user-edit.php?user_id=<USER_ID_FROM_OTHER_INSTITUTION>
. You should not be allowed to do that.Super Admin
filter at the top of the table is not available.