Skip to content
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

Build institutional user lists for institutional managers on open source networks #42

Open
SteelWagstaff opened this issue Feb 14, 2024 · 11 comments
Assignees

Comments

@SteelWagstaff
Copy link
Member

SteelWagstaff commented Feb 14, 2024

As an institutional manager on a self-hosted open source PB network (i.e. one without pressbooks-network-analytics), I should see a user list with information specific to my institution, instead of the full network user list.

See https://www.figma.com/file/hAvkPJpDgJDDyh8g358AqR/PB-Site-Adjustments?type=design&node-id=34-10298&mode=design&t=6NpK2f6ILNHepftM-0

This should look like the current user list, but with a new column called 'Institution'. As an institutional manager, I should only be presented with the users assigned to my institution. If I try to view the full network user list, I should see a 'you don't have permissions to do this' style message.

DoD:

  1. The default user list should have a new 'institution' column that displays when this plugin is active for all users
  2. When an institutional manager loads the user list, the list should only display information that is relevant to their institution
  3. Institutional managers should be able to use the search feature of the existing user list without special restrictions. Bulk actions should only affect users in their user list.
  4. Hide the super admins link on this list when the user is an institutional manager
  5. Change the link for both the book title and the edit links in the default users list so that they point to the book dashboard BOOKTITLE/wp-admin rather than wp-admin/network/site-info.php?id=765
    Screenshot from 2024-02-14 15-41-04
@SteelWagstaff SteelWagstaff changed the title Build institutional user lists for open source users Build institutional user lists for institutional managers on open source networks Feb 14, 2024
@richard015ar richard015ar self-assigned this Apr 17, 2024
@richard015ar
Copy link
Contributor

I got a WIP PR: #159
Pending: add tests

@richard015ar
Copy link
Contributor

@tw77 I got a PR with a working solution for this. I pushed it to ricardodev so you could do some early testing if you are willing to.
An example of a testing case is described at #159

@richard015ar
Copy link
Contributor

richard015ar commented Apr 18, 2024

@MichelleWeremczuk please, feel free to provide feedback as needed in https://ricardodev.pressbooks.network about this feature. Example of testing case described in #159.

@MichelleWeremczuk
Copy link

Everything seems to be working as expected except for one thing:

    1. Change the link for both the book title and the edit links in the default users list so that they point to the book dashboard BOOKTITLE/wp-admin rather than wp-admin/network/site-info.php?id=765

I recognize that I might not have something set up properly on my system, or I might be looking at the wrong thing.

@richard015ar
Copy link
Contributor

@MichelleWeremczuk good catch! it is in the last item. I'll work on it

@richard015ar
Copy link
Contributor

richard015ar commented Apr 18, 2024

WP does not provide an easy way to change/edit an existing column from the user list, despite it does for custom columns like institutions. We have the manage_users_custom_column hook to change/add values to custom columns, but this is only for the newly added columns.

An option I can see today is to override the WP_List_Table class for users, something like:

class wpUserListTable extends WP_Users_List_Table {
    // Override the column method for the blogs column
    function column_blogs( $item ) {
        return str_replace($item, ...); // replace links here
    }
}

I do not like this approach because it would require to do some tricky things like:

add_action('load-users.php', function() {
    $GLOBALS['wp_list_table'] = new wpUserListTable;
});

since WP does not provide a hook or something to override it.

I need to find a better way to make this column change.

@tw77
Copy link

tw77 commented Apr 18, 2024

@richard015ar aside from the item Michelle pointed out, the only other issue I notice so far in early testing is that as an institutional manager, I'm not able to add a new user to the network from https://ricardodev.pressbooks.network/wp/wp-admin/network/user-new.php, which the 'Add New User' button in the user list links to

Screenshot 2024-04-18 at 12 34 35 PM Screenshot 2024-04-18 at 12 37 33 PM

@richard015ar
Copy link
Contributor

It seems to be a pre-existing bug. In addition, as an IM I cannot add users either through the Add User button at the top bar on dev.pressbooks.network.

I'll work on both cases in the same PR.

@richard015ar
Copy link
Contributor

On the topic of modifying the blogs column of WP_Users_List_Table, another alternative I will explore is to completely remove the column through wpmu_users_columns which is being used for adding the institutions' column in my branch and add in the same method a new custom column called books.
Later on, I can use the manage_users_custom_column hook already used to add the institution values to add the books value.

I will try it on.

@richard015ar
Copy link
Contributor

richard015ar commented Apr 22, 2024

Another bug found is when the H5P Plugin is active at the root site level, the menu item is displayed for IMs during root site pages navigation. We should remove it.

@richard015ar
Copy link
Contributor

I was able to:

Pending to fix:

  • I cannot access to the books' dashboard, for some reason the permissions are revoked.
  • I cannot bulk add users using the top bar menu button "+ Add Users".

Although we estimated this task as a 5, I consider I already spent 5 story points working on this.
We decided to move this task to future sprints, so I will consider in our metrics that we spent 5 points, but I will estimate the remaining effort needed to be 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants