Contents
On this page

List Roles - Plugixa Advanced User Role Editor

GET /plugixa-aure/v1/roles

Every role on the site, every capability the site knows about, and which role holds which. This is the whole matrix the Roles screen draws.

Needs the View permission: the signed-in user must hold plugixa_aure_view or any other of the editor’s own capabilities (plugixa_aure_edit_roles, plugixa_aure_edit_users, plugixa_aure_manage_settings).

Request

GET https://your-site.example/wp-json/plugixa-aure/v1/roles

Responses

200 OK. data is the role matrix.

{
  "success": true,
  "data": {
    "roles": [
      {
        "slug": "administrator",
        "name": "Administrator",
        "users": 2,
        "granted": 61,
        "denied": 0,
        "version": "9b1e44c0a7d2",
        "protected": true,
        "editable": false,
        "assignable": true
      },
      {
        "slug": "editor",
        "name": "Editor",
        "users": 4,
        "granted": 34,
        "denied": 0,
        "version": "3f9c2a71b0de",
        "protected": false,
        "editable": true,
        "assignable": true
      },
      {
        "slug": "support_agent",
        "name": "Support agent",
        "users": 0,
        "granted": 3,
        "denied": 1,
        "version": "5d0a8e13c4f7",
        "protected": false,
        "editable": true,
        "assignable": true
      }
    ],
    "capabilities": [
      {
        "cap": "install_plugins",
        "human": "Install plugins",
        "source": "core",
        "owner": "WordPress",
        "group": "plugins",
        "since": "2.8",
        "deprecated": false,
        "severity": "critical",
        "explain": "Can upload and install any plugin, including one that grants itself administrator access.",
        "grantable": true,
        "rewrites_to": [],
        "active": true,
        "claim": [],
        "roles": [
          "administrator"
        ],
        "likely_owner": "",
        "likely_active": false
      }
    ],
    "grants": {
      "administrator": {
        "install_plugins": 1,
        "manage_options": 1,
        "read": 1
      },
      "editor": {
        "edit_posts": 1,
        "publish_posts": 1,
        "read": 1
      },
      "support_agent": {
        "edit_posts": 1,
        "moderate_comments": 1,
        "read": 1,
        "upload_files": 0
      }
    }
  }
}
Field Type Meaning
data.roles[].slug string The role’s machine name
data.roles[].name string Display name
data.roles[].users integer|null People holding the role. null when head counts are switched off with the plugixa_aure_count_role_users filter. Cached for up to five minutes
data.roles[].granted integer Capabilities the role grants
data.roles[].denied integer Capabilities the role blocks
data.roles[].version string Fingerprint of the role’s capabilities, for the versions check of Apply Changes
data.roles[].protected boolean true for Administrator, which cannot be deleted
data.roles[].editable boolean false for Administrator while editing it is switched off in Settings
data.roles[].assignable boolean Whether you hold every capability the role grants, and so may give it to someone
data.capabilities[] array One entry per capability, as in List Capabilities
data.grants object Role slug to a map of capability to 1 (granted) or 0 (blocked). A capability missing from a role’s map is neither. Roles with no capabilities at all are left out

Shortened for the page: a real response lists every capability in capabilities and in each role of grants.

Errors

Plus the errors every endpoint can return.

Examples

curl -s "https://your-site.example/wp-json/plugixa-aure/v1/roles" \
  -u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-aure/v1/roles');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-aure/v1/roles', {
  headers: {
    'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
  },
});
const { data } = await response.json();

Quick Links

Share