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

Role Management #2705

Merged
merged 27 commits into from
Jan 22, 2018
Merged

Role Management #2705

merged 27 commits into from
Jan 22, 2018

Conversation

di
Copy link
Member

@di di commented Dec 26, 2017

Fixes #2654, fixes #956.

This adds the ability for a project Owner to add/remove roles for their projects.

This adds two new logged-in views:

  • "Manage Profile" page (just stubbed out with some profile info for now)
  • "Manage Projects" page (lists the logged in user's projects)

For individual projects, there are two logged-in views per project:

  • "Options" page (just stubbed out w/ some project info)
  • "Collaboration" page (this is where role management lives)

@nlhkabu Please feel free to reorganize/restyle as much as you want -- I just did the bare minimum to get this feature functional (especially, please revert 1d9704e).

@di di force-pushed the role-management branch 2 times, most recently from c12177f to 1d9704e Compare December 26, 2017 21:04
@di di requested a review from ewdurbin January 2, 2018 14:55
@nlhkabu
Copy link
Contributor

nlhkabu commented Jan 8, 2018

Hi @di. I've just pushed some (fairly large) changes to the styles and the way that the manager login works.

If it's ok with you, I'll keep working on this branch to continue this work, as it's not there yet.

The main thing I currently need your help with is changing the way that the roles form works. My new design looks like this:

screenshot from 2018-01-08 18-19-02

The added feature is that a user can change the role for an existing collaborator, rather than having to remove and then re-add them.

Is it possible to add some new form code to enable this functionality?

It would also be really awesome if we could make the 'username' text input searchable - the way GitHub does it:

screenshot from 2018-01-08 18-15-53

I realise this second request is fairly large, so I'm happy to open a separate issue for this if you prefer :)

@di
Copy link
Member Author

di commented Jan 8, 2018

@nlhkabu The reason the form was like that originally is because it's technically possible (right now, on legacy-pypi) for a user to have both the "Maintainer" and "Owner" role -- they are not mutually exclusive.

I don't see any reason why a user would need to have both roles (since all the privileges a Maintainer has, an Owner also has) but since it's possible that we have users right now with both, I wanted this to be able to render correctly when that's the case.

I think we could possibly add some logic in here that hides the "Maintainer" role if the "Owner" role also exists for that user. Presumably when we shut down legacy-pypi, we could run a migration that removes any "duplicate" roles so we won't need that logic forever.

It would also be really awesome if we could make the 'username' text input searchable - the way GitHub does it:

I agree, that would be awesome, and I think it's doable. But we should probably save that for post-launch work since it's not critical.

<p class="package-description">{{ release.summary }}</p>
{% endif %}
<!-- todo: if logged in user can edit package -->
<a href="{{ request.route_path('manage.project.settings', name=project.normalized_name) }}" class="button button--highlight">Edit Project</a>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we really want an edit link on this page, we'll need to do a client-side include so the page doesn't require the use of a session (mostly adding this as a note to myself)

@dstufft
Copy link
Member

dstufft commented Jan 8, 2018

I think we could possibly add some logic in here that hides the "Maintainer" role if the "Owner" role also exists for that user. Presumably when we shut down legacy-pypi, we could run a migration that removes any "duplicate" roles so we won't need that logic forever.

I think doing this makes a lot of sense, I don't think it makes much sense at all for someone to be both an owner and a maintainer.

@di
Copy link
Member Author

di commented Jan 8, 2018

OK, I created #2745 to capture what will need done once legacy is shut down.

I'll rework the form in this PR to handle these duplicate roles once @nlhkabu is ready to hand it back to me.

@nlhkabu
Copy link
Contributor

nlhkabu commented Jan 8, 2018

I think we could possibly add some logic in here that hides the "Maintainer" role if the "Owner" role also exists for that user. Presumably when we shut down legacy-pypi, we could run a migration that removes any "duplicate" roles so we won't need that logic forever.

This would be great. I absolutely agree - it makes no sense that someone should be able to have both roles... so if we can find a way of hiding this in the UI, that would be ideal.

I agree, that would be awesome, and I think it's doable. But we should probably save that for post-launch work since it's not critical.

Great! :D I'll open a ticket.

@di di mentioned this pull request Jan 8, 2018
@di di force-pushed the role-management branch from 7bbcde0 to ea20d1a Compare January 13, 2018 00:39
@di
Copy link
Member Author

di commented Jan 13, 2018

@nlhkabu OK, I've made the select boxes functional now, and hidden any "duplicate" roles. I just realized that I still need to add JournalEntry additions for all these views, so I still have some work to do, but that won't affect anything on the UI end of things.

@di di force-pushed the role-management branch from ea20d1a to f1845c3 Compare January 15, 2018 19:37
@di di requested a review from dstufft January 15, 2018 19:38
@nlhkabu
Copy link
Contributor

nlhkabu commented Jan 17, 2018

hi @di - the role form is working well - thank you :)

One small request - are we able to order the collaborators by when they were added to the project?

In this example, I used Ernest's login - and then added Donald to the project. What was weird was that Donald wasn't added to the bottom of the list - but at the top above Ernest.

screenshot from 2018-01-17 06-52-24

What do you think?

Also, FYI, I have added quite a lot of UI stuff to this branch that needs more work:

Overall UI

screenshot from 2018-01-17 06-56-35

Project Options

screenshot from 2018-01-17 06-56-39

Deleting a Project

screenshot from 2018-01-17 06-56-47

Release options

screenshot from 2018-01-17 06-57-12

Deleting a release

screenshot from 2018-01-17 06-57-18

Overall the TODO list is:

  1. Add a documentation page for the documentation tab - cc @ewdurbin
  2. Make the delete project modal do something - fix 'show password' checkbox
  3. Make the delete release modal do something - fix 'show password' checkbox (also, remove repetition in template if possible)
  4. Add text instructions for making a new release
  5. Add a 'release detail' page (which will show the release files and journal). Link to it from the releases page
  6. Add help text on how to update a project (on the help page)
  7. Make the UI work better on mobile

Are we happy to merge this PR with dummy UI and make separate PRs for each of these issues?

Copy link
Member

@ewdurbin ewdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall Looks sound.

Couple things I'd like to see:

  • TODO: strings in comments for temporary workarounds/etc. I see GitHub issues are filed, but it can be nice to just grep the codebase for a quick glance as well.
  • Route namespacing for /manage views, basically anything that is user editable should probably fall under that top level path.

Looking really good and I think we can get this out to keep making progress. Some functionality I note that it is missing (but obviously does not strictly fall into role management):

  • Change Password. We have Password Resets in flight on another PR, but it seems prudent to allow a user to change their password without rolling over into their inbox
  • Change Email Address. We currently allow this, and it's important to keep this self service.

factory="warehouse.accounts.models:UserFactory",
traverse="/{username}",
"manage.project.settings",
"/project/{name}/settings/",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this and the following three routes be namespaces under /manage?

it feels valid to me to keep all "edit" activity under a single top level path.

perceived advantages:

  • easier to spot/search in logs
  • easier to manage routing/caching/etc in the layers above warehouse

@di di force-pushed the role-management branch from 0d54f55 to f7eab74 Compare January 17, 2018 16:52
@di
Copy link
Member Author

di commented Jan 17, 2018

@nlhkabu @ewdurbin responses to both of you below:

One small request - are we able to order the collaborators by when they were added to the project?

Currently we don't have the "date created" for any existing roles. We can certainly add it, but I'm not really sure what the ordering would look like when some roles have a timestamp and others don't, and anything we choose would probably be pretty confusing to the user without indicating why the sorting is the way it is.

Currently it's alphabetical based on username, which I think is ideal for finding a given user in a long list of collaborators.

Also, FYI, I have added quite a lot of UI stuff to this branch that needs more work:

I'd like to keep this PR just focused on role management as much as we can. Perhaps we can feature-flag or comment out anything in the UI that is not actually working and re-enable it when we go to ship those issues?

Are we happy to merge this PR with dummy UI and make separate PRs for each of these issues?

I don't want to merge this with UI components that don't work, I think that there's a strong chance that they'll be around for a significant amount of time and confuse users.

Couple things I'd like to see:

Added TODOs to the GH-2745 comments and namespaced all the "manage" routes.

Looking really good and I think we can get this out to keep making progress. Some functionality I note that it is missing (but obviously does not strictly fall into role management):

These are captured in #423 and should probably be a part of a separate PR which fully addresses that issue.

@ewdurbin ewdurbin self-requested a review January 17, 2018 17:25
Copy link
Member

@ewdurbin ewdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming a decision on UI components is fleshed out, I'm good with the state here.

One note on sorting of collaborators, at the very least sorting by Owner, Maintainer and then alphabetical by name might make it a bit easier to consume a larger list of collaborators.

@nlhkabu
Copy link
Contributor

nlhkabu commented Jan 18, 2018

thanks @di and @ewdurbin :D

I've opened tickets for each of the missing UI components and commented them out (adding TODOs linking to the tickets) - so on my side, we're good to go.

I agree with Ernest - maybe listing the owners first is better? I don't see it as a blocker though - let's merge this PR and open a separate ticket for this?

di and others added 8 commits January 18, 2018 11:45
Before, these were always UUID objects, but since #1329 this is stored
as a string for session-based authentication only. To keep everything
consistent, always use strings over UUID objects.
This gives the logged in user a place to manage their profile, and a
place to manage their projects. Mostly stubbed out for now.
This no longer needs to be a client-side include because we can just
edit it via profile management when the user is logged in.
Adding and deleting roles
@di di force-pushed the role-management branch from 730d1c2 to 60d1144 Compare January 18, 2018 18:12
@di
Copy link
Member Author

di commented Jan 18, 2018

Thanks for creating all those sub-issues @nlhkabu!

I've resolved the merge conflicts and fixed two small things.

As far as role management goes I think this is good to go, however I'd like to resolve the outstanding UI decisions in #2734 before this is merged.

@di di merged commit d4bbca0 into master Jan 22, 2018
@di di deleted the role-management branch January 22, 2018 15:53
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

Successfully merging this pull request may close these issues.

Role maintenance for package owners [Feature Request] UI for adding maintainers
4 participants