role.get

Beschrijving

integer/array role.get(object parameters)

De methode maakt het mogelijk om rollen op te halen volgens de gegeven parameters.

Deze methode is beschikbaar voor gebruikers van elk type. Rechten om de methode aan te roepen, kan worden ingetrokken in de instellingen van de gebruikersrol. Zie Gebruiker rollen voor meer informatie.

Parameters

(object) Parameters die de gewenste uitvoer definiëren.

De methode ondersteunt de volgende parameters.

Parameter Type Beschrijving
roleids string/array Retourneer alleen rollen met de opgegeven ID's.
selectRules query Retourneer rolregels in de eigenschap rules.
selectUsers query Selecteer users waaraan deze rol is toegewezen.
sortfield string/array Sorteer het resultaat op de gegeven eigenschappen.

Mogelijke waarden zijn: roleid, name.
countOutput boolean Deze parameters gelden voor alle get-methoden en worden in detail beschreven op de pagina referentiecommentaar.
editable booleaans
excludeSearch boolean
filter object
limiet geheel getal
uitvoer query
preservekeys boolean
zoeken object
searchByAny boolean
searchWildcardsIngeschakeld boolean
sortorde string/array
startZoeken booleaans

Retourwaarden

(integer/array) Retourneert ofwel:

  • een reeks objecten;
  • het aantal opgehaalde objecten, als de countOutput parameter heeft gebruikt.

Voorbeelden

Ophalen van rolgegevens

Haal de gegevens op van de rol "Superbeheerder" en de bijbehorende toegangsregels.

Verzoek:

{
           "jsonrpc": "2.0",
           "method": "role.get",
           "params": {
               "output": "extend",
               "selectRules": "extend",
               "roleids": "3"
           },
           "auth": "3a57200802b24cda67c4e4010b50c065",
           "id": 1
       }

Reactie:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "roleid": "3",
                   "name": "Superbeheerder rol",
                   "type": "3",
                   "readonly": "1",
                   "rules": {
                       "ui": [
                           {
                               "name": "inventory.hosts",
                               "status": "1"
                           },
                           {
                               "name": "inventory.overview",
                               "status": "1"
                           },
                           {
                               "name": "monitoring.dashboard",
                               "status": "1"
                           },
                           {
                               "name": "monitoring.hosts",
                               "status": "1"
                           },
                           {
                               "name": "monitoring.latest_data",
                               "status": "1"
                           },
                           {
                               "name": "monitoring.maps",
                               "status": "1"
                           },
                           {
                               "name": "monitoring.problems",
                               "status": "1"
                           },
                           {
                               "name": "reports.availability_report",
                               "status": "1"
                           },
                           {
                               "name": "reports.top_triggers",
                               "status": "1"
                           },
                           {
                               "name": "services.services",
                               "status": "1"
                           },
                           {
                               "name": "services.sla_report",
                               "status": "1"
                           },
                           {
                               "name": "configuration.actions",
                               "status": "1"
                           },
                           {
                               "name": "configuration.discovery",
                               "status": "1"
                           },
                           {
                               "name": "configuration.host_groups",
                               "status": "1"
                           },
                           {
                               "name": "configuration.hosts",
                               "status": "1"
                           },
                           {
                               "name": "configuration.maintenance",
                               "status": "1"
                           },
                           {
                               "name": "configuration.templates",
                               "status": "1"
                           },
                           {
                               "name": "monitoring.discovery",
                               "status": "1"
                           },
                           {
                               "name": "reports.notifications",
                               "status": "1"
                           },
                           {
                               "name": "reports.scheduled_reports",
                               "status": "1"
                           },
                           {
                               "name": "services.actions",
                               "status": "1"
                           },
                           {
                               "name": "services.sla",
                               "status": "1"
                           },
                           {
                               "name": "administration.authentication",
                               "status": "1"
                           },
                           {
                               "name": "administration.general",
                               "status": "1"
                           },
                           {
                               "name": "administration.media_types",
                               "status": "1"
                           },
                           {
                               "name": "administration.proxies",
                               "status": "1"
                           },
                           {
                               "name": "administration.queue",
                               "status": "1"
                           },
                           {
                               "name": "administration.scripts",
                               "status": "1"
                           },
                           {
                               "name": "administration.user_groups",
                               "status": "1"
                           },
                           {
                               "name": "administration.user_roles",
                               "status": "1"
                           },
                           {
                               "name": "administration.users",
                               "status": "1"
                           },
                           {
                               "name": "configuration.event_correlation",
                               "status": "1"
                           },
                           {
                               "name": "reports.action_log",
                               "status": "1"
                           },
                           {
                               "name": "reports.audit",
                               "status": "1"
                           },
                           {
                               "name": "reports.system_info",
                               "status": "1"
                           }
                       ],
                       "ui.default_access": "1",
                       "services.read.mode": "1",
                       "services.read.list": [],
                       "services.read.tag": {
                           "tag": "",
                           "value": ""
                       },
                       "services.write.mode": "1",
                       "services.write.list": [],
                       "services.write.tag": {
                           "tag": "",
                           "value": ""
                       },
                       "modules": [],
                       "modules.default_access": "1",
                       "api.access": "1",
                       "api.mode": "0",
                       "api": [],
                       "actions": [
                           {
                               "name": "edit_dashboards",
                               "status": "1"
                           },
                           {
                               "name": "edit_maps",
                               "status": "1"
                           },
                           {
                               "name": "acknowledge_problems",
                               "status": "1"
                           },
                           {
                               "name": "close_problems",
                               "status": "1"
                           },
                           {
                               "name": "change_severity",
                               "status": "1"
                           },
                           {
                               "name": "add_problem_comments",
                               "status": "1"
                           },
                           {
                               "name": "execute_scripts",
                               "status": "1"
                           },
                           {
                               "name": "manage_api_tokens",
                               "status": "1"
                           },
                           {
                               "name": "edit_maintenance",
                               "status": "1"
                           },
                           {
                               "name": "manage_scheduled_reports",
                               "status": "1"
                           },
                           {
                               "name": "manage_sla",
                               "status": "1"
                           }
                       ],
                       "actions.default_access": "1"
                   }
               }
           ],
           "id": 1
       }

Zie ook

Bron

CRole::get() in ui/include/classes/api/services/CRole.php.