BAOBAB
co_security_db.class.php
Go to the documentation of this file.
1 <?php
2 /***************************************************************************************************************************/
26 defined( 'LGV_SD_CATCHER' ) or die ( 'Cannot Execute Directly' ); // Makes sure that this file is in the correct context.
27 
28 if ( !defined('LGV_ADB_CATCHER') ) {
29  define('LGV_ADB_CATCHER', 1);
30 }
31 
32 require_once(CO_Config::db_class_dir().'/a_co_db.class.php');
33 
34 /***************************************************************************************************************************/
39 class CO_Security_DB extends A_CO_DB {
40  /***********************************************************************************************************************/
41  /***********************/
45  public function __construct( $in_pdo_object,
46  $in_access_object = NULL
47  ) {
48  parent::__construct($in_pdo_object, $in_access_object);
49 
50  $this->table_name = 'co_security_nodes'; // This is the name of the SQL table we will query.
51 
52  $this->class_description = 'The security database class.'; // A simple explanation of what this class is.
53  }
54 
55  /***********************/
63  public function get_security_ids_for_id( $in_id,
64  $no_personal
65  ) {
66  $ret = NULL;
67 
68  $fetch_sql = "ids";
69  if (CO_Config::use_personal_tokens() && !$no_personal) {
70  $fetch_sql .= ",personal_ids";
71  } else {
72  $no_personal = false;
73  }
74 
75  $sql = 'SELECT '.$fetch_sql.' FROM '.$this->table_name.' WHERE (access_class LIKE \'%Login%\') AND (login_id IS NOT NULL) AND (id=?)';
76  $params = Array(intval($in_id));
77  $temp = $this->execute_query($sql, $params);
78 // Commented out, but useful for debug.
79 // echo('SQL:<pre>'.htmlspecialchars(print_r($sql, true)).'</pre>');
80 // echo('PARAMS:<pre>'.htmlspecialchars(print_r($params, true)).'</pre>');
81 // echo('RESPONSE:<pre>'.htmlspecialchars(print_r($temp, true)).'</pre>');
82 // echo('<pre>'.($no_personal ? 'NO ' : '').'PERSONAL</pre>');
83 // echo('ERROR:<pre>'.htmlspecialchars(print_r($this->error, true)).'</pre>');
84  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
85  $ret = isset($temp[0]['ids']) ? explode(',', $temp[0]['ids']) : [];
86  if (!$no_personal && isset($temp[0]['personal_ids'])) {
87  $ret_temp = explode(',', $temp[0]['personal_ids']);
88  foreach ($ret_temp as $i) {
89  if (0 < $i) {
90  array_push($ret, $i);
91  }
92  }
93  }
94  if (isset($ret) && is_array($ret) && count($ret)) {
95  $ret = array_unique(array_map('intval', $ret));
96  $ret_temp = Array();
97  foreach ($ret as $i) {
98  if (0 < $i) {
99  array_push($ret_temp, $i);
100  }
101  }
102  sort($ret_temp);
103  $ret = $ret_temp;
104  }
105  array_unshift($ret, $in_id);
106  } else {
107  $ret = Array($in_id);
108  }
109 
110  return $ret;
111  }
112 
113  /***********************/
119  public function add_personal_token_from_current_login( $in_to_id,
120  $in_id
121  ) {
122  $in_to_id = intval($in_to_id);
123  $in_id = intval($in_id);
124  // If the current login does not own the given ID as a personal token, then we can't proceed.
125  if (CO_Config::use_personal_tokens()) {
126  $sql = 'SELECT ids FROM '.$this->table_name.' WHERE (id=?)';
127  $params = [$in_to_id];
128  $temp = $this->execute_query($sql, $params);
129  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
130  $ret = explode(',', $temp[0]['ids']);
131 
132  if (isset($ret) && is_array($ret)) {
133  $ret = array_map('intval', $ret);
134  $ret[] = $in_id;
135  sort($ret);
136  $ret = array_unique($ret);
137  $new_ids = implode(',', array_unique($ret));
138 
139  $sql = 'UPDATE '.$this->table_name.' SET ids=? WHERE id=?';
140  $params = [$new_ids, $in_to_id];
141  $this->execute_query($sql, $params, true);
142  if ($this->error == NULL) {
143  return true;
144  };
145  }
146  } else {
147  $ret = Array();
148  }
149  }
150 
151  return false;
152  }
153 
154  /***********************/
160  public function remove_personal_token_from_this_login( $in_to_id,
161  $in_id
162  ) {
163  $in_to_id = intval($in_to_id);
164  $in_id = intval($in_id);
165  // If the current login does not own the given ID as a personal token, then we can't proceed.
166  if (CO_Config::use_personal_tokens()) {
167  $sql = 'SELECT ids FROM '.$this->table_name.' WHERE (id=?)';
168  $params = [$in_to_id];
169  $temp = $this->execute_query($sql, $params);
170  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
171  $ret = explode(',', $temp[0]['ids']);
172 
173  if (isset($ret) && is_array($ret)) {
174  $return = false;
175  $ret = array_unique(array_map('intval', $ret));
176  sort($ret);
177 
178  if (($key = array_search($in_id, $ret)) !== false) {
179  $return = true;
180  unset($ret[$key]);
181  }
182 
183  $new_ids = implode(',', $ret);
184 
185  $sql = 'UPDATE '.$this->table_name.' SET ids=? WHERE id=?';
186  $params = [$new_ids, $in_to_id];
187  $this->execute_query($sql, $params, true);
188  if ($this->error == NULL) {
189  return $return;
190  };
191  }
192  } else {
193  $ret = Array();
194  }
195  }
196 
197  return false;
198  }
199 
200  /***********************/
208  public function get_personal_ids_for_id( $in_id
209  ) {
210  $ret = NULL;
211 
212  if (!CO_Config::use_personal_tokens()) {
213  return $ret;
214  }
215 
216  $sql = 'SELECT personal_ids FROM '.$this->table_name.' WHERE (access_class LIKE \'%Login%\') AND (login_id IS NOT NULL) AND (id=?)';
217 
218  $temp = $this->execute_query($sql, Array(intval($in_id)));
219  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
220  $ret = explode(',', $temp[0]['personal_ids']);
221  if (isset($ret) && is_array($ret) && count($ret)) {
222  $ret = array_unique(array_map('intval', $ret));
223  $ret_temp = Array();
224  foreach ($ret as $i) {
225  if (0 < $i) {
226  array_push($ret_temp, $i);
227  }
228  }
229  sort($ret_temp);
230  $ret = $ret_temp;
231  }
232  } else {
233  $ret = Array();
234  }
235 
236  return $ret;
237  }
238 
239  /***********************/
247  public function get_all_personal_ids_except_for_id( $in_id = 0
248  ) {
249  $ret = NULL;
250 
251  if (!CO_Config::use_personal_tokens()) {
252  return $ret;
253  }
254 
255  $sql = 'SELECT personal_ids FROM '.$this->table_name.' WHERE (access_class LIKE \'%Login%\') AND (login_id IS NOT NULL) AND (id<>?)';
256 
257  $temp = $this->execute_query($sql, Array(intval($in_id)));
258  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
259  $ret = "";
260  foreach ($temp as $i) {
261  if ($i['personal_ids']) {
262  if ($ret) {
263  $ret .= ",";
264  }
265  $ret .= $i['personal_ids'];
266  }
267  }
268  $ret = explode(",", $ret);
269  if (isset($ret) && is_array($ret) && count($ret)) {
270  $ret = array_unique(array_map('intval', $ret));
271  $ret_temp = Array();
272  foreach ($ret as $i) {
273  if (0 < $i) {
274  array_push($ret_temp, $i);
275  }
276  }
277  sort($ret_temp);
278  $ret = $ret_temp;
279  }
280  } else {
281  $ret = Array();
282  }
283 
284  return $ret;
285  }
286 
287  /***********************/
294  $ret = NULL;
295 
296  // Will not work for God Mode, as God doesn't have personal IDs.
297  if (!CO_Config::use_personal_tokens() || $this->access_object->god_mode()) {
298  return $ret;
299  }
300 
301  // We can only check personal IDs relevant to our login.
302  $in_ids = $this->access_object->get_personal_security_ids();
303  $in_id = $this->access_object->get_login_id();
304 
305  $sql = 'SELECT id,ids FROM '.$this->table_name.' WHERE (access_class LIKE \'%Login%\') AND (login_id IS NOT NULL) AND (id<>?)';
306 
307  $temp = $this->execute_query($sql, Array(intval($in_id)));
308  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
309  $ret = [];
310  foreach ($temp as $i) {
311  $tmp = [];
312  if (isset($i['id']) && $i['id'] && isset($i['ids']) && $i['ids']) {
313  $key = intval($i['id']);
314  $ids = array_unique(array_map('intval', explode(',', $i['ids'])));
315  if (1 < $key && count($ids)) {
316  sort($ids);
317  $tmp_ids = [];
318  foreach($ids as $tmp_id) {
319  if (in_array($tmp_id, $in_ids)) {
320  $tmp_ids[] = $tmp_id;
321  }
322  }
323  if (count($tmp_ids)) {
324  $ret[$key] = $tmp_ids;
325  }
326  }
327  }
328  }
329  }
330 
331  return $ret;
332  }
333 
334  /***********************/
341  public function get_logins_with_personal_ids() {
342  $ret = NULL;
343 
344  // Will only work for God Mode.
345  if (!CO_Config::use_personal_tokens() || !$this->access_object->god_mode()) {
346  return $ret;
347  }
348 
349  $sql = 'SELECT id,personal_ids FROM '.$this->table_name.' WHERE (access_class LIKE \'%Login%\') AND (login_id IS NOT NULL) AND (personal_ids IS NOT NULL) AND (personal_ids<>\'\')';
350 
351  $temp = $this->execute_query($sql, Array());
352  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
353  $ret = [];
354  foreach ($temp as $i) {
355  $tmp = [];
356  if (isset($i['id']) && $i['id'] && isset($i['personal_ids']) && $i['personal_ids']) {
357  $key = intval($i['id']);
358  $ids = array_unique(array_map('intval', explode(',', $i['personal_ids'])));
359  $ret[$key] = $ids;
360  }
361  }
362  }
363  return $ret;
364  }
365 
366  /***********************/
374  public function get_all_login_ids() {
375  $ret = NULL;
376 
377  $sql = 'SELECT id FROM '.$this->table_name.' WHERE (access_class LIKE \'%Login%\') AND (login_id IS NOT NULL) AND (login_id<>\'\')';
378 
379  $temp = $this->execute_query($sql, Array());
380  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
381  $ret = "";
382  foreach ($temp as $i) {
383  if ($i['id']) {
384  if ($ret) {
385  $ret .= ",";
386  }
387  $ret .= $i['id'];
388  }
389  }
390  $ret = explode(",", $ret);
391  if (isset($ret) && is_array($ret) && count($ret)) {
392  $ret = array_unique(array_map('intval', $ret));
393  $ret_temp = Array();
394  foreach ($ret as $i) {
395  if (0 < $i) {
396  array_push($ret_temp, $i);
397  }
398  }
399  sort($ret_temp);
400  $ret = $ret_temp;
401  }
402  } else {
403  $ret = Array();
404  }
405 
406  return $ret;
407  }
408 
409  /***********************/
415  public function is_this_a_personal_id( $in_id
416  ) {
417  $in_id = intval($in_id);
418 
419  if (CO_Config::use_personal_tokens() && (1 < $in_id)) {
420  $ret = $this->get_all_personal_ids_except_for_id();
421 
422  if (!$this->error) {
423  return in_array($in_id, $ret);
424  }
425  }
426 
427  return false;
428  }
429 
430  /***********************/
436  public function is_this_a_login_id( $in_id
437  ) {
438  $in_id = intval($in_id);
439 
440  if (1 < $in_id) {
441  $ret = $this->get_all_login_ids();
442 
443  if (!$this->error) {
444  return in_array($in_id, $ret);
445  }
446  }
447 
448  return false;
449  }
450 
451  /***********************/
460  public function i_have_all_ids( $in_id
461  ) {
462  $ret = false;
463 
464  if (intval($in_id)) {
465  $sql = 'SELECT write_security_id, ids FROM '.$this->table_name.' WHERE id=?';
466 
467  $result = $this->execute_query($sql, Array(intval($in_id)));
468 
469  if (isset($result) && is_array($result) && (1 == count($result))) {
470  $access_ids = $this->access_object->get_security_ids();
471  $write_security_id = intval($result[0]['write_security_id']);
472  $ids = (isset($result[0]['ids']) && trim($result[0]['ids'])) ? array_map('intval', explode(',', trim($result[0]['ids']))) : [];
473  $ids[] = $write_security_id;
474  sort($ids);
475  sort($access_ids);
476  $diff = array_diff($ids, $access_ids);
477 
478  if (is_array($diff) && !count($diff)) { // We only go true if there are no outliers. We have to have ALL of them.
479  $ret = true;
480  }
481  }
482  }
483  return $ret;
484  }
485 
486  /***********************/
494  public function get_all_tokens() {
495  $ret = NULL;
496 
497  if ($this->access_object->god_mode()) {
498  $sql = 'SELECT id FROM '.$this->table_name.' WHERE true ORDER BY id';
499  $temp = $this->execute_query($sql, Array());
500  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
501  $ret = [];
502  foreach($temp as $row) {
503  $ret[] = intval($row['id']);
504  }
505  }
506  }
507  return $ret;
508  }
509 
510  /***********************/
517  public function get_all_visible_logins() {
518  $ret = array();
519  $sql = 'SELECT id,object_name,login_id FROM '.$this->table_name.' WHERE';
520 
521  $predicate = $this->_create_read_security_predicate();
522 
523  if ($predicate) {
524  $sql = "$sql $predicate AND";
525  }
526 
527  $sql = "$sql login_id<>''";
528 
529  $temp = $this->execute_query($sql, Array());
530  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
531  foreach($temp as $value) {
532  $ret[$value["id"]] = [$value["object_name"], $value["login_id"]];
533  }
534  }
535 
536  return $ret;
537  }
538 
539  /***********************/
549  public function get_initial_record_by_login_id( $in_login_id
550  ) {
551  $ret = NULL;
552 
553  $sql = 'SELECT * FROM '.$this->table_name.' WHERE login_id=?';
554  $params = Array(trim($in_login_id));
555 
556  $temp = $this->execute_query($sql, $params);
557  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
558  $result = $this->_instantiate_record($temp[0]);
559  if ($result) {
560  $ret = $result;
561  }
562  }
563 
564  return $ret;
565  }
566 
567  /***********************/
573  public function get_credentials_by_api_key( $in_api_key
574  ) {
575  $ret = NULL;
576 
577  $sql = 'SELECT * FROM '.$this->table_name.' WHERE api_key LIKE ?';
578  $params = Array(trim($in_api_key).' - %');
579 
580  $temp = $this->execute_query($sql, $params);
581  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
582  $result = $this->_instantiate_record($temp[0]);
583  if (isset($result) && ($result instanceof CO_Security_Login) && $result && $result->is_api_key_valid($in_api_key)) {
584  $ret = Array('login_id' => $result->login_id, 'hashed_password' => $result->get_crypted_password());
585  if ($result->id() == CO_Config::god_mode_id()) {
586  $ret['hashed_password'] = $in_api_key;
587  }
588  } elseif (isset($result) && ($result instanceof CO_Security_Login)) {
589  $this->error = $result->error;
590  }
591  }
592 
593  return $ret;
594  }
595 
596  /***********************/
604  public function get_initial_record_by_id( $in_id
605  ) {
606  $ret = NULL;
607 
608  $sql = 'SELECT * FROM '.$this->table_name.' WHERE id=?';
609 
610  $temp = $this->execute_query($sql, Array(intval($in_id)));
611  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
612  $result = $this->_instantiate_record($temp[0]);
613  if ($result) {
614  $ret = $result;
615  }
616  }
617 
618  return $ret;
619  }
620 
621  /***********************/
627  public function get_single_record_by_login_id( $in_login_id,
628  $and_write = false
629  ) {
630  $ret = NULL;
631 
632  $temp = $this->get_multiple_records_by_login_id(Array($in_login_id), $and_write);
633 
634  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
635  $ret = $temp[0];
636  }
637 
638  return $ret;
639  }
640 
641  /***********************/
647  public function get_multiple_records_by_login_id( $in_login_id_array,
648  $and_write = false
649  ) {
650  $ret = NULL;
651 
652  $predicate = $this->_create_security_predicate($and_write);
653 
654  if ($predicate) { // If we got a predicate, then we AND it with the rest of the statement.
655  $predicate .= ' AND ';
656  }
657 
658  $sql = 'SELECT * FROM '.$this->table_name.' WHERE '.$predicate. '(';
659 
660  $params = Array();
661 
662  foreach ($in_login_id_array as $id) {
663  if (trim($id)) {
664  if (0 < count($params)) {
665  $sql .= ') OR (';
666  }
667  $sql.= 'login_id=?';
668  array_push($params, $id);
669  }
670  }
671 
672  $sql .= ')';
673 
674  if (0 < count($params)) {
675  $temp = $this->execute_query($sql, $params);
676  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
677  $ret = Array();
678  foreach ($temp as $result) {
679  $result = $this->_instantiate_record($result);
680  if ($result) {
681  array_push($ret, $result);
682  }
683  }
684  usort($ret, function($a, $b){return ($a->id() > $b->id());});
685  }
686  }
687 
688  // At this point, only managers (or the login object, itself) can see logins. God, too, of course.
689  $my_id = $this->access_object->get_login_id();
690  $my_login_instance_is_manager = $this->access_object->god_mode() || ($this->access_object->get_login_item() instanceof CO_Login_Manager);
691  $temp_ret = Array();
692 
693  if (isset($ret) && is_array($ret) && count($ret)) {
694  foreach ($ret as $instance) {
695  if (($instance->id() == $my_id) || $my_login_instance_is_manager) {
696  array_push($temp_ret, $instance);
697  }
698  }
699  }
700 
701  return $temp_ret;
702  }
703 
704  /***********************/
710  public function get_all_login_objects ( $and_write = false
711  ) {
712  $ret = Array();
713 
714  // Can only look for tokens we can see.
715 
716  $predicate = $this->_create_security_predicate($and_write);
717 
718  if ($predicate) { // If we got a predicate, then we AND it with the rest of the statement.
719  $predicate .= ' AND ';
720  }
721 
722  $sql = 'SELECT * FROM '.$this->table_name.' WHERE '.$predicate. '(login_id IS NOT NULL) AND (login_id<>\'\')';
723  $temp = $this->execute_query($sql, Array()); // We just get everything.
724  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
725  foreach ($temp as $result) {
726  $result = $this->_instantiate_record($result);
727  if ($result) {
728  array_push($ret, $result);
729  }
730  }
731  }
732 
733  // At this point, only managers (or the login object, itself) can see logins. God, too, of course.
734  $my_id = $this->access_object->get_login_id();
735  $my_login_instance_is_manager = $this->access_object->god_mode() || ($this->access_object->get_login_item() instanceof CO_Login_Manager);
736  $temp_ret = Array();
737 
738  foreach ($ret as $instance) {
739  if (($instance->id() == $my_id) || $my_login_instance_is_manager) {
740  array_push($temp_ret, $instance);
741  }
742  }
743 
744  return $temp_ret;
745  }
746 
747  /***********************/
755  public function get_all_login_objects_with_access( $in_security_token,
756  $and_write = false
757  ) {
758  $ret = Array();
759 
760  $in_security_token = intval($in_security_token);
761 
762  $access_ids = $this->access_object->get_security_ids();
763 
764  // Can only look for tokens we can see.
765  if (($this->access_object->god_mode() && $in_security_token) || in_array($in_security_token, $access_ids)) {
766  $predicate = $this->_create_security_predicate($and_write);
767 
768  if ($predicate) { // If we got a predicate, then we AND it with the rest of the statement.
769  $predicate .= ' AND ';
770  }
771 
772  $sql = 'SELECT * FROM '.$this->table_name.' WHERE '.$predicate.'(login_id IS NOT NULL) AND (login_id<>\'\')';
773  $temp = $this->execute_query($sql, Array()); // We just get everything.
774  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
775  $ret = Array();
776 
777  foreach ($temp as $result) {
778  $id = intval($result['id']);
779  $id_array = Array($id);
780  $ids = explode(',', $result['ids']);
781  if (isset($ids) && is_array($ids) && count($ids)) {
782  $ids = array_map('trim', $ids);
783  $ids = array_map('intval', $ids);
784 
785  foreach ($ids as $single_id) {
786  array_push($id_array, $single_id);
787  }
788  }
789 
790  $found = (2 > $in_security_token);
791 
792  if (!$found) {
793  foreach ($id_array as $test_id) {
794  if ($test_id == $in_security_token) {
795  $found = true;
796  break;
797  }
798  }
799  }
800 
801  if ($found) {
802  $result = $this->_instantiate_record($result);
803  if ($result) {
804  array_push($ret, $result);
805  }
806  }
807  }
808  }
809  }
810 
811  // At this point, only managers (or the login object, itself) can see logins. God, too, of course.
812  $my_id = $this->access_object->get_login_id();
813  $my_login_instance_is_manager = $this->access_object->god_mode() || ($this->access_object->get_login_item() instanceof CO_Login_Manager);
814  $temp_ret = Array();
815 
816  foreach ($ret as $instance) {
817  if (($instance->id() == $my_id) || $my_login_instance_is_manager) {
818  array_push($temp_ret, $instance);
819  }
820  }
821 
822  return $temp_ret;
823  }
824 
825  /***********************/
835  public function count_all_login_objects_with_access($in_security_token
836  ) {
837  $ret = -1;
838 
839  $in_security_token = intval($in_security_token);
840 
841  // No security predicate, but we do have to "own" the given token.
842  if (($this->access_object->god_mode() && $in_security_token) || in_array($in_security_token, $this->access_object->get_security_ids())) {
843  $sql = 'SELECT * FROM '.$this->table_name.' WHERE (login_id IS NOT NULL) AND (login_id<>\'\') AND (id<>?)';
844  $temp = $this->execute_query($sql, Array(intval(CO_Config::god_mode_id()))); // We just get everything.
845  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
846  $ret = 0;
847 
848  foreach ($temp as $result) {
849  $id = intval($result['id']);
850  $ids = explode(',', $result['ids']);
851  if (isset($ids) && is_array($ids) && count($ids)) {
852  $ids = array_map('trim', $ids);
853  $ids = array_map('intval', $ids);
854  array_push($ids, $id);
855  $ids = array_unique($ids);
856  foreach ($ids as $single_id) {
857  if ($single_id == $in_security_token) {
858  $ret += 1;
859  break;
860  }
861  }
862  }
863  }
864  }
865  }
866 
867  return $ret;
868  }
869 
870  /***********************/
878  public function get_all_user_objects_with_access($in_security_token
879  ) {
880  $ret = array();
881 
882  $in_security_token = intval($in_security_token);
883  $access_instance = $this->access_object;
884 
885  // No security predicate, but we do have to "own" the given token.
886  if (($access_instance->god_mode() && $in_security_token) || in_array($in_security_token, $access_instance->get_security_ids())) {
887  $sql = 'SELECT * FROM '.$this->table_name.' WHERE (login_id IS NOT NULL) AND (login_id<>\'\') AND (id<>?)';
888  $temp = $this->execute_query($sql, Array(intval(CO_Config::god_mode_id()))); // We just get everything.
889  if (isset($temp) && $temp && is_array($temp) && count($temp) ) {
890  foreach ($temp as $result) {
891  $id = intval($result['id']);
892  $ids = explode(',', $result['ids']);
893  if (isset($ids) && is_array($ids) && count($ids)) {
894  $ids = array_map('trim', $ids);
895  $ids = array_map('intval', $ids);
896  array_push($ids, $id);
897  $ids = array_unique($ids);
898  foreach ($ids as $single_id) {
899  if ($single_id == $in_security_token) {
900  array_push($ret, $id);
901  break;
902  }
903  }
904  }
905  }
906  }
907  }
908 
909  $returnVar = array();
910  foreach ($ret as $id) {
911  $temp2 = $access_instance->get_user_from_login($id);
912  if (isset($temp2) && $temp2) {
913  array_push($returnVar, $temp2);
914  }
915  }
916 
917  return $returnVar;
918  }
919 };
if(!defined( 'LGV_ADB_CATCHER'))
_create_read_security_predicate()
execute_query( $in_sql, $in_parameters=NULL, $exec_only=false)
_instantiate_record( $in_db_result)
_create_security_predicate( $write=false)
get_security_ids_for_id( $in_id, $no_personal)
get_credentials_by_api_key( $in_api_key)
get_initial_record_by_login_id( $in_login_id)
get_personal_ids_for_id( $in_id)
count_all_login_objects_with_access($in_security_token)
__construct( $in_pdo_object, $in_access_object=NULL)
get_all_user_objects_with_access($in_security_token)
remove_personal_token_from_this_login( $in_to_id, $in_id)
get_single_record_by_login_id( $in_login_id, $and_write=false)
get_initial_record_by_id( $in_id)
get_all_login_objects( $and_write=false)
get_all_personal_ids_except_for_id( $in_id=0)
get_all_login_objects_with_access( $in_security_token, $and_write=false)
add_personal_token_from_current_login( $in_to_id, $in_id)
get_multiple_records_by_login_id( $in_login_id_array, $and_write=false)