Nagios_auth_Model Class Reference

Model providing access to the authorization system in nagios. More...

Public Member Functions

 __construct ()
 Almost anything you can do with this model is expensive and cached.
 i_can_has_root_plx ()
 This is required for testing purposes.
 check_rootness ()
 Initializes the user authorization levels.
 get_contact_id ()
 Fetch contact id for current user.
 get_authorized_hosts ()
 Fetch authorized hosts from db for current user.
 get_authorized_hosts_r ()
 Get a 'host_name' => id indexed array of authorized hosts.
 get_authorized_services_r ()
 Get a "'host_name;service_description' => id"-indexed array of services.
 get_authorized_hostgroups_r ()
 Get a "'hostgroup_name' => id"-indexed array of hostgroups.
 get_authorized_servicegroups_r ()
 Get a "'servicegroup_name' => id"-indexed array of servicegroups.
 get_authorized_services ()
 Fetch authorized services from db for current user.
 get_authorized_hostgroups ()
 Fetch authorized hostgroups from db for current user.
 get_authorized_servicegroups ()
 Fetch authorized servicegroups from db for current user.
 is_authorized_for_host ($host)
 is_authorized_for_service ($service, $desc=false)
 Return a boolean saying if we're authorized for the service name or id provided.
 is_authorized_for_hostgroup ($hostgroup)
 is_authorized_for_servicegroup ($servicegroup)

Static Public Member Functions

static instance ()
 Return the singleton instance of the auth model.

Data Fields

 $session = false
 FIXME: Another user session variable, that the ninja model already provides, except we've decided not to use it.
 $user = ''
 The username.
 $view_hosts_root = false
 Is user authorized to see all hosts?
 $view_services_root = false
 Is user authorized to see all services?
 $command_hosts_root = false
 Is user authorized to issue all host commands? WARNING: we ignore this way too much.
 $command_services_root = false
 Is user authorized to issue all servicecommands? WARNING: we ignore this way too much.
 $authorized_for_system_information = false
 Is the user authorized to see system information? WARNING: we ignore this way too much.
 $authorized_for_system_commands = false
 Is the user authorized to issue system-wide commands? WARNING: we ignore this way too much.
 $authorized_for_all_host_commands = false
 Alias for command_hosts_root.
 $authorized_for_all_service_commands = false
 Alias for command_services_root.
 $authorized_for_configuration_information = false
 Is the user authorized to see information about the global configuration?

Detailed Description

Model providing access to the authorization system in nagios.

Warning: a lot of these function calls are expensive! Do not create loads of instances!


Constructor & Destructor Documentation

Nagios_auth_Model::__construct (  ) 

Almost anything you can do with this model is expensive and cached.

Thus, do /NOT/ call this constructor directly - use self::instance() instead.


Member Function Documentation

Nagios_auth_Model::i_can_has_root_plx (  ) 

This is required for testing purposes.

The backdoor side of it can safely be ignored, since the reports library has zero authentication anyway, and return-into-libzend or similar exploits are impossible from php

Nagios_auth_Model::is_authorized_for_host ( host  ) 
Parameters:
$host string
Returns:
boolean
Nagios_auth_Model::is_authorized_for_hostgroup ( hostgroup  ) 
Parameters:
$hostgroup string
Returns:
boolean
Nagios_auth_Model::is_authorized_for_service ( service,
desc = false 
)

Return a boolean saying if we're authorized for the service name or id provided.

This function can be called with two arguments, where the first is host name, and the second is service description, or with one argument where host and service is ';' separated.

Parameters:
$service string hostname if second arg is given, otherwize "host;service"
$desc string = false see previous arg
Returns:
boolean
Nagios_auth_Model::is_authorized_for_servicegroup ( servicegroup  ) 
Parameters:
$servicegroup string
Returns:
boolean

The documentation for this class was generated from the following file:
 All Data Structures Functions Variables

Generated on 22 Nov 2012 for ninja by  doxygen 1.6.1