Update user but not admin


#1

Hey,

I want to allow a user to modify other users, as long they are not admins, BUT same rank allowed - i tried

    'panel.user.update' => function() { // or create // or delete
      return $this->target()->user()->is(!$this->target()->user()->isAdmin());
    }

and all kinds variations …


#2

A non-admin user cannot edit a user with admin role anyway, so just setting

'panel.user.update' => true

should do the job.


#3

but he cannot create/update people with the same role, now can he?


#4

Yes, should be possible. What is your Kirby version?

A user can create other users with the same role if you set panel.user.create to true.


#5

updating does seem impossible… I have a similar situation: A role “webmaster” where I have the permission panel.user.* set to true. But the webmaster seems only able to create new users (of the default Role “organisation”) and not update them. (Kirby 2.5.5)


#6

I tested this with Kirby 2.5.7… May I ask you to test this with the current Kirby version, because there was an issue that was fixed in 2.5.7:

https://github.com/getkirby/panel/issues/1097


#7

In 2.5.7 I can create a webmaster role which can be allowed to add users. The editing of the user now works (that’s the bug that was fixed) but there’s still the issue that the webmaster user can not create a new user with a role other than the default role.


#8

I’ll look into this.


#9

Yes, that seems to be true. It should actually be possible to define which roles that user may give to another user. Maybe we can add this feature in a future version.

I created an issue on GitHub:

https://github.com/getkirby/panel/issues/1127


#10

Thank you so very much for your excellent support :+1: :smiley: