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

[Panel] Forbidden user roles still selectable in user create dialog #1917

Closed
texnixe opened this issue Jul 14, 2019 · 7 comments

Comments

@texnixe
Copy link
Contributor

commented Jul 14, 2019

Describe the bug
If I limit what roles a user can create via the options setting:

title: Editor

options:
  create:
    editor: false
    manager: true

The dialog still shows all roles as selectable:

image

To Reproduce
Steps to reproduce the behavior:

  1. Create an Editor and a Manager role blueprint, in the Editor blueprint add the above options
  2. Create an Editor user and log in with that user
  3. Click on "Add new user"
  4. The above dialog is opened.
  5. Select Editor as role: you get an error message; if you change role to manager, the user is created.

Expected behavior
The user roles(s) that cannot be created shouldn't be selectable in the first place.

Kirby Version
3.2.2

Additional context
Add any other context about the problem here.

@texnixe

This comment has been minimized.

Copy link
Contributor Author

commented Jul 14, 2019

On a side note, I find it confusing to have permissions and options in user blueprints with the same sort of properties. Why this additional options setting instead of putting that into the permissions sections?

title: Editor

permissions:
  users:
    create:
      editor: false
      manager: true

(This doesn't work though)

@texnixe

This comment has been minimized.

Copy link
Contributor Author

commented Aug 25, 2019

See also: #2038

@distantnative distantnative added this to the 3.2.5 milestone Sep 13, 2019
@distantnative

This comment has been minimized.

Copy link
Contributor

commented Sep 14, 2019

I am majorly confused after running in circles:
I don't think we support an option setting in user blueprints. Only permissions. Or do we?

@texnixe

This comment has been minimized.

Copy link
Contributor Author

commented Sep 14, 2019

We do, but I didn't really get it when I posted this issue. Here is what Bastian wrote on Slack:

in users/editor.yml sind die Permissions dafür da zu Reglen, was Editoren allgemein im System dürfen.
Options regeln hingegen, was passiert wenn ein User mit einer anderen Rolle einen Editor bearbeitet.

@distantnative

This comment has been minimized.

Copy link
Contributor

commented Sep 15, 2019

Developer's note:
What I am currently struggling with: the options should be tied to the role object to filter them in the Panel accordingly. However, in our setup the options in a role user blueprint end up with the user... which does not make that much sense, does it - @bastianallgeier?

bastianallgeier added a commit that referenced this issue Sep 16, 2019
New Roles::canBeChanged and Roles::canBeCreated methods help to filter roles by those that can be created or changed by the current user. This is now also implemented in the API and used by the dialogs to filter the list of allowed roles.
@bastianallgeier

This comment has been minimized.

Copy link
Contributor

commented Sep 16, 2019

I think I solved this in #2108. Please have a look at it and let me know if this makes any sense to you :)

bastianallgeier added a commit that referenced this issue Sep 16, 2019
New Roles::canBeChanged and Roles::canBeCreated methods help to filter roles by those that can be created or changed by the current user. This is now also implemented in the API and used by the dialogs to filter the list of allowed roles.
@bastianallgeier

This comment has been minimized.

Copy link
Contributor

commented Sep 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.