BAOBAB
co_login_manager.class.php
Go to the documentation of this file.
1 <?php
2 /***************************************************************************************************************************/
26 defined( 'LGV_ACCESS_CATCHER' ) or die ( 'Cannot Execute Directly' ); // Makes sure that this file is in the correct context.
27 
28 require_once(dirname(__FILE__).'/co_cobra_login.class.php');
29 
30 /***************************************************************************************************************************/
34  protected $_added_new_id;
35 
36  /***********************************************************************************************************************/
37  /***********************/
41  public function __construct( $in_login_id = NULL,
42  $in_hashed_password = NULL,
43  $in_raw_password = NULL,
44  $in_initial_personal_ids = 0
45  ) {
46  parent::__construct($in_login_id, $in_hashed_password, $in_raw_password, $in_initial_personal_ids);
47  $this->_added_new_id = NULL;
48  $this->class_description = 'This is a security class for login managers.';
49  if (intval($this->id()) == intval(CO_Config::god_mode_id())) {
50  // God Mode is always forced to use the config password.
51  $this->context['hashed_password'] = bin2hex(openssl_random_pseudo_bytes(4)); // Just create a randomish junk password. It will never be used.
52  $this->instance_description = 'GOD MODE: '.(isset($this->name) && $this->name ? "$this->name (".$this->login_id.")" : "Unnamed Login Manager Node (".$this->login_id.")");
53  } else {
54  $this->instance_description = isset($this->name) && $this->name ? "$this->name (".$this->login_id.")" : "Unnamed Login Manager Node (".$this->login_id.")";
55  }
56  }
57 
58  /***********************/
64  public function load_from_db($in_db_result) {
65  $ret = parent::load_from_db($in_db_result);
66 
67  if ($ret) {
68  $this->class_description = 'This is a security class for login managers.';
69  if (intval($this->id()) == intval(CO_Config::god_mode_id())) {
70  // God Mode is always forced to use the config password.
71  $this->context['hashed_password'] = bin2hex(openssl_random_pseudo_bytes(4)); // Just create a randomish junk password. It will never be used.
72  $this->instance_description = 'GOD MODE: '.(isset($this->name) && $this->name ? "$this->name (".$this->login_id.")" : "Unnamed Login Manager Node (".$this->login_id.")");
73  } else {
74  $this->instance_description = isset($this->name) && $this->name ? "$this->name (".$this->login_id.")" : "Unnamed Login Manager Node (".$this->login_id.")";
75  }
76  }
77 
78  return $ret;
79  }
80 
81  /***********************/
85  public function is_manager() {
86  return true;
87  }
88 
89  /***********************/
96  public function add_new_login_id( $in_login_id
97  ) {
98  $this->_added_new_id = intval($in_login_id);
99  $ret = $this->add_id($in_login_id);
100  unset($this->_added_new_id);
101  return $ret;
102  }
103 };
__construct( $in_login_id=NULL, $in_hashed_password=NULL, $in_raw_password=NULL, $in_initial_personal_ids=0)
$_added_new_id
This is a very temporary, ephemeral semaphore that we use to allow us to add an ID when we create a n...
add_new_login_id( $in_login_id)
load_from_db($in_db_result)