Make WordPress Core

Opened 16 years ago

Last modified 5 months ago

#14460 new feature request

New Permission for no_user_edit so users with edit_users can't edit it

Reported by: anonymized_6656123 Owned by:
Priority: normal Milestone:
Component: Users Version: 3.0
Severity: normal Keywords: has-patch dev-feedback has-unit-tests
Cc: Focuses: multisite

Description

I recently experienced a problem where I have an administrator role with full access and a site administrator role with most access including the ability add, edit, and delete users. However, I don't want the Site Administrator to be able to delete users of the role Administrator.

The change I'm proposing is a new permission or marker which states that if enabled, this user can't be changed by another user who isn't the same role. If possible, I might try to add the patch myself.

This is a fairly important issue which would is interfering with WordPress' use as a content management system, and the only work around I've found is to edit core file.

Attachments (1)

14460.patch​ (1.3 KB ) - added by linuxologos 15 years ago.

Download all attachments as: .zip

Change History (8)

#1 @nacin
16 years ago

  • Milestone Awaiting Review → Future Release

#2 @linuxologos
15 years ago

  • Keywords has-patch needs-testing added; user role delete immune removed

If we were to use a new capability to fix this, it seems rather simple (at first look at least).

If for example the administrator was given a "Self protect" capability, then (edit|delete)_user could be checked against this new cap. If another user could edit/delete users, he could do so only for users without the "self protect" cap, unless he himself has the same cap (the administrator in this example).

14460.patch​ tries to implement this through map_meta_cap(). It's a first pass. Please give an user or role the "self_protect" cap and test.

#3 @trepmal
15 years ago

In the meantime - or if this is deemed plugin-territory - this code might help: ​https://gist.github.com/1518263

It's just a proof-of-concept at this point and will likely require some refining and customization.

#4 @chriscct7
12 years ago

  • Focuses multisite added
  • Keywords dev-feedback added
  • Severity major → normal

I could swear this is a duplicate of another ticket proposing a solution where site admins cannot delete other site admins (only network admins could delete site admins), except after extensive searching I have yet to find it.

That being said, this seems something that either could be handled by a plugin or could be handled by core. Maybe one of the core devs working on the MS improvements want to weight in on that?

#5 @chriscct7
11 years ago

  • Keywords needs-refresh added

#6 @ozgursar
10 months ago

  • Keywords needs-testing removed

When I try to apply the patch https://core.trac.wordpress.org/attachment/ticket/14460/14460.patch against the trunk (7.0-alpha-61215-src) it fails to apply to wp-includes/capabilities.php creating the wp-includes/capabilities.php.rej file with 2 out of 2 hunks failed message.

As the patch can not be successfully applied, removing the needs-testing and keeping the needs-refresh

This ticket was mentioned in ​PR #12118 on ​WordPress/wordpress-develop by ​@sukhendu2002.


5 months ago
#7

  • Keywords has-unit-tests added; needs-refresh removed
Note: See TracTickets for help on using tickets.