Skip to content

Project Membership - #562

Closed
benjaminapetersen wants to merge 1 commit into
openshift:masterfrom
benjaminapetersen:bpeterse/membership
Closed

benjaminapetersen wants to merge 1 commit into
openshift:masterfrom
benjaminapetersen:bpeterse/membership

Conversation

@benjaminapetersen

@benjaminapetersen benjaminapetersen commented Sep 20, 2016 •

Copy link
Copy Markdown
Contributor

@ajacobs21e @jwforres @spadgett @enj

Tasks:

  • On remove, ensure a user/group/etc in two different rolebindings for the same role is removed from both rolebindings.
  • On add, if there are two rolebindings for the same role, only add to one of the rolebindings.
  • On add, check for duplicates,do not add a user/group/etc to a rolebinding if already present in the specified rolebinding
  • On delete, if all subjects are removed from the rolebinding, delete the rolebinding
  • Limit the # of roles a user can see by default, but provide checkbox to show all if desired
  • work with @enj on a end-user type of annotation to show/hide roles (for above checkbox task)
  • be sure to use the description annotation if present
  • handle both clusterRoles & local roles (namespaced)

Potential additional tasks (nice to have if they make sense):

  • Show/hide the membership menu item based on the user's ability to manage rolebindings? Future
  • Show/hide the "edit" functionality of the membership page based on the user's ability to manage rolebindings?
  • For non-admin users, it may be nice to show a list of "what can I do" for the project, since they will not be able to see the rolebindings, and showing them local roles & clusterroles that they cannot interact with is not helpful Future perhaps
  • On add, if user/group/etc is already a part of another role, can offer to update that role if it is sensible (ie, if in view and is added to admin, is not necessary for. Not currently a "weight" or ranking available via api for roles
  • create a new group, add users to group, assign group to a role? nope. cluster admin only

Prototype UI screenshots:

First view hides many of the roles to keep the picker sane:
screen shot 2016-09-20 at 10 43 09 am
Second view shows everything, it is reasonable someone will want to interact with these at some point:
screen shot 2016-09-20 at 10 43 32 am

@benjaminapetersen benjaminapetersen changed the title [WIP] Project Membership [WIP] Project Membership [CODE_NOT_READY_FOR_REVIEW] Sep 20, 2016
@liggitt

liggitt commented Sep 20, 2016 •

Copy link
Copy Markdown
Contributor

A few thoughts:

  • are we anticipating having @deads2k's addrolebindingrequest API available in origin?
  • repeating User before every subject is cluttery. Grouping by subject kind would be easier to read.
  • repeating the "x" after each one is also cluttery. I'm not sure removing access is so common we want one click access to it. Maybe a "edit" mode that reveals remove actions would be better?
  • removing the roles granted to service accounts by default will break deployments and builds in that namespace. That deserves a warning at least, and maybe more.

@jwforres

jwforres commented Sep 20, 2016 •

Copy link
Copy Markdown
Member
  • You should be using ui-select for that dropdown. Use it anytime you have a potentially unbounded list of options
  • If you are going to have something like "Show hidden roles" explain to me why they are hidden. That said, I think we should question whether we want this option at all. Is this to let more powerful admin-ish people have the extra options? This would be a VERY good question to bring up at the design review next week.
  • I should be able to remove myself from a project, with a big massive warning before it happens. If someone adds me to a project I need to be able to choose to leave that project. Arguably the warning should be different (clear that the action is more severe) if I am the only admin in the project.
  • I do not want to see the word Rolebinding in this UI
  • always humanize things like "ServiceAccount", this means splitting it into separate words, and depending on context leave every word capitalized, sentence cased, or lower cased
  • adding to @liggitt 's point about repeating User / SA everywhere, I would consider splitting those out into separate tables entirely

@enj

enj commented Sep 20, 2016 •

Copy link
Copy Markdown
  • I believe the actual role information is missing. For example:
$ oc describe policyBindings :default -n joe-project
Name:                   :default
Created:                About a minute ago
Labels:                 <none>
Last Modified:              2015-06-10 21:55:06 +0000 UTC
Policy:                 <none>
RoleBinding[admins]:
                    Role:   admin
                    Users:  [joe]
                    Groups: []
RoleBinding[system:deployers]:
                    Role:   system:deployer
                    Users:  [system:serviceaccount:joe-project:deployer]
                    Groups: []
RoleBinding[system:image-builders]:
                    Role:   system:image-builder
                    Users:  [system:serviceaccount:joe-project:builder]
                    Groups: []
RoleBinding[system:image-pullers]:
                    Role:   system:image-puller
                    Users:  []
                    Groups: [system:serviceaccounts:joe-project]

The RoleBinding[admins] is different from the Role: admin

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

Great, thx for the feedback! I prob should have said its still in prototype/ugly mode, but great feedback nonetheless. 😄

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

@liggitt @deads2k addrolebindingrequest?
@enj tells me this is an upcoming API for updating a rolebinding. That sounds good. Currently I'm manually adding to they arrays of subjects & usernames & submitting the whole rolebinding back. Seems a touch hacky?

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

Answer on the api for addrolebindingrequest seems to be "not anytime soon".

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 22, 2016
@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

Screenshot of latest iteration:

screen shot 2016-09-29 at 10 25 21 am

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

For comparison, dropping a V2 screenshot here as well:

screen shot 2016-09-29 at 10 35 05 am

@benjaminapetersen

benjaminapetersen commented Sep 29, 2016 •

Copy link
Copy Markdown
Contributor Author

Design Review feedback:
TODO:

  • layout needs a little more structure to make it easier to parse (white space to make columns). A light weight data table, not too much chrome.
  • suggest using groups if users lists get crazy? (nope, cant manage groups right now, only cluster admin can)
  • add filtering so it is easier to find subjects/roles when the lists get long
  • add a namespace input (or picker) if ServiceAccount is selected
  • consider tabs for 'user', 'group', etc? perhaps helps focus?

MAYBE:

  • API to show members of a group api

API needs: (@enj)

  • descriptions annotation on each role to help indicate what they do
  • "show in ui" annotation on rolebinding to help filter out noise
  • no way to know what roles you can currently grant (future)
  • no way to know what roles are more privileged than others (future)

FUTURE:

  • Click a role to go to a page & see what that role represents (data dump)
  • paginate api response to help deal with really long lists
  • deal w/ ability to only grant certain roles
  • show/hide menu item based on user's ability to update rolebindings

CONSIDERATIONS:

  • limit role choices that can be selected down to the options that make sense. A user with "view" only has certain policy rules. Thus, the dropdown picker should not show them roles that have policy rules they do not have themselves. Is this reasonable to impl at this point... ex: user A has [get secrets, create pods]. role A has [create foo], role B has [create pods], role C has [get secrets]. Do not show role A, but show role B&C. (oc policy can-i --list) Nice to have, very complex. maybe a future iteration.

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

Considering tabs to solve the length of page problems we discussed in the design review:
screen shot 2016-09-30 at 2 07 34 pm

@jwforres

Copy link
Copy Markdown
Member

Interesting, if we had the number of groups (SAs, etc) that have access in
parens in the tab name i think that might actually work. Raw example of
what i mean:

Users (3) | Groups (0) | Service Accounts (2) | System Users (0) | System
Groups (0)

On Fri, Sep 30, 2016 at 2:08 PM, Ben Petersen [email protected]
wrote:

Considering tabs to solve the length of page problems we discussed in the
design review:
[image: screen shot 2016-09-30 at 2 07 34 pm]
https://cloud.githubusercontent.com/assets/280512/19001852/452f4452-8717-11e6-85fc-78b6a3156e73.png

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#562 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABZk7Xp7CYUHIlFPa3uOAgL5gZ2vJ9XHks5qvVAAgaJpZM4KB1cn
.

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

Count is definitely helpful. I may prefer individual roles listed horizontally at this point, given most should have 1-2.

screen shot 2016-09-30 at 3 28 25 pm

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 4, 2016
@benjaminapetersen

benjaminapetersen commented Oct 5, 2016 •

Copy link
Copy Markdown
Contributor Author

Progress update, getting closer to polish time.

Default view:
screen shot 2016-10-05 at 4 25 23 pm

Edit view:
screen shot 2016-10-05 at 4 25 44 pm

Are you sure you want to wreck yo' self modal:
screen shot 2016-10-05 at 4 26 25 pm

Nah, but I'd like to wreck the system by messing up my service accounts modal:
screen shot 2016-10-05 at 4 26 53 pm

@jwforres and any who would like to chime in, feel free to lay on the feedback!

  • Structure modal text in a way that is easier to skim, nobody likes sentence format.

@enj

enj commented Oct 5, 2016 •

Copy link
Copy Markdown
  • Highlight the role and user being modified in the modals?

@spadgett

spadgett commented Oct 5, 2016 •

Copy link
Copy Markdown
Member

I'd add the kind to the names in the dialog. We usually lower-case the kind in sentences.

  • "Are you sure you want to remove the role system:image-puller from service account builder?"

Looking polished :)

@spadgett

spadgett commented Oct 5, 2016 •

Copy link
Copy Markdown
Member
  • Maybe still show the username even if it's you? You might have more than one account and forget which one you're using.

@benjaminapetersen

benjaminapetersen commented Oct 6, 2016 •

Copy link
Copy Markdown
Contributor Author

Good thoughts!
A few more per discussion w/@jwforres:

  • "add" = "Add" (caps the links). center vert & horiz
  • in the new form @ the bottom, put the role picker in 3rd column like the others for consistency
  • "name" = "Name" in the input
  • improve text in modals, especially distinguish "remove admin from self", can use alert in modal
  • special msg if removing your last role in the project (can use alert again)
  • when removing a users last view, redirect to project list page
  • mobile view needs some work
  • style ui-select hover to ensure text is readable

@benjaminapetersen benjaminapetersen changed the title [WIP] Project Membership [CODE_NOT_READY_FOR_REVIEW] [WIP] Project Membership Oct 6, 2016
@liggitt

liggitt commented Oct 6, 2016 •

Copy link
Copy Markdown
Contributor

Does the role get added when you click "add" or when you click "done"?

  • Should the "Add" be a button?

@liggitt

liggitt commented Oct 6, 2016 •

Copy link
Copy Markdown
Contributor
  • "Roles" instead of "Role(s)"?

If you delete all roles from a user while editing, does their row go away or does it remain with "None" in the roles column until you click Done"

@benjaminapetersen

benjaminapetersen commented Oct 6, 2016 •

Copy link
Copy Markdown
Contributor Author

@liggitt

  • When you click "add" a role is added. The same with "x", triggers a modal then the role is removed. "Done" returns to read-only mode.
  • If you delete all roles from a user, the user goes away. You can add them back with the add row @ the bottom.

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

We may show again in the design review tomorrow if time permits.

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

@liggitt buttons for reference:

screen shot 2016-10-06 at 9 31 59 am

@jwforres

jwforres commented Oct 6, 2016

Copy link
Copy Markdown
Member

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

@mo @liggitt @smarterclayton @deads2k @jwforres @spadgett for feedback on annotations:

  • openshift.io/description="A description" for the small text under each role, optionally(?) provided
  • openshift.io/display="end-user cluster-admin" for the show/hide logic behind "show hidden roles". This could be a space delimited list... needs feedback.

screen shot 2016-10-06 at 10 39 44 am

@benjaminapetersen

benjaminapetersen commented Oct 6, 2016 •

Copy link
Copy Markdown
Contributor Author
  • factor the "pillboxes" into .chip as a generic, perhaps a directive
  • use list instead of get for roles, rolebindings
  • fix the k8s-label css @ mobile for the "x" (by not using k8s-label class ):
// core.less
@media (max-width: 768px)
.k8s-label .label {
    display: block;
    min-width: 50px;
}

@spadgett

Copy link
Copy Markdown
Member

I think "Membership" should go above "Other Resources." Is "Project Membership" too long? Would be more obvious what it is.

Note @jhadvig is adding a "Secrets" menu item above "Other Resources."

screen shot 2016-10-20 at 9 31 26 am

@spadgett

Copy link
Copy Markdown
Member

Feel like the tooltips should trigger on hover rather than click. They also look like they navigate to another page with the underline.

If there's no additional information, maybe we should just say "Cluster Role" and leave it at that (startCase filter).

screen shot 2016-10-20 at 9 34 05 am

@spadgett

Copy link
Copy Markdown
Member

Add the learn-more-inline class to the learn more links.

@spadgett

Copy link
Copy Markdown
Member

Maybe have a help block under "Users" and "Groups" as well so they're consistent and the content doesn't appear to jump when switching tabs?

@spadgett

Copy link
Copy Markdown
Member

Order by name?

screen shot 2016-10-20 at 9 41 47 am

@spadgett

Copy link
Copy Markdown
Member

@rhamilto Is adding a badge style for add to project category counts. I wonder how that would look in the tab headings here. (Definitely can be a follow on if we decide to change it.)

@spadgett

Copy link
Copy Markdown
Member

Suggest a help icon here with a tooltip explaining why a role would be hidden.

openshift_web_console

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

@spadgett @enj going with this as the annotation will be system-only:
screen shot 2016-10-20 at 11 54 50 am

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

And pushing the namespace/rolename up into the tooltip:
screen shot 2016-10-20 at 11 56 09 am

If either the project name or role name is long it gets pretty unwieldy if I show project-name/role-name in the chip.

@liggitt

liggitt commented Oct 20, 2016

Copy link
Copy Markdown
Contributor

I don't like making them hover in order to see it's a locally defined role

@rhamilto

Copy link
Copy Markdown
Member

@spadgett

Copy link
Copy Markdown
Member

System roles are hidden by default.

We should say why or maybe say that you don't normally need to use them.

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

@rhamilto got it, is now "#4d5258" as elsewhere (action-inline)

And help text is now "System roles are hidden by default and do not typically need to be managed."

Comment thread app/scripts/constants.js Outdated
"custom_strategy": "https://docs.openshift.org/latest/dev_guide/deployments.html#custom-strategy",
"lifecycle_hooks": "https://docs.openshift.org/latest/dev_guide/deployments.html#lifecycle-hooks",
"new_pod_exec": "https://docs.openshift.org/latest/dev_guide/deployments.html#pod-based-lifecycle-hook",
"authorization": "https://docs.openshift.org/latest/architecture/additional_concepts/authorization.html",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

indentation

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread app/scripts/controllers/membership.js Outdated
},
remove: {
areYouSure: {
subject: _.template('Are you sure you want to remove <strong><%= roleName %></strong> from the <%= kindName %> <strong><%= subjectName %></strong>?'),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@benjaminapetersen You can use the HTML escape delimiter here. That needs to be used anywhere we use the result as HTML.

_.template('Are you sure you want to remove <strong><%- roleName %></strong> from the <%- kindName %> <strong><%- subjectName %></strong>?')

https://lodash.com/docs/3.10.1#template

Comment thread app/scripts/controllers/membership.js Outdated
subjectKindsForUI: MembershipService.mapRolebindingsForUI(resp.by('metadata.name'), allRoles)
});
}, {
// errorNotification: false TODO: DataService.list() does not support

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

errorNotification: false TODO: DataService.list() does not support

It supports it now. I added it recently.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nice

var selectedTab = {};
if($routeParams.tab) {
selectedTab[$routeParams.tab] = true; // ex: tab=Group for Groups, pluralized in the template
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we use persistTabState from #582?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

already got it!

Comment thread app/scripts/controllers/membership.js Outdated
var noAdditional = 'There is no additional information about this role.';
var prefix = role.kind + ': ';
return role ?
prefix + (annotation(role, 'description') || noAdditional) :

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should probably use the description filter here.

Comment thread app/views/membership.html Outdated
class="pull-right btn btn-default"
ng-disabled="disableAddForm"
ng-click="toggleEditMode()">Done Editing</a>
Permissions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I preferred "Membership".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agree, rolling back

Comment thread app/views/membership.html
ng-show="!(mode.edit)"
ng-click="toggleEditMode()">
Edit Membership
</a>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could have just one a element and change the text based on mode.edit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good call

Comment thread app/views/membership.html Outdated
ng-click="toggleEditMode()">Done Editing</a>
Permissions
</h1>
<small class="meta">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

<span class="learn-more-block">?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

got it

Comment thread app/views/membership.html Outdated
ng-if="subjectKind.helpLinkKey"
target="_blank"
ng-href="{{subjectKind.helpLinkKey | helpLink}}"
class="meta">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

class="learn-more-inline"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

got it

Comment thread app/views/modals/confirm.html Outdated
<div class="modal-resource-action">
<div class="modal-body">
<h1>{{message}}</h1>
<p ng-if="details" ng-bind-html="details"></p>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There is existing code that uses this dialog which might not be passing HTML sanitized values in details. This really need to be a separate property like detailsMarkup or something that makes it clear markup is expected.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixing now

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

@spadgett

Why not resp.by('metadata.uid') and flatten the result?

Looking at this. The roleRef on a roleBinding doesn't have the uid field, so matching has been by <kind>-<name>. Let me think on this and see if I can come up with a good way to eliminate this extra generated key.

@spadgett spadgett left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving these changes.

@benjaminapetersen Please open an issue to track the follow on work for MembershipService.

- Manage bindings for all 5 subject kinds via tabs
	- user, group, serviceaccount, systemuser
- Add membership service
	- get business logic out of membership controller
- Add roles service
  - handle roles & clusterRoles
- Add roleBindings service
- Add action-chip directive
  - very similar to labels "tags"
- Add membership to menu in constants.js
- Add help links for roles/roleBindings
- Support detailHTML in confirmModal
@spadgett

Copy link
Copy Markdown
Member

[merge]

@openshift-bot

Copy link
Copy Markdown

Evaluated for origin web console merge up to 43bfc7a

@openshift-bot

Copy link
Copy Markdown

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

Hmm. Not sure, dist is built:

Verifying that checked in built files under dist match the source...
Built dist does not match what is committed, run 'grunt build' and include the results in your commit.
make: *** [test] Error 1
Error while running ssh/sudo command: 
set -e
pushd /data/src/github.com/openshift//origin-web-console >/dev/null
export PATH=$GOPATH/bin:$PATH

Double slash in that path openshift//origin-web-console looks strange as well.

@benjaminapetersen

Copy link
Copy Markdown
Contributor Author

So:

Verifying that checked in built files under dist match the source...
Built dist does not match what is committed, run 'grunt build' and include the results in your commit.
make: *** [test] Error 1

But locally running hack/verify-dist.sh is successful.

@openshift-bot

Copy link
Copy Markdown

Evaluated for origin web console test up to 43bfc7a

@openshift-bot

Copy link
Copy Markdown

@spadgett

Copy link
Copy Markdown
Member

Changes merged in #698

@spadgett spadgett closed this Oct 21, 2016
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.

8 participants