[wp-trac] [WordPress Trac] #39156: Introduce singular capabilities for managing individual sites on a network

WordPress Trac noreply at wordpress.org
Wed Dec 7 20:44:11 UTC 2016


#39156: Introduce singular capabilities for managing individual sites on a network
-----------------------------------+-----------------------------
 Reporter:  johnbillion            |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  Future Release
Component:  Networks and Sites     |     Version:  3.0
 Severity:  normal                 |  Resolution:
 Keywords:  2nd-opinion has-patch  |     Focuses:  multisite
-----------------------------------+-----------------------------
Changes (by flixos90):

 * keywords:  needs-patch 2nd-opinion => 2nd-opinion has-patch


Comment:

 [attachment:39156.diff] is an initial proposal for this:

 * It introduces two main capabilities `edit_site` and `delete_site` which
 require passing a site ID. The latter is not actually new, but has been
 revamped: `delete_site` in the patch solely denotes actually deleting a
 site, not deactivating it (it currently accounts for both which is not
 very accurate). `edit_site` by default maps to `manage_sites` while
 `delete_site` maps to `delete_sites`.
 * To adjust the site status, new capabilities `archive_site`, `spam_site`,
 `activate_site` and `mature_site` are introduced which all map to
 `manage_sites` by default.
 * The `map_meta_cap()` functionality for all of these checks if the passed
 ID represents an existing site. For `archive_site`, `spam_site`,
 `activate_site` and `delete_site` it also checks if that site is not the
 network's main site.
 * For the one special use-case where a regular site administrator can
 deactivate their own site (actually it only deactivates the site, but the
 site admin is told that it is deleted, which I think we should continue to
 do so at this point), a new capability `delete_admin_site` is introduced.
 I don't like that name at all, so let's definitely find a more suitable
 one. The reason I'm not using something like `deactivate_site` or
 `delete_site` (which it uses currently in trunk) is that this use-case is
 different as everything else is by default only available to the network
 administrator.
 * Minor tweak not ''directly'' related: I adjusted a `manage_sites` check
 in `wp-admin/network/site-new.php` to use `create_sites` instead for more
 granular permissions.

 The patch should be backward-compatible, but please review in detail, I
 might certainly have missed something. What we need to think about is how
 the new `delete_admin_site` (or whichever name we use) should be handled.
 The current `delete_site` does not make sense there at all in my opinion,
 but we might need to scrape some plugins to check whether anything does
 something custom with it (like specifying `do_not_allow` for it, in which
 case we need to somehow adjust the patch so that the new capability
 somehow maps to `delete_site` without being passed a site ID.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39156#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list