27 defined(
'LGV_BASALT_CATCHER' ) or die ( 'Cannot Execute Directly' );
41 $in_additional_info =
false
43 $ret = parent::_get_short_description($in_object, $in_additional_info);
46 $ret[
'login_id'] = $in_object->login_id;
61 $ret = parent::_get_long_description($in_login_object);
63 $user_item = $in_login_object->get_user_object();
65 if ($in_login_object->id() == $in_login_object->get_access_object()->get_login_id()) {
66 $ret[
'current_login'] =
true;
70 $ret[
'user_object_id'] = $user_item->id();
73 $ret[
'login_id'] = $in_login_object->login_id;
74 $ret[
'is_manager'] = $in_login_object->is_manager();
75 $ret[
'is_main_admin'] = $in_login_object->is_god();
76 $security_tokens = $in_login_object->get_access_object()->god_mode() && $in_login_object->is_god() ? $in_login_object->get_access_object()->get_all_tokens() : $in_login_object->ids();
77 if (isset($security_tokens) && is_array($security_tokens) && count($security_tokens)) {
78 $ret[
'security_tokens'] = $security_tokens;
80 $personal_tokens = $in_login_object->personal_ids();
81 if (isset($personal_tokens) && is_array($personal_tokens) && count($personal_tokens)) {
82 $ret[
'personal_tokens'] = $personal_tokens;
85 $api_key = $in_login_object->get_api_key();
86 $key_age = $in_login_object->get_api_key_age_in_seconds();
90 $ret[
'current_api_key'] =
true;
92 if ($in_login_object->get_access_object()->god_mode()) {
93 $ret[
'api_key'] = $api_key;
96 $ret[
'api_key_age_in_seconds'] = $key_age;
111 $in_with_login_info =
false,
112 $in_show_parents =
false
114 $ret = parent::_get_long_description($in_user_object, $in_show_parents);
116 $test_string = $in_user_object->get_surname();
117 if (isset($test_string) && trim($test_string)) {
118 $ret[
'surname'] = $test_string;
121 $test_string = $in_user_object->get_middle_name();
122 if (isset($test_string) && trim($test_string)) {
123 $ret[
'middle_name'] = $test_string;
126 $test_string = $in_user_object->get_given_name();
127 if (isset($test_string) && trim($test_string)) {
128 $ret[
'given_name'] = $test_string;
131 $test_string = $in_user_object->get_prefix();
132 if (isset($test_string) && trim($test_string)) {
133 $ret[
'prefix'] = $test_string;
136 $test_string = $in_user_object->get_suffix();
137 if (isset($test_string) && trim($test_string)) {
138 $ret[
'suffix'] = $test_string;
141 $test_string = $in_user_object->get_nickname();
142 if (isset($test_string) && trim($test_string)) {
143 $ret[
'nickname'] = $test_string;
146 $tags = $in_user_object->tags();
147 if (isset($tags) && is_array($tags) && count($tags)) {
148 $test_string = $tags[7];
149 if (isset($test_string) && trim($test_string)) {
150 $ret[
'tag7'] = $test_string;
153 $test_string = $tags[8];
154 if (isset($test_string) && trim($test_string)) {
155 $ret[
'tag8'] = $test_string;
158 $test_string = $tags[9];
159 if (isset($test_string) && trim($test_string)) {
160 $ret[
'tag9'] = $test_string;
164 $ret[
'is_manager'] = $in_user_object->is_manager();
166 $ret[
'is_main_admin'] = $in_user_object->is_god();
168 if ($in_with_login_info) {
169 $login_instance = $in_user_object->get_login_instance();
171 if ($login_instance->id() == $in_user_object->get_access_object()->get_login_id()) {
172 $ret[
'current_login'] =
true;
175 $ret[
'associated_login'] = $this->_get_long_description($login_instance);
178 $login_instance = $in_user_object->get_login_instance();
180 $ret[
'associated_login_id'] = $login_instance->id();
192 return $this->_process_xsd(dirname(__FILE__).
'/schema.xsd');
206 $show_details = isset($in_query) && is_array($in_query) && isset($in_query[
'show_details']);
207 $logged_in = isset($in_query) && is_array($in_query) && isset($in_query[
'logged_in']) && $in_andisol_instance->manager();
208 $my_info = isset($in_path) && is_array($in_path) && (0 < count($in_path) && (
'my_info' == $in_path[0]));
209 $writeable = isset($in_query) && is_array($in_query) && isset($in_query[
'writeable']);
211 if (isset($my_info) && $my_info) {
212 if ($in_andisol_instance->logged_in()) {
213 $login = $in_andisol_instance->current_login();
215 $ret[
'my_info'] = $this->_get_long_description($login);
217 header(
'HTTP/1.1 400 No Login Available');
221 header(
'HTTP/1.1 403 Forbidden');
224 } elseif (isset($in_path) && is_array($in_path) && (0 < count($in_path))) {
227 $login_id_list = array_map(
'trim', explode(
',', $in_path[0]));
229 $is_numeric = array_reduce($login_id_list,
function($carry, $item){
return $carry && ctype_digit($item); },
true);
231 $login_id_list = $is_numeric ? array_map(
'intval', $login_id_list) : $login_id_list;
233 if (!$is_numeric && (1 == count($login_id_list)) && trim($login_id_list[0]) && isset($in_query) && is_array($in_query) && (3 == count($in_query)) && isset($in_query[
'test']) && $in_query[
'test'] && $in_andisol_instance->manager()) {
234 if ($in_andisol_instance->check_login_exists_by_login_string(trim($login_id_list[0]))) {
235 $ret = [
'login_exists' =>
true];
237 $ret = [
'login_exists' =>
false];
240 foreach ($login_id_list as $id) {
241 if (($is_numeric && (0 < $id)) || !$is_numeric) {
242 $login_instance = $is_numeric ? $in_andisol_instance->get_login_item($id) : $in_andisol_instance->get_login_item_by_login_string($id);
243 if (isset($login_instance) && ($login_instance instanceof
CO_Security_Login) && (!$writeable || $login_instance->user_can_write())) {
244 if (!$logged_in || ($logged_in && $login_instance->get_api_key())) {
246 $ret[] = $this->_get_long_description($login_instance);
248 $ret[] = $this->_get_short_description($login_instance);
256 $login_id_list = $in_andisol_instance->get_all_login_users();
257 if ($in_andisol_instance->manager()) {
258 $login_id_list = $in_andisol_instance->get_all_logins();
259 if (0 < count($login_id_list)) {
260 foreach ($login_id_list as $login_instance) {
261 if (isset($login_instance) && ($login_instance instanceof
CO_Security_Login) && (!$writeable || $login_instance->user_can_write())) {
262 if (!$logged_in || ($logged_in && $login_instance->get_api_key())) {
264 $ret[] = $this->_get_long_description($login_instance);
266 $ret[] = $this->_get_short_description($login_instance);
273 header(
'HTTP/1.1 403 Forbidden');
291 $in_show_parents =
false
295 $logins_to_edit = [];
297 $also_delete_user =
false;
299 if (isset($in_query) && is_array($in_query) && count($in_query) && isset($in_query[
'delete_user'])) {
300 $also_delete_user =
true;
303 $my_info = isset($in_path) && is_array($in_path) && (0 < count($in_path) && (
'my_info' == $in_path[0]));
305 if (isset($my_info) && $my_info) {
306 $logins_to_edit = [$in_andisol_instance->current_login()];
307 } elseif (isset($in_path) && is_array($in_path) && (0 < count($in_path))) {
309 $login_id_list = array_map(
'trim', explode(
',', $in_path[0]));
311 $is_numeric = array_reduce($login_id_list,
function($carry, $item){
return $carry && ctype_digit($item); },
true);
313 $login_id_list = $is_numeric ? array_map(
'intval', $login_id_list) : $login_id_list;
315 foreach ($login_id_list as $id) {
316 if (($is_numeric && (0 < $id)) || !$is_numeric) {
317 $login_instance = $is_numeric ? $in_andisol_instance->get_login_item($id) : $in_andisol_instance->get_login_item_by_login_string($id);
318 if (isset($login_instance) && ($login_instance instanceof
CO_Security_Login) && $login_instance->user_can_write()) {
319 if ((
'DELETE' == $in_http_method) && $also_delete_user) {
320 $user_instance = $login_instance->get_user_object();
321 if ($user_instance->user_can_write()) {
322 $logins_to_edit[] = $login_instance;
325 $logins_to_edit[] = $login_instance;
330 } elseif ($in_andisol_instance->manager()) {
331 $login_id_list = $in_andisol_instance->get_all_logins();
332 if (0 < count($login_id_list)) {
333 foreach ($login_id_list as $login_instance) {
334 if (isset($login_instance) && ($login_instance instanceof
CO_Security_Login) && $login_instance->user_can_write()) {
335 if ((
'DELETE' == $in_http_method) && $also_delete_user) {
336 $user_instance = $login_instance->get_user_object();
337 if ($user_instance->user_can_write()) {
338 $logins_to_edit[] = $login_instance;
341 $logins_to_edit[] = $login_instance;
348 if ((
'POST' == $in_http_method) && $in_andisol_instance->manager()) {
349 $ret = $this->_handle_edit_logins_post($in_andisol_instance, $in_path, $in_query);
350 } elseif (isset($logins_to_edit) && is_array($logins_to_edit) && count($logins_to_edit)) {
351 if ((
'DELETE' == $in_http_method) && $in_andisol_instance->manager()) {
352 if (!$also_delete_user) {
353 $in_show_parents =
false;
355 $ret = $this->_handle_edit_logins_delete($in_andisol_instance, $logins_to_edit, $in_query, $also_delete_user, $in_show_parents);
356 } elseif (
'PUT' == $in_http_method) {
357 $ret = $this->_handle_edit_logins_put($in_andisol_instance, $logins_to_edit, $in_query);
380 if ($in_andisol_instance->manager()) {
382 $is_manager = isset($in_query) && is_array($in_query) && isset($in_query[
'is_manager']);
383 if (isset($in_query[
'is_manager'])) {
384 unset($in_query[
'is_manager']);
388 $login_string = (isset($in_query[
'login_string']) && trim($in_query[
'login_string'])) ? trim($in_query[
'login_string']) : NULL;
391 if (isset($in_path) && is_array($in_path) && (0 < count($in_path)) && trim($in_path[0])) {
392 $login_id = trim($in_path[0]);
393 } elseif (isset($in_query) && isset($in_query[
'login_id']) && trim($in_query[
'login_id'])) {
394 $login_id = trim($in_query[
'login_id']);
398 $login_string = $login_id;
402 $params = $this->_build_login_mod_list($in_andisol_instance, $in_query);
404 if (isset($params[
'lang']) && trim($params[
'lang'])) {
405 $lang = trim($params[
'lang']);
408 if (isset($params[
'name']) && trim($params[
'name'])) {
409 $name = trim($params[
'name']);
412 if (isset($params[
'read_token']) && intval($params[
'read_token'])) {
413 $read_token = intval($params[
'read_token']);
416 if (isset($params[
'write_token']) && intval($params[
'write_token'])) {
417 $write_token = intval($params[
'write_token']);
425 $password = isset($params[
'password']) ? $params[
'password'] : NULL;
427 if (!$password || (strlen($password) < CO_Config::$min_pw_len)) {
428 $password = substr(str_shuffle(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"), 0, CO_Config::$min_pw_len + 2);
431 $number_of_personal_tokens = (isset($in_query[
'number_of_personal_tokens']) && trim($in_query[
'number_of_personal_tokens'])) ? intval(trim($in_query[
'number_of_personal_tokens'])) : 0;
434 $new_login = $in_andisol_instance->create_new_manager_login($login_string, $password, $number_of_personal_tokens);
436 $new_login = $in_andisol_instance->create_new_standard_login($login_string, $password, $number_of_personal_tokens);
441 $result = $new_login->set_lang(
$lang);
444 $tokens = isset($params[
'tokens']) ? $params[
'tokens'] : NULL;
445 $id = $new_login->id();
448 if ($result && $name) {
449 $result = $new_login->set_name($name);
451 $result = $new_login->set_name($login_string);
454 if (isset($tokens) && is_array($tokens) && count($tokens)) {
455 $new_login->set_ids($tokens);
459 header(
'HTTP/1.1 400 Error Creating Login');
463 if (isset($read_token)) {
464 $new_login->set_read_security_id($read_token);
467 if (isset($write_token)) {
468 $new_login->set_write_security_id($write_token);
471 $ret = Array(
'new_login' => $this->_get_long_description($new_login));
472 $ret[
'new_login'][
'password'] = $password;
475 header(
'HTTP/1.1 403 Forbidden');
479 header(
'HTTP/1.1 400 Login String Required');
483 header(
'HTTP/1.1 403 Forbidden');
499 $in_also_delete_user =
false,
500 $in_show_parents =
false
504 if ($in_andisol_instance->manager()) {
505 $ret = Array (
'deleted_logins' => []);
507 if ($in_also_delete_user) {
508 $ret[
'deleted_users'] = [];
511 foreach ($in_logins_to_edit as $login_object) {
512 if ($login_object->id() != CO_Config::god_mode_id()) {
513 if ($in_also_delete_user) {
514 $user_object = $login_object->get_user_object();
515 if (isset($user_object) && $user_object->user_can_write()) {
516 $desc = $this->_get_long_user_description($user_object);
517 if (!$user_object->delete_from_db()) {
518 header(
'HTTP/1.1 400 Unable to Delete User');
521 $ret[
'deleted_users'][] = $desc;
526 $desc = $this->_get_long_description($login_object);
527 if (!$login_object->delete_from_db()) {
528 header(
'HTTP/1.1 400 Unable to Delete Login');
531 $ret[
'deleted_logins'][] = $desc;
534 header(
'HTTP/1.1 400 Cannot Delete Main Admin Login');
539 header(
'HTTP/1.1 403 Forbidden');
557 $params = $this->_build_login_mod_list($in_andisol_instance, $in_query);
562 $login_string = NULL;
566 $personal_tokens = NULL;
567 $convert_to_manager = NULL;
568 $convert_to_login = NULL;
571 if (isset($in_query[
'convert_to_manager'])) {
572 $convert_to_manager =
true;
576 if (!$convert_to_manager && isset($in_query[
'convert_to_login'])) {
577 $convert_to_login =
true;
580 if (isset($params[
'lang']) && trim($params[
'lang'])) {
581 $lang = trim($params[
'lang']);
584 if (isset($params[
'name']) && trim($params[
'name'])) {
585 $name = trim($params[
'name']);
588 if (isset($params[
'password']) && trim($params[
'password'])) {
589 $password = trim($params[
'password']);
592 if (isset($params[
'login_string']) && trim($params[
'login_string'])) {
593 $login_string = trim($params[
'login_string']);
596 if (isset($params[
'read_token']) && $params[
'read_token']) {
597 $read_token = intval($params[
'read_token']);
600 if (isset($params[
'write_token']) && $params[
'write_token']) {
601 $write_token = intval($params[
'write_token']);
604 if (isset($params[
'tokens'])) {
605 $tokens = array_filter(array_map(
'intval', $params[
'tokens']),
function($i) {
return intval($i) > 0; } );
609 if (isset($params[
'personal_tokens'])) {
610 $personal_tokens = array_filter(array_map(
'intval', $params[
'personal_tokens']),
function($i) {
return intval($i) > 0; } );
611 sort($personal_tokens);
614 foreach ($in_logins_to_edit as $login_instance) {
616 $login_report = Array(
'before' => $this->_get_long_description($login_instance));
617 $login_changed =
false;
618 $changed_password = NULL;
619 $can_edit = $login_instance->user_can_edit_ids();
622 if (isset($tokens) && $can_edit) {
625 foreach ($tokens as $token) {
626 $token = intval($token);
627 if ($in_andisol_instance->i_have_this_token(abs($token))) {
628 $new_tokens[] = $token;
632 $result = $login_instance->set_ids($new_tokens);
635 $login_changed =
true;
640 if (isset($personal_tokens) && $in_andisol_instance->god()) {
641 $result = $login_instance->set_personal_ids($personal_tokens);
642 if ($result || !$personal_tokens || !count($personal_tokens)) {
643 $login_changed =
true;
650 if ($in_andisol_instance->god()) {
651 $original_login = $login_instance->login_id;
652 $login_instance->login_id = $login_string;
654 $result = $login_instance->update_db();
657 $result = $login_instance->clear_api_key();
658 $login_changed =
true;
659 $login_string = NULL;
661 header(
'HTTP/1.1 400 Cannot Set New Login');
668 $result = $login_instance->set_lang(
$lang);
670 $login_changed =
true;
674 if ($result && $name) {
675 $result = $login_instance->set_name($name);
677 $login_changed =
true;
681 if (($result && $password) && ($in_andisol_instance->manager() || ($login_instance == $in_andisol_instance->get_login_item()))) {
682 $result = $login_instance->set_password_from_cleartext($password);
684 $result = $login_instance->clear_api_key();
686 $changed_password = $password;
687 $login_changed =
true;
692 if ($result && $read_token) {
693 $result = $login_instance->set_read_security_id($read_token);
695 $login_changed =
true;
699 if ($result && $write_token) {
700 $result = $login_instance->set_write_security_id($write_token);
702 $login_changed =
true;
706 if ($result && $convert_to_manager && !$login_instance->is_manager()) {
707 $result = $in_andisol_instance->convert_login($login_instance->login_id,
true);
709 $login_changed =
true;
713 if ($result && $convert_to_login && $login_instance->is_manager()) {
714 $result = $in_andisol_instance->convert_login($login_instance->login_id,
false);
716 $login_changed =
true;
720 if (!$login_changed) {
721 header(
'HTTP/1.1 400 Error Modifying Login');
725 if ($login_changed) {
726 $login_report[
'after'] = $this->_get_long_description($login_instance);
727 if ($changed_password) {
728 $login_report[
'after'][
'password'] = $changed_password;
731 $ret[
'changed_logins'][] = $login_report;
749 $my_info = isset($in_path) && is_array($in_path) && (0 < count($in_path) && (
'my_info' == $in_path[0]) && $in_andisol_instance->logged_in());
751 $tokens = $in_andisol_instance->get_personal_security_ids();
752 if (isset($tokens) && is_array($tokens) && count($tokens)) {
753 $ret[
'my_info'][
'tokens'] = $tokens;
756 $user_list = $in_andisol_instance->get_logins_that_have_any_of_my_ids();
758 if (is_array($user_list) && count($user_list)) {
759 foreach ($user_list as $key => $value) {
760 $ret_temp[] = [
"id" => $key,
"tokens" => $value];
763 if (count($ret_temp)) {
764 $ret[
'my_info'][
'personal_token_users'] = $ret_temp;
766 } elseif ($in_andisol_instance->god()) {
767 $all_logins = $in_andisol_instance->get_all_logins();
769 if (isset($all_logins) && is_array($all_logins) && count($all_logins)) {
771 foreach ($all_logins as $login) {
772 $tokens = $login->personal_ids();
773 if (isset($tokens) && is_array($tokens) && count($tokens)) {
774 $ret_temp[] = [
"id" => $login->id(),
"tokens" => $tokens];
777 $ret = [
"personal_token_users" => $ret_temp];
780 header(
'HTTP/1.1 403 Not Permitted');
800 if (
'PUT' == $in_http_method) {
801 if (isset($in_path) && is_array($in_path) && (0 < count($in_path)) && trim($in_path[0])) {
802 $token_list = array_map(
'intval', explode(
",",trim($in_path[0])));
804 if (isset($in_query) && is_array($token_list) && count($token_list)) {
806 if (is_array($in_query) && isset($in_query[
'set_user_tokens']) && $in_query[
'set_user_tokens'] && $in_andisol_instance->god()) {
807 $user_id = intval($in_query[
'set_user_tokens']);
808 $tokens = $in_andisol_instance->set_personal_ids($user_id, $token_list);
810 if (count($tokens)) {
811 $ret[
'set_user_tokens'] = [
'id' => $user_id,
'tokens' => $tokens];
814 } elseif (is_array($in_query) && isset($in_query[
'assign_tokens_to_user'])) {
816 $user_ids = array_map(
'intval', explode(
",", $in_query[
'assign_tokens_to_user']));
818 foreach($user_ids as $user_id) {
820 foreach ($token_list as $token) {
821 if ($in_andisol_instance->add_personal_token_from_current_login($user_id, $token)) {
822 $ret_temp2[] = $token;
825 if (count($ret_temp2)) {
826 $ret_temp[] = [
"id" => $user_id,
"tokens" => $ret_temp2];
830 $ret[
'assign_tokens_to_user'] = $ret_temp;
832 } elseif (is_array($in_query) && isset($in_query[
'remove_tokens_from_user']) && isset($in_query[
'remove_tokens_from_user'])) {
834 $user_id = intval($in_query[
'remove_tokens_from_user']);
836 foreach ($token_list as $token) {
837 if ($in_andisol_instance->remove_personal_token_from_this_login($user_id, $token)) {
838 $ret_temp[] = $token;
842 $ret[
'remove_tokens_from_user'] = [
'id' => $user_id,
'tokens' => $ret_temp];
844 } elseif (is_array($in_query) && isset($in_query[
'remove_all_these_tokens_from_all_users']) && isset($in_query[
'remove_all_these_tokens_from_all_users'])) {
845 $user_list = $in_andisol_instance->get_logins_that_have_any_of_my_ids();
847 foreach ($user_list as $user_id => $token_list) {
849 foreach ($token_list as $token) {
850 if ($in_andisol_instance->remove_personal_token_from_this_login($user_id, $token)) {
851 $ret_temp2[] = $token;
854 if (count($ret_temp2)) {
855 $ret_temp[] = [
"id" => $user_id,
"tokens" => $ret_temp2];
859 $ret = [
"remove_all_these_tokens_from_all_users" => $ret_temp];
861 header(
'HTTP/1.1 400 Incorrect Command Structure');
865 header(
'HTTP/1.1 400 No Personal IDs');
869 header(
'HTTP/1.1 400 Incorrect HTTP Request Method');
887 if (isset($in_query) && is_array($in_query) && count($in_query)) {
889 if (isset($in_query[
'tokens'])) {
890 $ret[
'tokens'] = array_map(
'intval', explode(
',', $in_query[
'tokens']));
891 sort($ret[
'tokens']);
892 if (1 == $ret[
'tokens'][0]) {
893 array_shift($ret[
'tokens']);
898 if (isset($in_query[
'personal_tokens']) && $in_andisol_instance->god()) {
899 $ret[
'personal_tokens'] = array_map(
'intval', explode(
',', $in_query[
'personal_tokens']));
900 sort($ret[
'personal_tokens']);
904 if (isset($in_query[
'password']) && (strlen(trim($in_query[
'password'])) >= CO_Config::$min_pw_len)) {
905 $ret[
'password'] = trim($in_query[
'password']);
909 if (isset($in_query[
'login_string']) && $in_andisol_instance->god()) {
910 $ret[
'login_string'] = trim($in_query[
'login_string']);
914 if (isset($in_query[
'read_token'])) {
915 $ret[
'read_token'] = intval($in_query[
'read_token']);
919 if (isset($in_query[
'write_token'])) {
920 $ret[
'write_token'] = intval($in_query[
'write_token']);
924 if (isset($in_query[
'name'])) {
925 $ret[
'name'] = trim(strval($in_query[
'name']));
929 if (isset($in_query[
'lang'])) {
930 $ret[
'lang'] = trim(strval($in_query[
'lang']));
947 $in_show_parents =
false
951 $login_user = isset($in_query) && is_array($in_query) && isset($in_query[
'login_user']);
954 if ((
'POST' == $in_http_method) && $in_andisol_instance->manager()) {
955 $ret = $this->_handle_edit_people_post($in_andisol_instance, $login_user, $in_path, $in_query);
956 } elseif ((
'DELETE' == $in_http_method) && $in_andisol_instance->manager()) {
957 $ret = $this->_handle_edit_people_delete($in_andisol_instance, $login_user, $in_path, $in_query, $in_show_parents);
958 } elseif (
'PUT' == $in_http_method) {
959 $ret = $this->_handle_edit_people_put($in_andisol_instance, $login_user, $in_path, $in_query);
961 header(
'HTTP/1.1 400 Incorrect HTTP Request Method');
983 $user_object_list = [];
985 $my_info = isset($in_path) && is_array($in_path) && (0 < count($in_path) && (
'my_info' == $in_path[0]));
987 if (isset($my_info) && $my_info) {
988 $user_object_list[] = $in_andisol_instance->current_user();
989 } elseif (isset($in_path) && is_array($in_path) && (1 < count($in_path) && isset($in_path[0]) && (
'login_ids' == $in_path[0]))) {
991 $login_id_list = array_map(
'trim', explode(
',', $in_path[1]));
993 $is_numeric = array_reduce($login_id_list,
function($carry, $item){
return $carry && ctype_digit($item); },
true);
995 $login_id_list = $is_numeric ? array_map(
'intval', $login_id_list) : $login_id_list;
996 $login_id_list = array_unique($login_id_list);
998 foreach ($login_id_list as $login_id) {
999 $login_instance = $is_numeric ? $in_andisol_instance->get_login_item($login_id) : $in_andisol_instance->get_login_item_by_login_string($login_id);
1002 $id_string = $login_instance->login_id;
1003 $user = $in_andisol_instance->get_user_from_login_string($id_string);
1004 if ($user->user_can_write() && $user->has_login()) {
1005 $user_object_list[] = $user;
1009 } elseif (isset($in_path) && is_array($in_path) && (0 < count($in_path))) {
1010 $user_nums = strtolower($in_path[0]);
1012 $single_user_id = (ctype_digit($user_nums) && (1 < intval($user_nums))) ? intval($user_nums) : NULL;
1014 $user_list = explode(
',', $user_nums);
1017 if ($single_user_id || (1 < count($user_list))) {
1018 $user_list = array_unique($single_user_id ? [$single_user_id] : array_map(
'intval', $user_list));
1020 foreach ($user_list as $id) {
1022 $user = $in_andisol_instance->get_single_data_record_by_id($id);
1024 if (!$in_login_user || ($in_login_user && $user->has_login()) && $user->user_can_write()) {
1025 $user_object_list[] = $user;
1032 $userlist = $in_andisol_instance->get_all_users();
1033 if (0 < count($userlist)) {
1034 foreach ($userlist as $user) {
1036 if (!$in_login_user || ($in_login_user && $user->has_login()) && $user->user_can_write()) {
1037 $user_object_list[] = $user;
1046 if (!$in_andisol_instance->manager()) {
1049 $current_user = $in_andisol_instance->current_user();
1051 foreach ($user_object_list as $user) {
1052 if ($user == $current_user) {
1058 $user_object_list = [];
1061 $user_object_list = [$temp];
1067 if (0 == count($user_object_list)) {
1068 header(
'HTTP/1.1 403 No Editable Records');
1071 $mod_list = $this->_build_user_mod_list($in_andisol_instance,
'PUT', $in_query);
1074 foreach ($user_object_list as $user) {
1075 $changed_password = NULL;
1076 $user_changed =
false;
1077 if ($user->user_can_write()) {
1078 $user_report = Array(
'before' => $this->_get_long_user_description($user, $in_login_user));
1080 $user->set_batch_mode();
1083 foreach ($mod_list as $key => $value) {
1086 if (
'DELETE-ALL' == $value) {
1087 $result = $user->deleteAllChildren();
1088 $user_changed =
true;
1090 $add = $value[
'add'];
1091 $remove = $value[
'remove'];
1094 foreach ($remove as $id) {
1095 if ($id != $user->id()) {
1096 $child = $in_andisol_instance->get_single_data_record_by_id($id);
1097 if (isset($child)) {
1098 $result = $user->deleteThisElement($child);
1099 $user_changed =
true;
1109 foreach ($add as $id) {
1110 if ($id != $user->id()) {
1111 $child = $in_andisol_instance->get_single_data_record_by_id($id);
1112 if (isset($child)) {
1113 $result = $user->appendElement($child);
1114 $user_changed =
true;
1127 if ($in_login_user) {
1128 $login_instance = $user->get_login_instance();
1131 if ($login_instance) {
1132 if (($in_andisol_instance->manager() || ($login_instance == $in_andisol_instance->current_login()) && $login_instance->user_can_write())) {
1133 $result = $login_instance->set_password_from_cleartext($value);
1135 $result = $login_instance->clear_api_key();
1137 $changed_password = $value;
1138 $user_changed =
true;
1142 header(
'HTTP/1.1 403 Forbidden');
1146 header(
'HTTP/1.1 400 No Login Item');
1154 $result = $user->set_lang($value);
1156 if ($result && $in_login_user) {
1157 $login_instance = $user->get_login_instance();
1159 if ($login_instance && $login_instance->user_can_write()) {
1160 $result = $login_instance->set_lang($value);
1161 $user_changed =
true;
1168 $result = $user->set_write_security_id($value);
1169 $user_changed =
true;
1173 $result = $user->set_read_security_id($value);
1174 $user_changed =
true;
1178 $result = $user->set_longitude($value);
1179 $user_changed =
true;
1183 $result = $user->set_latitude($value);
1184 $user_changed =
true;
1188 $result = $user->set_fuzz_factor($value);
1189 $user_changed =
true;
1192 case 'can_see_through_the_fuzz':
1193 $result = $user->set_can_see_through_the_fuzz($value);
1194 $user_changed =
true;
1198 if ($in_login_user) {
1199 $login_instance = $user->get_login_instance();
1201 if ($login_instance) {
1202 $result = $login_instance->set_ids($value);
1203 $user_changed =
true;
1206 header(
'HTTP/1.1 400 Improper Data Provided');
1211 case 'personal_tokens':
1212 if ($in_login_user && $in_andisol_instance->god()) {
1213 $login_instance = $user->get_login_instance();
1215 if ($login_instance) {
1216 $result = $login_instance->set_personal_ids($value);
1217 $user_changed =
true;
1220 header(
'HTTP/1.1 400 Improper Data Provided');
1226 $result = $user->set_payload($value);
1227 $user_changed =
true;
1230 case 'remove_payload':
1231 $result = $user->set_payload(NULL);
1232 $user_changed =
true;
1236 $result = $user->set_name($value);
1237 $user_changed =
true;
1241 $result = $user->set_surname($value);
1242 $user_changed =
true;
1246 $result = $user->set_middle_name($value);
1247 $user_changed =
true;
1251 $result = $user->set_given_name($value);
1252 $user_changed =
true;
1256 $result = $user->set_prefix($value);
1257 $user_changed =
true;
1261 $result = $user->set_suffix($value);
1262 $user_changed =
true;
1266 $result = $user->set_nickname($value);
1267 $user_changed =
true;
1271 $result = $user->set_tag(7, $value);
1272 $user_changed =
true;
1276 $result = $user->set_tag(8, $value);
1277 $user_changed =
true;
1281 $result = $user->set_tag(9, $value);
1282 $user_changed =
true;
1287 if ($in_andisol_instance->god()) {
1288 $result = $user->set_login(intval($value));
1289 $user_changed =
true;
1295 $result = $user->clear_batch_mode();
1301 if ($user_changed) {
1302 $user_report[
'after'] = $this->_get_long_user_description($user, $in_login_user);
1303 if ($changed_password) {
1304 $user_report[
'after'][
'associated_login'][
'password'] = $changed_password;
1307 $ret[
'changed_users'][] = $user_report;
1326 $in_show_parents =
false
1331 $user_object_list = [];
1333 if (isset($my_info) && $my_info) {
1334 $user_object_list = [$in_andisol_instance->current_user()];
1335 } elseif (isset($in_path) && is_array($in_path) && (1 < count($in_path) && (
'login_ids' == $in_path[0]))) {
1337 $login_id_list = array_map(
'trim', explode(
',', $in_path[1]));
1339 $is_numeric = array_reduce($login_id_list,
function($carry, $item){
return $carry && ctype_digit($item); },
true);
1341 $login_id_list = $is_numeric ? array_map(
'intval', $login_id_list) : $login_id_list;
1343 foreach ($login_id_list as $login_id) {
1344 $login_instance = $is_numeric ? $in_andisol_instance->get_login_item($login_id) : $in_andisol_instance->get_login_item_by_login_string($login_id);
1347 $id_string = $login_instance->login_id;
1348 $user = $in_andisol_instance->get_user_from_login_string($id_string);
1349 if ($user->user_can_write() && $user->has_login()) {
1350 $user_object_list[] = $user;
1354 } elseif (isset($in_path) && is_array($in_path) && (0 < count($in_path))) {
1355 $user_nums = strtolower($in_path[0]);
1357 $single_user_id = (ctype_digit($user_nums) && (1 < intval($user_nums))) ? intval($user_nums) : NULL;
1359 $user_list = explode(
',', $user_nums);
1362 if ($single_user_id || (1 < count($user_list))) {
1363 $user_list = ($single_user_id ? [$single_user_id] : array_map(
'intval', $user_list));
1365 foreach ($user_list as $id) {
1367 $user = $in_andisol_instance->get_single_data_record_by_id($id);
1369 if (!$in_login_user || ($in_login_user && $user->has_login()) && $user->user_can_write()) {
1370 $user_object_list[] = $user;
1377 $userlist = $in_andisol_instance->get_all_users();
1378 if (0 < count($userlist)) {
1379 foreach ($userlist as $user) {
1381 if (!$in_login_user || ($in_login_user && $user->has_login()) && $user->user_can_write()) {
1382 $user_object_list[] = $user;
1391 if (!$in_andisol_instance->manager()) {
1393 foreach ($user_object_list as $user) {
1394 if ($user == $in_andisol_instance->current_user()) {
1400 $user_object_list = [];
1403 $user_object_list = [$temp];
1408 if (0 == count($user_object_list)) {
1409 header(
'HTTP/1.1 403 No Editable Records');
1414 foreach ($user_object_list as $user) {
1415 if ($user != $in_andisol_instance->current_user()) {
1420 $user_object_list = $temp;
1423 if ($in_login_user) {
1425 foreach ($user_object_list as $user) {
1426 $login_item = $user->get_login_instance();
1427 if ($login_item->user_can_write()) {
1432 $user_object_list = $temp;
1436 if (0 == count($user_object_list)) {
1437 header(
'HTTP/1.1 403 No Editable Records');
1441 $ret = Array (
'deleted_users' => [],
'deleted_logins' => []);
1444 foreach ($user_object_list as $user) {
1445 $user_dump = $this->_get_long_user_description($user, $in_login_user, $in_show_parents);
1450 if ($in_login_user) {
1451 $login_item = $user->get_login_instance();
1452 $login_dump = $this->_get_long_description($login_item);
1453 $ok = $login_item->delete_from_db();
1457 $ok = $user->delete_from_db();
1462 if (!isset($ret) || !is_array($ret)) {
1463 $ret = [
'deleted_users' => []];
1464 if ($in_login_user) {
1465 $ret[
'deleted_logins'] = [];
1469 $ret[
'deleted_users'][] = $user_dump;
1472 $ret[
'deleted_logins'][] = $login_dump;
1495 $login_id = (isset($in_query[
'login_id']) && trim($in_query[
'login_id'])) ? trim($in_query[
'login_id']) : NULL;
1496 $in_login_user = $in_login_user || (NULL != $login_id);
1498 $private_token = ($login_id && (isset($in_query[
'private_token']) && trim($in_query[
'private_token']))) ? TRUE : FALSE;
1500 $ret = [
'new_user'];
1503 if (isset($in_query[
'login_id'])) {
1504 unset($in_query[
'login_id']);
1507 if ($private_token) {
1508 $in_query[
'private_token'] = TRUE;
1509 } elseif (isset($in_query[
'private_token'])) {
1510 unset($in_query[
'private_token']);
1513 $password = isset($in_query) && is_array($in_query) && isset($in_query[
'password']) && trim($in_query[
'password']) ? trim($in_query[
'password']) : NULL;
1514 if (isset($in_query[
'password'])) {
1515 unset($in_query[
'password']);
1518 if (!$password || (strlen($password) < CO_Config::$min_pw_len)) {
1519 $password = substr(str_shuffle(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"), 0, CO_Config::$min_pw_len + 2);
1522 $name = isset($in_query) && is_array($in_query) && isset($in_query[
'name']) && trim($in_query[
'name']) ? trim($in_query[
'name']) : NULL;
1523 if (isset($in_query[
'name'])) {
1524 unset($in_query[
'name']);
1527 $is_manager = isset($in_query) && is_array($in_query) && isset($in_query[
'is_manager']);
1528 if (isset($in_query[
'is_manager'])) {
1529 unset($in_query[
'is_manager']);
1532 $my_tokens = array_map(
'intval', $in_andisol_instance->get_login_item()->ids());
1533 array_shift($my_tokens);
1535 $tokens = isset($in_query) && is_array($in_query) && isset($in_query[
'tokens']) && trim($in_query[
'tokens']) ? trim($in_query[
'tokens']) : NULL;
1536 if (isset($in_query[
'tokens'])) {
1537 unset($in_query[
'tokens']);
1540 if (isset($tokens)) {
1541 $tokens_temp = array_map(
'intval', explode(
',', $tokens));
1544 if ($in_andisol_instance->god()) {
1545 $tokens = $tokens_temp;
1548 $tokens_temp = array_intersect($my_tokens, $tokens_temp);
1549 foreach ($tokens_temp as $token) {
1550 if ((1 < $token) && ($token != $in_andisol_instance->get_login_item()->id())) {
1556 $in_query[
'tokens'] = implode(
',', $tokens);
1559 $read_token = isset($in_query) && is_array($in_query) && isset($in_query[
'read_token']) && intval($in_query[
'read_token']) ? intval($in_query[
'read_token']) : 1;
1560 if (isset($in_query[
'read_token'])) {
1561 unset($in_query[
'read_token']);
1564 if ((0 == $read_token) || (1 == $read_token) || in_array($read_token, $my_tokens)) {
1565 $in_query[
'read_token'] = $read_token;
1568 $write_token = isset($in_query) && is_array($in_query) && isset($in_query[
'write_token']) && intval($in_query[
'write_token']) ? intval($in_query[
'write_token']) : 0;
1570 if (isset($in_query[
'write_token'])) {
1571 unset($in_query[
'write_token']);
1574 if (isset($write_token) && in_array($write_token, $my_tokens)) {
1575 $in_query[
'write_token'] = $read_token;
1579 $settings_list = $this->_build_user_mod_list($in_andisol_instance,
'POST', $in_query);
1581 if ($in_login_user) {
1584 $number_of_personal_tokens = (isset($in_query[
'number_of_personal_tokens']) && trim($in_query[
'number_of_personal_tokens'])) ? intval(trim($in_query[
'number_of_personal_tokens'])) : 0;
1586 $password = $in_andisol_instance->create_new_user($login_id, $password, $name, $tokens, 0, $is_manager, $number_of_personal_tokens);
1589 $user = $in_andisol_instance->get_user_from_login_string($login_id);
1592 $user = $in_andisol_instance->make_standalone_user();
1596 $in_path[] = $user->id();
1597 $result = $this->_handle_edit_people_put($in_andisol_instance, $in_login_user, $in_path, $in_query);
1599 $user = $in_andisol_instance->get_single_data_record_by_id($user->id());
1600 $ret = Array(
'new_user' => $this->_get_long_user_description($user,
true));
1602 if ($in_login_user && isset($password)) {
1603 $ret[
'new_user'][
'associated_login'][
'password'] = $password;
1606 header(
'HTTP/1.1 400 Failed to Create User');
1626 $ret = parent::_process_parameters($in_andisol_instance, $in_query);
1628 if (isset($in_query) && is_array($in_query) && count($in_query)) {
1631 if (isset($in_query[
'tokens'])) {
1632 $tokens_temp = array_map(
'intval', explode(
',', $in_query[
'tokens']));
1635 if ($in_andisol_instance->god()) {
1636 $tokens = $tokens_temp;
1639 $my_tokens = array_map(
'intval', $in_andisol_instance->get_login_item()->ids());
1640 $tokens_temp = array_intersect($my_tokens, $tokens_temp);
1641 foreach ($tokens_temp as $token) {
1642 if ((1 < $token) && ($token != $in_andisol_instance->get_login_item()->id())) {
1648 $ret[
'tokens'] = $tokens;
1652 if (isset($in_query[
'password']) && (strlen(trim($in_query[
'password'])) >= CO_Config::$min_pw_len)) {
1653 $ret[
'password'] = trim($in_query[
'password']);
1657 if (isset($in_query[
'surname'])) {
1658 $ret[
'surname'] = trim(strval($in_query[
'surname']));
1662 if (isset($in_query[
'middle_name'])) {
1663 $ret[
'middle_name'] = trim(strval($in_query[
'middle_name']));
1667 if (isset($in_query[
'given_name'])) {
1668 $ret[
'given_name'] = trim(strval($in_query[
'given_name']));
1672 if (isset($in_query[
'prefix'])) {
1673 $ret[
'prefix'] = trim(strval($in_query[
'prefix']));
1677 if (isset($in_query[
'suffix'])) {
1678 $ret[
'suffix'] = trim(strval($in_query[
'suffix']));
1682 if (isset($in_query[
'nickname'])) {
1683 $ret[
'nickname'] = trim(strval($in_query[
'nickname']));
1687 if (isset($in_query[
'login_id']) && ((
'POST' == $in_http_method) || $in_andisol_instance->god())) {
1688 $ret[
'login_id'] = abs(intval(trim($in_query[
'login_id'])));
1692 if (isset($in_query[
'tag7'])) {
1693 $ret[
'tag7'] = trim(strval($in_query[
'tag7']));
1697 if (isset($in_query[
'tag8'])) {
1698 $ret[
'tag8'] = trim(strval($in_query[
'tag8']));
1701 if (isset($in_query[
'tag9'])) {
1702 $ret[
'tag9'] = trim(strval($in_query[
'tag9']));
1720 $login_user = isset($in_query) && is_array($in_query) && isset($in_query[
'login_user']);
1721 $show_parents = isset($in_query) && is_array($in_query) && isset($in_query[
'show_parents']);
1722 $show_details = $show_parents || (isset($in_query) && is_array($in_query) && isset($in_query[
'show_details']));
1723 $logged_in = isset($in_query) && is_array($in_query) && isset($in_query[
'logged_in']) && $in_andisol_instance->manager();
1724 $my_info = isset($in_path) && is_array($in_path) && (0 < count($in_path) && (
'my_info' == $in_path[0]));
1725 $writeable = isset($in_query) && is_array($in_query) && isset($in_query[
'writeable']);
1732 if (!$in_andisol_instance->logged_in()) {
1735 $show_details =
true;
1738 if (isset($in_query[
'get_all_visible_users'])) {
1739 $ret[
'get_all_visible_users'] = $in_andisol_instance->get_all_visible_users();
1740 } elseif (isset($in_query[
'get_all_visible_logins'])) {
1741 $ret[
'get_all_visible_logins'] = $in_andisol_instance->get_all_visible_logins();
1742 } elseif (isset($my_info) && $my_info) {
1743 if ($in_andisol_instance->logged_in()) {
1744 $user = $in_andisol_instance->current_user();
1746 $ret[
'my_info'] = $this->_get_long_user_description($user, $login_user, $show_parents);
1748 header(
'HTTP/1.1 400 No Logged-In User');
1752 header(
'HTTP/1.1 403 Forbidden');
1755 } elseif (isset($in_path) && is_array($in_path) && (1 < count($in_path) && (
'login_ids' == $in_path[0]))) {
1757 $login_id_list = array_map(
'trim', explode(
',', $in_path[1]));
1759 $is_numeric = array_reduce($login_id_list,
function($carry, $item){
return $carry && ctype_digit($item); },
true);
1761 $login_id_list = $is_numeric ? array_map(
'intval', $login_id_list) : $login_id_list;
1763 foreach ($login_id_list as $login_id) {
1764 $login_instance = $is_numeric ? $in_andisol_instance->get_login_item($login_id) : $in_andisol_instance->get_login_item_by_login_string($login_id);
1767 if (!$logged_in || ($logged_in && $login_instance->get_api_key())) {
1768 $id_string = $login_instance->login_id;
1769 $user = $in_andisol_instance->get_user_from_login_string($id_string);
1770 if (isset($user) && ($user instanceof
CO_User_Collection) && (!$writeable || $user->user_can_write())) {
1771 if ($show_details) {
1772 $ret[] = $this->_get_long_user_description($user, $login_user, $show_parents);
1774 $ret[] = $this->_get_short_description($user);
1780 } elseif (isset($in_path) && is_array($in_path) && (0 < count($in_path))) {
1781 $user_nums = strtolower($in_path[0]);
1783 $single_user_id = (ctype_digit($user_nums) && (1 < intval($user_nums))) ? intval($user_nums) : NULL;
1785 $user_list = explode(
',', $user_nums);
1788 if ($single_user_id || (1 < count($user_list))) {
1789 $user_list = ($single_user_id ? [$single_user_id] : array_map(
'intval', $user_list));
1791 foreach ($user_list as $id) {
1793 $user = $in_andisol_instance->get_single_data_record_by_id($id);
1794 if (isset($user) && ($user instanceof
CO_User_Collection) && (!$writeable || $user->user_can_write())) {
1795 if (!$login_user || ($login_user && $user->has_login())) {
1797 $login_instance = $user->get_login_instance();
1799 if (!isset($login_instance) || !($login_instance instanceof
CO_Security_Login) || !$login_instance->get_api_key()) {
1803 if ($show_details) {
1804 $ret[] = $this->_get_long_user_description($user, $login_user, $show_parents);
1806 $ret[] = $this->_get_short_description($user);
1814 $radius = isset($in_query) && is_array($in_query) && isset($in_query[
'search_radius']) && (0.0 < floatval($in_query[
'search_radius'])) ? floatval($in_query[
'search_radius']) : NULL;
1815 $longitude = isset($in_query) && is_array($in_query) && isset($in_query[
'search_longitude']) ? floatval($in_query[
'search_longitude']) : NULL;
1816 $latitude = isset($in_query) && is_array($in_query) && isset($in_query[
'search_latitude']) ? floatval($in_query[
'search_latitude']) : NULL;
1817 $search_page_size = isset($in_query) && is_array($in_query) && isset($in_query[
'search_page_size']) ? abs(intval($in_query[
'search_page_size'])) : 0;
1818 $search_page_number = isset($in_query) && is_array($in_query) && isset($in_query[
'search_page_number']) ? abs(intval($in_query[
'search_page_number'])) : 0;
1819 $search_name = isset($in_query) && is_array($in_query) && isset($in_query[
'search_name']) ? trim($in_query[
'search_name']) : NULL;
1820 $search_surname = isset($in_query) && is_array($in_query) && isset($in_query[
'search_surname']) ? trim($in_query[
'search_surname']) : NULL;
1821 $search_middle_name = isset($in_query) && is_array($in_query) && isset($in_query[
'search_middle_name']) ? trim($in_query[
'search_middle_name']) : NULL;
1822 $search_given_name = isset($in_query) && is_array($in_query) && isset($in_query[
'search_given_name']) ? trim($in_query[
'search_given_name']) : NULL;
1823 $search_nickname = isset($in_query) && is_array($in_query) && isset($in_query[
'search_nickname']) ? trim($in_query[
'search_nickname']) : NULL;
1824 $search_prefix = isset($in_query) && is_array($in_query) && isset($in_query[
'search_prefix']) ? trim($in_query[
'search_prefix']) : NULL;
1825 $search_suffix = isset($in_query) && is_array($in_query) && isset($in_query[
'search_suffix']) ? trim($in_query[
'search_suffix']) : NULL;
1826 $search_tag7 = isset($in_query) && is_array($in_query) && isset($in_query[
'search_tag7']) ? trim($in_query[
'search_tag7']) : NULL;
1827 $search_tag8 = isset($in_query) && is_array($in_query) && isset($in_query[
'search_tag8']) ? trim($in_query[
'search_tag8']) : NULL;
1828 $search_tag9 = isset($in_query) && is_array($in_query) && isset($in_query[
'search_tag9']) ? trim($in_query[
'search_tag9']) : NULL;
1830 $location_search = NULL;
1831 $string_search = ($search_name !== NULL)
1832 || ($search_surname !== NULL)
1833 || ($search_middle_name !== NULL)
1834 || ($search_given_name !== NULL)
1835 || ($search_nickname !== NULL)
1836 || ($search_prefix !== NULL)
1837 || ($search_suffix !== NULL)
1838 || ($search_tag7 !== NULL)
1839 || ($search_tag8 !== NULL)
1840 || ($search_tag9 !== NULL);
1843 if (isset($radius) && isset($longitude) && isset($latitude)) {
1844 $location_search = Array(
'radius' => $radius,
'longitude' => $longitude,
'latitude' => $latitude);
1845 } elseif (isset($radius) || isset($longitude) || isset($latitude)) {
1846 header(
'HTTP/1.1 400 Incomplete Distance Search');
1851 if ((isset($location_search) && is_array($location_search) && (3 == count($location_search))) || (0 < $search_page_size) || $string_search) {
1852 $class_search = Array(
'%_User_Collection',
'use_like' => 1);
1853 $search_array[
'access_class'] = $class_search;
1854 $search_array[
'location'] = $location_search;
1855 if (isset($search_name)) {
1856 $search_array[
'name'] = Array($search_name,
'use_like' => 1);
1859 $tags_array = [NULL];
1861 $tags_array[] = isset($search_surname) ? $search_surname : NULL;
1862 $tags_array[] = isset($search_middle_name) ? $search_middle_name : NULL;
1863 $tags_array[] = isset($search_given_name) ? $search_given_name : NULL;
1864 $tags_array[] = isset($search_nickname) ? $search_nickname : NULL;
1865 $tags_array[] = isset($search_prefix) ? $search_prefix : NULL;
1866 $tags_array[] = isset($search_suffix) ? $search_suffix : NULL;
1867 $tags_array[] = isset($search_tag7) ? $search_tag7 : NULL;
1868 $tags_array[] = isset($search_tag8) ? $search_tag8 : NULL;
1869 $tags_array[] = isset($search_tag9) ? $search_tag9 : NULL;
1872 foreach ($tags_array as $tag) {
1873 if (NULL !== $tag) {
1880 $tags_array[
'use_like'] = 1;
1881 $search_array[
'tags'] = $tags_array;
1884 $userlist = $in_andisol_instance->generic_search($search_array,
false, $search_page_size, $search_page_number, $writeable);
1886 $userlist = $in_andisol_instance->get_all_users();
1889 if (isset($userlist) && is_array($userlist) && count($userlist)) {
1890 foreach ($userlist as $user) {
1891 if (isset($user) && ($user instanceof
CO_User_Collection) && (!$writeable || $user->user_can_write())) {
1892 if (!$login_user || ($login_user && $user->has_login())) {
1894 $login_instance = $user->get_login_instance();
1896 if (!isset($login_instance) || !($login_instance instanceof
CO_Security_Login) || !$login_instance->get_api_key()) {
1900 if ($show_details) {
1901 $ret[] = $this->_get_long_user_description($user, $login_user, $show_parents);
1903 $ret[] = $this->_get_short_description($user);
1909 if ($location_search) {
1910 $ret[
'search_location'] = $location_search;
1933 return [
'CO_User_Collection',
'CO_Login_Manager',
'CO_Cobra_login',
'CO_Security_Login'];
1950 if (0 == count($in_path)) {
1951 if (
'GET' == $in_http_method) {
1953 if ($in_andisol_instance->logged_in()) {
1955 $ret[] =
'personal_tokens';
1958 header(
'HTTP/1.1 400 Incorrect HTTP Request Method');
1962 $main_command = $in_path[0];
1963 $show_parents = isset($in_query) && is_array($in_query) && isset($in_query[
'show_parents']);
1965 array_shift($in_path);
1967 switch (strtolower($main_command)) {
1969 if (
'GET' == $in_http_method) {
1970 $ret[
'people'] = $this->_handle_people($in_andisol_instance, $in_path, $in_query);
1971 } elseif ($in_andisol_instance->logged_in()) {
1972 $ret[
'people'] = $this->_handle_edit_people($in_andisol_instance, $in_http_method, $in_path, $in_query, $show_parents);
1974 if (!$in_andisol_instance->logged_in()) {
1975 header(
'HTTP/1.1 403 Unauthorized');
1977 header(
'HTTP/1.1 400 Incorrect HTTP Request Method');
1983 if (
'GET' == $in_http_method) {
1984 $ret[
'logins'] = $this->_handle_logins($in_andisol_instance, $in_path, $in_query);
1986 $ret[
'logins'] = $this->_handle_edit_logins($in_andisol_instance, $in_http_method, $in_path, $in_query, $show_parents);
1989 case 'personal_tokens':
1990 if (
'GET' == $in_http_method) {
1991 $ret[
'personal_tokens'] = $this->_handle_personal_ids($in_andisol_instance, $in_path, $in_query);
1993 $ret[
'personal_tokens'] = $this->_handle_edit_personal_ids($in_andisol_instance, $in_http_method, $in_path, $in_query);
1999 return $this->_condition_response($in_response_type, $ret);
_handle_personal_ids( $in_andisol_instance, $in_path=[], $in_query=[])
_handle_edit_people_post( $in_andisol_instance, $in_login_user, $in_path=[], $in_query=[])
_handle_edit_logins( $in_andisol_instance, $in_http_method, $in_path=[], $in_query=[], $in_show_parents=false)
_handle_logins( $in_andisol_instance, $in_path=[], $in_query=[])
process_command( $in_andisol_instance, $in_http_method, $in_response_type, $in_path=[], $in_query=[])
_get_long_description( $in_login_object, $ignored=false)
_handle_edit_people_put( $in_andisol_instance, $in_login_user, $in_path=[], $in_query=[])
_handle_edit_logins_put( $in_andisol_instance, $in_logins_to_edit, $in_query=[])
_get_short_description( $in_object, $in_additional_info=false)
_build_login_mod_list( $in_andisol_instance, $in_query=NULL)
_get_long_user_description( $in_user_object, $in_with_login_info=false, $in_show_parents=false)
_handle_edit_logins_post( $in_andisol_instance, $in_path=[], $in_query=[])
_build_user_mod_list( $in_andisol_instance, $in_http_method, $in_query=NULL)
_handle_people( $in_andisol_instance, $in_path=[], $in_query=[])
_handle_edit_logins_delete( $in_andisol_instance, $in_logins_to_edit, $in_query=[], $in_also_delete_user=false, $in_show_parents=false)
_handle_edit_personal_ids( $in_andisol_instance, $in_http_method, $in_path=[], $in_query=[])
_handle_edit_people( $in_andisol_instance, $in_http_method, $in_path=[], $in_query=[], $in_show_parents=false)
_handle_edit_people_delete( $in_andisol_instance, $in_login_user, $in_path=[], $in_query=[], $in_show_parents=false)