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

Edit User Profile: Role dropdown #3402

Closed
ErisDS opened this issue Jul 25, 2014 · 3 comments · Fixed by #3436
Closed

Edit User Profile: Role dropdown #3402

ErisDS opened this issue Jul 25, 2014 · 3 comments · Fixed by #3436
Assignees
Labels
affects:admin Anything relating to Ghost Admin

Comments

@ErisDS
Copy link
Member

ErisDS commented Jul 25, 2014

In the template for the user edit screen, there is a commented out role dropdown:
https://github.com/TryGhost/Ghost/blob/master/core/client/templates/settings/users/user.hbs#L67

We now have the Roles API browse endpoint for fetching the roles that the currently logged in user is allowed to assign (although it won't function 100% until #3395 is merged)

We also have the User API edit endpoint updated to expect to have to change a role, and to check permissions for what roles can be assigned.

Therefore, all the pieces should be in place to wire this up. The dropdown needs uncommenting, populating with a list, and hiding if the list is empty.

You can reference #3083 to see who should be allowed to assign a given role, but in short:

  • Owners & Admins can assign all roles, except the 'Owner' role won't appear in the list, that role can only be assigned via the 'Make owner' button User settings cog menu (show items appropriate to role) #3400.
  • Editors can assign the author role.
  • Authors are not allowed to assign any roles, so this dropdown should be empty, and therefore should be hidden for authors.

Update: This dropdown shouldn't appear when editing the current logged in user's profile, i.e. it shouldn't be possible to edit your own role as it's a pretty destructive action & too easy to do. Authors can't edit roles, owners can't relinquish their ownership without doing the explicit "Transfer ownership" action, so only admins and editors are affected, and they are only prevented from downgrading themselves which seems like a minimal use-case anyway.

@ErisDS ErisDS added this to the 0.5 Multi-user milestone Jul 25, 2014
@novaugust
Copy link
Contributor

I'd love to take this over the weekend, been too long since I got to do some ghosting :)

@novaugust
Copy link
Contributor

For editors, being able to assign the author role is as good as being unable to assign a role, no?

@JohnONolan
Copy link
Member

Good point - probably doesn't make sense for editors to be able to see the role dropdown (on the edit-user screen)

novaugust added a commit to novaugust/Ghost that referenced this issue Jul 30, 2014
Closes TryGhost#3402, Closes TryGhost#3428

-------------------

 ### Components
- Added GhostSelectComponent to handle async select creation (h/t @rwjblue)
- Added GhostRolesSelector (extends GhostSelect) for displaying user role options
- Created StoreInjector for surgically inserting the store into things that normally wouldn't have them.

 ### Users Settings
- InviteNewUserModal now uses GhostRolesSelector & defaults to Author
- The role dropdown for user settings has permissions set per 3402

 ### User Model
- Added `role` property as an interface to getting and setting `roles`
- Refactored anything that set `roles` to set `role`
- isAdmin, isAuthor, isOwner and isEditor are all keyed off of `role` now

 ### Tests
- Added functional tests for Settings.Users
- updated settings.users and settings.users.user screens
- fix spacing on screens

 ### Server Fixtures
- Fixed owner fixture's roles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:admin Anything relating to Ghost Admin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants