session_start(); require_once '../model/user.php'; require_once '../model/bin/logger.php'; $Logger = new Logger(); switch ($_POST['action']) { case 'new': new_user(); break; case 'log_in': log_in(); break; case 'log_out': session_destroy(); break; case 'drop': drop_user(); break; case 'data': if (isset($_SESSION['user'])) { echo json_encode(unserialize($_SESSION['user'])->attr); } else { echo '{"status": "Error", "description": "Couldn\'t find any session."}'; } break; default: echo '{"status": "Error", "description": "There\'s no action to do."}'; break; } function new_user() { $n_user = new User();
drop_role($_POST['usr_role_dname']); } // add user to role if (isset($_POST['usr_role_add']) && $_POST['usr_role_addname'] != '' && $_POST['usr_role_adduser'] != '') { grant_role_to_user($_POST['usr_role_addname'], $_POST['usr_role_adduser']); } // remove user from role if (isset($_POST['usr_role_remove']) && $_POST['usr_role_removename'] != '' && $_POST['usr_role_removeuser'] != '') { revoke_role_from_user($_POST['usr_role_removename'], $_POST['usr_role_removeuser']); } } // deleting a subject is confirmed if (isset($_POST['confirm_yes'])) { switch ($_POST['confirm_subject']) { case 'user': if (drop_user($s_confirmations['user']['obj'], $s_sysdba_pw)) { unset($users[$s_confirmations['user']['obj']]); } unset($s_confirmations['user']); break; } } // deleting a subject is canceled if (isset($_POST['confirm_no'])) { unset($s_confirmations[$_POST['confirm_subject']]); } // // customizing // if (have_panel_permissions($s_login['user'], 'usr_cust')) { if (isset($_POST['usr_cust_save'])) {