BAOBAB
co_security_id.class.php
Go to the documentation of this file.
1 <?php
2 /***************************************************************************************************************************/
26 defined( 'LGV_DBF_CATCHER' ) or die ( 'Cannot Execute Directly' ); // Makes sure that this file is in the correct context.
27 
28 if ( !defined('LGV_SDBN_CATCHER') ) {
29  define('LGV_SDBN_CATCHER', 1);
30 }
31 
32 require_once(CO_Config::db_class_dir().'/co_security_node.class.php');
33 
34 /***************************************************************************************************************************/
40 
41  /***********************************************************************************************************************/
42  /***********************/
46  public function __construct( $in_db_object = NULL,
47  $in_db_result = NULL
48  ) {
49  parent::__construct($in_db_object, $in_db_result);
50  $this->class_description = 'This is a security class for IDs.';
51  $this->instance_description = isset($this->name) && $this->name ? "$this->name ($this->_id)" : "Unnamed ID Node ($this->_id)";
52  $this->_special_first_time_security_exemption = true;
53  $this->read_security_id = $this->id(); // These are always the case, regardless of what anyone else says.
54  $this->write_security_id = -1;
55  }
56 
57  /***********************/
63  public function load_from_db($in_db_result) {
64  $ret = parent::load_from_db($in_db_result);
65 
66  if ($ret) {
67  $this->read_security_id = $this->id(); // These are always the case, regardless of what anyone else says.
68  $this->write_security_id = -1;
69  $this->class_description = 'This is a security class for IDs.';
70  }
71 
72  return $ret;
73  }
74 
75  /***********************/
82  public function security_exemption() {
84  $this->_special_first_time_security_exemption = false;
85 
86  return $ret;
87  }
88 
89  /***********************/
94  public function user_can_read() {
95  $ret = parent::user_can_read();
96 
97  if ($ret) {
98  $ret = false;
99  // We make double-damn sure that only cleared managers can see this.
100  $item = $this->get_access_object()->get_login_item();
101  if ($this->get_access_object()->god_mode() || (isset($item) && ($item instanceof CO_Login_Manager))) {
102  $exemption = in_array($this->id(), $item->ids());
103 
104  $ret = ($this->get_access_object()->god_mode() || $exemption);
105  }
106  }
107 
108  return $ret;
109  }
110 };
if(!defined( 'LGV_SDBN_CATCHER'))
load_from_db($in_db_result)
__construct( $in_db_object=NULL, $in_db_result=NULL)