BAOBAB
co_access.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 define('__BADGER_VERSION__', '1.1.2.3000');
29 
30 if ( !defined('LGV_MD_CATCHER') ) {
31  define('LGV_MD_CATCHER', 1);
32 }
33 
34 require_once(CO_Config::db_class_dir().'/co_main_data_db.class.php');
35 
36 if ( !defined('LGV_SD_CATCHER') ) {
37  define('LGV_SD_CATCHER', 1);
38 }
39 
40 require_once(CO_Config::db_class_dir().'/co_security_db.class.php');
41 
42 if ( !defined('LGV_LANG_CATCHER') ) {
43  define('LGV_LANG_CATCHER', 1);
44 }
45 
46 require_once(CO_Config::badger_lang_class_dir().'/common.inc.php');
47 
48 /***************************************************************************************************************************/
81 class CO_Access {
82  protected $_data_db_object;
84  protected $_login_id;
85 
86  public $valid;
87  public $error;
89 
90  public $version;
91 
92  /***********************************************************************************************************************/
93  /***********************/
97  public function __construct( $in_login_id = NULL,
98  $in_hashed_password = NULL,
99  $in_raw_password = NULL,
100  $in_api_key = NULL
101  ) {
102  $this->class_description = 'The main data access class.';
103 
104  $this->_login_id = NULL;
105  $this->_data_db_object = NULL;
106  $this->_security_db_object = NULL;
107  $this->error = NULL;
108  $this->valid = false;
109  $this->version = __BADGER_VERSION__;
110 
111  if ( !defined('LGV_ERROR_CATCHER') ) {
112  define('LGV_ERROR_CATCHER', 1);
113  }
114 
115  require_once(CO_Config::badger_shared_class_dir().'/error.class.php');
116 
117  if ( !defined('LGV_DB_CATCHER') ) {
118  define('LGV_DB_CATCHER', 1);
119  }
120 
121  require_once(CO_Config::db_class_dir().'/co_pdo.class.php');
122 
123  // We only load the security DB if there was a login/password (or API key) sent in.
124  if ((isset($in_login_id) && $in_login_id) && ((isset($in_hashed_password) && $in_hashed_password) || (isset($in_raw_password) && $in_raw_password)) || (isset($in_api_key) && $in_api_key)) {
125  try {
126  $pdo_security_db = new CO_PDO(CO_Config::$sec_db_type, CO_Config::$sec_db_host, CO_Config::$sec_db_name, CO_Config::$sec_db_login, CO_Config::$sec_db_password);
127  $this->_security_db_object = new CO_Security_DB($pdo_security_db, $this);
128  $dont_create_new_api_key = false;
129 
130  // If they have provided an API key, then the first thing we do, is see if it's valid.
131  // If so, then we ignore the passed-in password and login, and use the ones provided from the API-key-related login, instead.
132  if (isset($in_api_key) && $in_api_key) {
133  $api_results = $this->_security_db_object->get_credentials_by_api_key($in_api_key);
134 
135  if (isset($api_results) && is_array($api_results) && (2 == count($api_results))) {
136  $in_login_id = $api_results['login_id'];
137  $in_hashed_password = $api_results['hashed_password'];
138  $dont_create_new_api_key = true;
139  }
140  }
141 
142  $login_record = $this->_security_db_object->get_initial_record_by_login_id($in_login_id);
143  if ($this->_security_db_object->error) {
144  $this->error = $this->_security_db_object->error;
145 
146  return;
147  }
148  if (isset($login_record) && ($login_record instanceof CO_Security_Login)) {
149  if (!$login_record->is_login_valid($in_login_id, $in_hashed_password, $in_raw_password, $dont_create_new_api_key)) {
153 
154  $this->_security_db_object = NULL;
155  return;
156  }
157  } else {
161 
162  $this->_security_db_object = NULL;
163  return;
164  }
165 
166  $this->_login_id = $login_record->id();
167  $login_record->update_db(); // This forces the login to update its last_access field and API key. We use this to track logins.
168  } catch (Exception $exception) {
172  $exception->getFile(),
173  $exception->getLine(),
174  $exception->getMessage());
175  $this->_security_db_object = NULL;
176  return;
177  }
178  }
179 
180  try {
181  $pdo_data_db = new CO_PDO(CO_Config::$data_db_type, CO_Config::$data_db_host, CO_Config::$data_db_name, CO_Config::$data_db_login, CO_Config::$data_db_password);
182  $this->_data_db_object = new CO_Main_Data_DB($pdo_data_db, $this);
183  } catch (Exception $exception) {
187  $exception->getFile(),
188  $exception->getLine(),
189  $exception->getMessage());
190  $this->_data_db_object = NULL;
191  $this->_security_db_object = NULL;
192  return;
193  }
194 
195  $this->valid = true;
196  }
197 
198  /***********************/
206  public function item_exists( $in_id,
207  $in_visibility_test = false
208  ) {
209  return $this->_data_db_object->item_exists($in_id, $in_visibility_test);
210  }
211 
212  /***********************/
220  public function get_security_ids($no_personal = false
221  ) {
222  $ret = Array();
223 
224  if ($this->god_mode()) {
225  $ret = Array(-1);
226  } else {
227  $login_id = $this->get_login_id();
228  if (isset($login_id) && $login_id && $this->_security_db_object) {
229  $ret = $this->_security_db_object->get_security_ids_for_id($this->get_login_id(), $no_personal);
230 
231  if ($this->_security_db_object->error) {
232  $this->error = $this->_security_db_object->error;
233 
234  $ret = Array();
235  } else {
236  array_unshift($ret, 1); // We always add 1, as that's the "all logged-in users" token.
237  }
238  }
239  }
240  return $ret;
241  }
242 
243  /***********************/
251  public function get_personal_security_ids() {
252  $ret = Array();
253 
254  if (CO_Config::use_personal_tokens()) {
255  $login_id = $this->get_login_id();
256  if (isset($login_id) && $login_id && $this->_security_db_object) {
257  $ret = $this->_security_db_object->get_personal_ids_for_id($login_id);
258 
259  if ($this->_security_db_object->error) {
260  $this->error = $this->_security_db_object->error;
261  $ret = Array();
262  }
263  }
264  }
265  return $ret;
266  }
267 
268  /***********************/
276  public function get_all_personal_ids_except_for_id( $in_id = 0
277  ) {
278  $ret = $this->_security_db_object->get_all_personal_ids_except_for_id($in_id);
279 
280  if ($this->_security_db_object->error) {
281  $this->error = $this->_security_db_object->error;
282  $ret = Array();
283  }
284 
285  return $ret;
286  }
287 
288  /***********************/
295  public function get_logins_with_personal_ids() {
296  $ret = $this->_security_db_object->get_logins_with_personal_ids();
297 
298  if ($this->_security_db_object->error) {
299  $this->error = $this->_security_db_object->error;
300  $ret = Array();
301  }
302 
303  return $ret;
304  }
305 
306  /***********************/
312  public function is_this_a_personal_id( $in_id
313  ) {
314  $ret = $this->_security_db_object->is_this_a_personal_id($in_id);
315 
316  if ($this->_security_db_object->error) {
317  $this->error = $this->_security_db_object->error;
318  } else {
319  return $ret;
320  }
321 
322  return false;
323  }
324 
325  /***********************/
331  public function add_personal_token_from_current_login( $in_to_id,
332  $in_id
333  ) {
334  if (in_array($in_id, $this->get_personal_security_ids())) {
335  $ret = $this->_security_db_object->add_personal_token_from_current_login($in_to_id, $in_id);
336 
337  if ($this->_security_db_object->error) {
338  $this->error = $this->_security_db_object->error;
339  } else {
340  return $ret;
341  }
342  }
343 
344  return false;
345  }
346 
347  /***********************/
353  public function remove_personal_token_from_this_login( $in_to_id,
354  $in_id
355  ) {
356  if (in_array($in_id, $this->get_personal_security_ids())) {
357  $ret = $this->_security_db_object->remove_personal_token_from_this_login($in_to_id, $in_id);
358 
359  if ($this->_security_db_object->error) {
360  $this->error = $this->_security_db_object->error;
361  } else {
362  return $ret;
363  }
364  }
365 
366  return false;
367  }
368 
369  /***********************/
376  return $this->_security_db_object->get_logins_that_have_any_of_my_ids();
377  }
378 
379  /***********************/
385  public function is_this_a_login_id( $in_id
386  ) {
387  $ret = $this->_security_db_object->is_this_a_login_id($in_id);
388 
389  if ($this->_security_db_object->error) {
390  $this->error = $this->_security_db_object->error;
391  } else {
392  return $ret;
393  }
394 
395  return false;
396  }
397 
398  /***********************/
404  public function get_available_tokens($no_personal = false
405  ) {
406  $ret = Array();
407 
408  if ($this->god_mode()) {
409  $logins = $this->_security_db_object->get_all_readable_records();
410 
411  foreach ($logins as $login) {
412  $ret[] = $login->id();
413  }
414  } else {
415  $login_id = $this->get_login_id();
416  if (isset($login_id) && $login_id && $this->_security_db_object) {
417  $ret = $this->_security_db_object->get_security_ids_for_id($this->get_login_id(), $no_personal);
418 
419  if ($this->_security_db_object->error) {
420  $this->error = $this->_security_db_object->error;
421 
422  $ret = Array();
423  } else {
424  $ret[] = 1;
425  }
426  }
427  }
428 
429  sort($ret);
430  array_unshift($ret, $this->get_login_id());
431  $ret = array_values(array_unique($ret));
432 
433  return $ret;
434  }
435 
436  /***********************/
440  public function main_db_available() {
441  return NULL != $this->_data_db_object;
442  }
443 
444  /***********************/
448  public function get_login_id( $in_login_id = NULL
449  ) {
450  $ret = $this->_login_id;
451 
452  $in_login_id = intval($in_login_id);
453 
454  // See if they are looking up an ID for another login.
455  if ($in_login_id) {
456  $ret = 0; // If the lookup fails, we get back 0.
457 
458  $record = $this->get_single_security_record_by_id($login_id);
459 
460  if ($record) {
461  $ret = $record->id();
462  }
463  }
464 
465  return $ret;
466  }
467 
468  /***********************/
476  public function get_login_item( $in_login_id = NULL
477  ) {
478  $login_id = 0;
479 
480  if (isset($in_login_id) && (0 < intval($in_login_id))) {
481  $login_id = intval($in_login_id);
482  } else {
483  $login_id = $this->get_login_id();
484  }
485 
486  $ret = (1 < $login_id) ? $this->get_single_security_record_by_id($login_id) : NULL;
487 
488  return $ret;
489  }
490 
491  /***********************/
495  public function get_lang( $in_login_id = NULL
496  ) {
497  $ret = CO_Config::$lang;
498 
499  $login_item = $this->get_login_item($in_login_id);
500 
501  if ($login_item) {
502  $ret = $login_item->get_lang();
503  }
504 
505  return $ret;
506  }
507 
508  /***********************/
512  public function god_mode() {
513  // We look at the hard property (as opposed to using the accessor) just to avoid subclasses messing with things.
514  return intval($this->_login_id) == intval(CO_Config::god_mode_id());
515  }
516 
517  /***********************/
521  public function check_login_exists( $in_login_id
522  ) {
523  $ret = NULL;
524 
525  if ($this->security_db_available()) {
526  $ret = false;
527 
528  if ($this->_security_db_object->get_initial_record_by_id(intval($in_login_id))) {
529  $ret = true;
530  }
531  }
532 
533  return $ret;
534  }
535 
536  /***********************/
540  public function get_remaining_time($in_login_id = NULL
541  ) {
542  return $this->get_login_item($in_login_id)->get_remaining_time();
543  }
544 
545  /***********************/
549  public function check_login_exists_by_login_string( $in_login_id_string
550  ) {
551  $ret = NULL;
552 
553  if ($this->security_db_available()) {
554  $ret = false;
555 
556  if ($this->_security_db_object->get_initial_record_by_login_id($in_login_id_string)) {
557  $ret = true;
558  }
559  }
560 
561  return $ret;
562  }
563 
564  /***********************/
568  public function get_login_item_by_login_string( $in_login_id_string
569  ) {
570  $ret = NULL;
571 
572  if ($this->security_db_available()) {
573  $ret = $this->_security_db_object->get_single_record_by_login_id($in_login_id_string);
574  }
575 
576  return $ret;
577  }
578 
579  /***********************/
583  public function check_user_exists( $in_login_id
584  ) {
585  // We first check for a login.
586  $ret = $this->check_login_exists($in_login_id);
587 
588  if (NULL == $ret) {
589  $ret = false;
590  } elseif (true == $ret) { // If it exists, we check further, for a user with that login.
591  $ret = $this->_data_db_object->see_if_user_exists($in_login_id);
592  }
593 
594  return $ret;
595  }
596 
597  /***********************/
605  public function make_new_blank_record( $in_classname
606  ) {
607  $ret = NULL;
608 
609  // We create an empty instance to test which database gets assigned.
610  if ($in_classname) {
611  $filename = CO_Config::db_classes_class_dir().'/'.strtolower($in_classname).'.class.php';
612  if (!class_exists($in_classname)) {
613  if (!file_exists($filename)) {
614  $filename = NULL;
615 
616  $dir_array = CO_Config::db_classes_extension_class_dir();
617 
618  if (!is_array($dir_array)) {
619  $dir_array = Array($dir_array);
620  }
621 
622  foreach ($dir_array as $dir) {
623  $filename = $dir.'/'.strtolower($in_classname).'.class.php';
624  if (file_exists($filename)) {
625  require_once($filename);
626  break;
627  } else {
628  $filename = NULL;
629  }
630  }
631  } else {
632  require_once($filename);
633  }
634 
635  if (!$filename) {
639  __FILE__,
640  __LINE__,
641  __METHOD__
642  );
643  return NULL;
644  }
645  }
646 
647  if (class_exists($in_classname) && $this->_data_db_object && $this->_security_db_object) { // Quick test. Not allowed to do anything unless we are logged in.
648  $test_instance = new $in_classname();
649 
650  if ($test_instance instanceof CO_Main_DB_Record) {
651  $ret = new $in_classname($this->_data_db_object);
652  } elseif ($test_instance instanceof CO_Security_Node) {
653  $ret = new $in_classname($this->_security_db_object);
654  }
655 
656  if ($ret) {
657  $ret->write_security_id = intval($this->get_login_id());
658  $ret->update_db(); // Make sure it gets saved.
659  } else {
663  __FILE__,
664  __LINE__,
665  __METHOD__
666  );
667  }
668  } elseif (!$this->_security_db_object) {
672  __FILE__,
673  __LINE__,
674  __METHOD__
675  );
676  } else {
680  __FILE__,
681  __LINE__,
682  __METHOD__
683  );
684  }
685  }
686 
687  return $ret;
688  }
689 
690  /***********************/
698  public function get_multiple_data_records_by_id( $in_id_array
699  ) {
700  $ret = NULL;
701 
702  if (isset($this->_data_db_object) && $this->_data_db_object) {
703  $ret = $this->_data_db_object->get_multiple_records_by_id($in_id_array);
704  if ($this->_data_db_object->error) {
705  $this->error = $this->_data_db_object->error;
706 
707  return NULL;
708  }
709  }
710 
711  return $ret;
712  }
713 
714  /***********************/
720  public function get_single_data_record_by_id( $in_id
721  ) {
722  $ret = NULL;
723 
724  $tmp = $this->get_multiple_data_records_by_id(Array($in_id));
725  if (isset($tmp) && is_array($tmp) && (1 == count($tmp))) {
726  $ret = $tmp[0];
727  }
728 
729  return $ret;
730  }
731 
732  /***********************/
740  public function get_data_access_class_by_id( $in_id
741  ) {
742  $ret = NULL;
743  if (isset($this->_data_db_object) && $this->_data_db_object) {
744  $ret = $this->_data_db_object->get_access_class_by_id($in_id);
745  $this->error = $this->_data_db_object->error;
746  }
747 
748  return $ret;
749  }
750 
751  /***********************/
759  public function get_security_access_class_by_id( $in_id
760  ) {
761  $ret = NULL;
762  if (isset($this->_security_db_object) && $this->_security_db_object) {
763  $ret = $this->_security_db_object->get_access_class_by_id($in_id);
764  $this->error = $this->_security_db_object->error;
765  }
766 
767  return $ret;
768  }
769 
770  /***********************/
778  public function can_i_see_this_data_record( $in_id
779  ) {
780  $ret = false;
781 
782  if (isset($this->_data_db_object) && $this->_data_db_object) {
783  $ret = $this->_data_db_object->can_i_see_this_record($in_id);
784  $this->error = $this->_data_db_object->error;
785  }
786 
787  return $ret;
788  }
789 
790  /***********************/
798  public function can_i_see_this_security_record( $in_id
799  ) {
800  $ret = false;
801 
802  if (isset($this->_security_db_object) && $this->_security_db_object) {
803  $ret = $this->_security_db_object->can_i_see_this_record($in_id);
804  $this->error = $this->_security_db_object->error;
805  }
806 
807  return $ret;
808  }
809 
810  /***********************/
816  public function get_all_data_readable_records( $open_only = false,
817  $in_this_id = NULL
818  ) {
819  $ret = NULL;
820 
821  if (isset($this->_data_db_object) && $this->_data_db_object) {
822  $ret = $this->_data_db_object->get_all_readable_records($open_only, $in_this_id);
823  $this->error = $this->_data_db_object->error;
824  }
825 
826  return $ret;
827  }
828 
829  /***********************/
835  public function get_all_data_writeable_records( $in_this_id = NULL
836  ) {
837  $ret = NULL;
838 
839  if (isset($this->_data_db_object) && $this->_data_db_object) {
840  $ret = $this->_data_db_object->get_all_writeable_records($in_this_id);
841 
842  if ($this->_data_db_object->error) {
843  $this->error = $this->_data_db_object->error;
844 
845  return NULL;
846  }
847  }
848 
849  return $ret;
850  }
851 
852  /***********************/
856  public function security_db_available() {
857  return NULL != $this->_security_db_object;
858  }
859 
860  /***********************/
866  public function i_have_this_token( $in_token_to_test
867  ) {
868  $ret = $this->god_mode(); // God sees everything.
869 
870  if (!$ret && isset($in_token_to_test) && ctype_digit(strval($in_token_to_test))) {
871  if (0 == intval($in_token_to_test)) {
872  $ret = true;
873  } elseif (1 == intval($in_token_to_test)) {
874  $ret = $this->security_db_available();
875  } else {
876  $tokens = $this->get_security_ids();
877 
878  if (isset($tokens) && is_array($tokens) && count($tokens)) {
879  $ret = in_array(intval($in_token_to_test), $tokens);
880  }
881  }
882  }
883 
884  return $ret;
885  }
886 
887  /***********************/
895  public function get_multiple_security_records_by_id( $in_id_array
896  ) {
897  $ret = NULL;
898 
899  if (isset($this->_security_db_object) && $this->_security_db_object) {
900  $ret = $this->_security_db_object->get_multiple_records_by_id($in_id_array);
901 
902  if ($this->_security_db_object->error) {
903  $this->error = $this->_security_db_object->error;
904 
905  return NULL;
906  }
907  }
908 
909  return $ret;
910  }
911 
912  /***********************/
918  public function get_single_security_record_by_id( $in_id
919  ) {
920  $ret = NULL;
921 
922  $tmp = $this->get_multiple_security_records_by_id(Array($in_id));
923 
924  if (isset($tmp) && is_array($tmp) && (1 == count($tmp))) {
925  $ret = $tmp[0];
926  }
927 
928  return $ret;
929  }
930 
931  /***********************/
937  public function get_all_security_readable_records( $in_this_id = NULL
938  ) {
939  $ret = NULL;
940 
941  if (isset($this->_security_db_object) && $this->_security_db_object) {
942  $ret = $this->_security_db_object->get_all_readable_records($in_this_id);
943 
944  if ($this->_security_db_object->error) {
945  $this->error = $this->_security_db_object->error;
946 
947  return NULL;
948  }
949  }
950 
951  return $ret;
952  }
953 
954  /***********************/
960  public function get_all_security_writeable_records( $in_this_id = NULL
961  ) {
962  $ret = NULL;
963 
964  if (isset($this->_security_db_object) && $this->_security_db_object) {
965  $ret = $this->_security_db_object->get_all_writeable_records($in_this_id);
966 
967  if ($this->_security_db_object->error) {
968  $this->error = $this->_security_db_object->error;
969 
970  return NULL;
971  }
972  }
973 
974  return $ret;
975  }
976 
977  /***********************/
987  public function write_data_record( $params_associative_array
988  ) {
989  $ret = false;
990 
991  if (isset($this->_data_db_object) && $this->_data_db_object) {
992  $ret = $this->_data_db_object->write_record($params_associative_array);
993  $this->error = $this->_data_db_object->error;
994  }
995 
996  return $ret;
997  }
998 
999  /***********************/
1005  public function delete_data_record( $id
1006  ) {
1007  $ret = false;
1008 
1009  if (isset($this->_data_db_object) && $this->_data_db_object) {
1010  $ret = $this->_data_db_object->delete_record($id);
1011  $this->error = $this->_data_db_object->error;
1012  }
1013 
1014  return $ret;
1015  }
1016 
1017  /***********************/
1026  public function generic_search( $in_search_parameters = NULL,
1054  $or_search = false,
1055  $page_size = 0,
1056  $initial_page = 0,
1057  $and_writeable = false,
1058  $count_only = false,
1059  $ids_only = false
1060  ) {
1061  $ret = Array();
1062 
1063  if (isset($this->_data_db_object) && $this->_data_db_object) {
1064  $ret = $this->_data_db_object->generic_search($in_search_parameters, $or_search, $page_size, $initial_page, $and_writeable, $count_only, $ids_only);
1065  $this->error = $this->_data_db_object->error;
1066  }
1067 
1068  return $ret;
1069  }
1070 
1071  /***********************/
1077  public function get_all_login_objects ( $and_write = false
1078  ) {
1079  if (!isset($this->_security_db_object) || !$this->_security_db_object) {
1080  return Array();
1081  }
1082 
1083  return $this->_security_db_object->get_all_login_objects($and_write);
1084  }
1085 
1086  /***********************/
1092  public function get_all_tokens ( ) {
1093  return $this->_security_db_object->get_all_tokens();
1094  }
1095 
1096  /***********************/
1104  public function get_all_login_objects_with_access( $in_security_token,
1105  $and_write = false
1106  ) {
1107  if (!isset($this->_security_db_object) || !$this->_security_db_object) {
1108  return Array();
1109  }
1110 
1111  return $this->_security_db_object->get_all_login_objects_with_access($in_security_token, $and_write);
1112  }
1113 
1114  /***********************/
1122  public function get_all_user_objects_with_access( $in_security_token
1123  ) {
1124  if (!isset($this->_security_db_object) || !$this->_security_db_object) {
1125  return Array();
1126  }
1127 
1128  return $this->_security_db_object->get_all_user_objects_with_access($in_security_token);
1129  }
1130 };
const __BADGER_VERSION__
if(!defined( 'LGV_MD_CATCHER'))
This class provides a genericized interface to the PHP PDO toolkit.
static $access_error_code_class_not_created
Definition: common.inc.php:55
static $access_error_code_user_not_authorized
Definition: common.inc.php:53
static $pdo_error_code_invalid_login
Definition: common.inc.php:44
static $pdo_error_code_failed_to_open_data_db
Definition: common.inc.php:42
static $access_error_code_class_file_not_found
Definition: common.inc.php:54
static $pdo_error_code_failed_to_open_security_db
Definition: common.inc.php:43
static $pdo_error_name_failed_to_open_security_db
Definition: en.php:35
static $pdo_error_name_failed_to_open_data_db
Definition: en.php:32
static $pdo_error_desc_failed_to_open_security_db
Definition: en.php:36
static $pdo_error_name_invalid_login
Definition: en.php:38
static $access_error_name_user_not_authorized
Definition: en.php:58
static $access_error_name_class_file_not_found
Definition: en.php:60
static $pdo_error_desc_failed_to_open_data_db
Definition: en.php:33
static $access_error_desc_class_file_not_found
Definition: en.php:61
static $access_error_name_class_not_created
Definition: en.php:62
static $access_error_desc_user_not_authorized
Definition: en.php:59
static $access_error_desc_class_not_created
Definition: en.php:63
static $pdo_error_desc_invalid_login
Definition: en.php:39
$_data_db_object
This is the instance of the class representing the "data" database. This will always be instantiated.
generic_search( $in_search_parameters=NULL, $or_search=false, $page_size=0, $initial_page=0, $and_writeable=false, $count_only=false, $ids_only=false)
get_all_personal_ids_except_for_id( $in_id=0)
make_new_blank_record( $in_classname)
get_all_data_readable_records( $open_only=false, $in_this_id=NULL)
check_login_exists_by_login_string( $in_login_id_string)
get_available_tokens($no_personal=false)
get_login_item_by_login_string( $in_login_id_string)
get_multiple_security_records_by_id( $in_id_array)
get_all_user_objects_with_access( $in_security_token)
get_data_access_class_by_id( $in_id)
can_i_see_this_security_record( $in_id)
delete_data_record( $id)
__construct( $in_login_id=NULL, $in_hashed_password=NULL, $in_raw_password=NULL, $in_api_key=NULL)
$version
This will contain the BADGER Version.
get_remaining_time($in_login_id=NULL)
item_exists( $in_id, $in_visibility_test=false)
get_all_security_readable_records( $in_this_id=NULL)
$class_description
This is a brief textual description of the class.
get_login_item( $in_login_id=NULL)
is_this_a_login_id( $in_id)
$_login_id
This is an integer, containing the security DB ID of the logged-in user. It will be NULL for no login...
check_login_exists( $in_login_id)
get_logins_with_personal_ids()
write_data_record( $params_associative_array)
get_multiple_data_records_by_id( $in_id_array)
remove_personal_token_from_this_login( $in_to_id, $in_id)
add_personal_token_from_current_login( $in_to_id, $in_id)
get_logins_that_have_any_of_my_ids()
check_user_exists( $in_login_id)
$_security_db_object
This is the instance of the class representing the "scurity" database. This may not be instantiated,...
get_all_login_objects( $and_write=false)
get_all_login_objects_with_access( $in_security_token, $and_write=false)
$error
If there was an error, it will be held here.
is_this_a_personal_id( $in_id)
get_all_data_writeable_records( $in_this_id=NULL)
can_i_see_this_data_record( $in_id)
get_security_access_class_by_id( $in_id)
get_login_id( $in_login_id=NULL)
$valid
This will be true, if the instance is "valid" (has at least an initialized "data" database).
get_lang( $in_login_id=NULL)
i_have_this_token( $in_token_to_test)
get_all_security_writeable_records( $in_this_id=NULL)
get_single_security_record_by_id( $in_id)
get_single_data_record_by_id( $in_id)
get_personal_security_ids()
get_security_ids($no_personal=false)
This class provides a general error report, with file, method and error information.
Definition: error.class.php:32