Exemplo n.º 1
0
 public static function isAdmin($user_id = null)
 {
     try {
         $user_id = $user_id ? $user_id : Helper::userId();
         //$user_id = $user_id != NULL ? $user_id : Helper::userId(); // PAG changed because this will be true if $user_id = 0 which is supposed to be false too
         $emails = Admin::getAdmins();
         return in_array(User::email($user_id), $emails);
     } catch (Exception $e) {
         return false;
     }
 }
 public function postVerifyUser()
 {
     $userData = $_POST;
     if (Auth::check() && Helper::userId() == $userData['user_id']) {
         // PAG added permission checking
         $user = User::find($userData['user_id']);
         $user->first_name = $userData['first_name'];
         $user->last_name = $userData['last_name'];
         $user->email = $userData['email'];
         $user->phone = $userData['mobile'];
         $user->local_address = $userData['location'];
         $user->verified = 1;
         if ($user->save()) {
             return json_encode(['success' => 1]);
         } else {
             return json_encode(['success' => 0]);
         }
     } else {
         return json_encode(array('message' => 'You are not allowed to access this function.'));
     }
 }
 public static function getMyBusinesses()
 {
     return UserBusiness::getAllBusinessDetailsByOwner(Helper::userId());
 }
Exemplo n.º 4
0
 /**
  * gets the role id of the current session's user
  * @return mixed
  */
 public static function currentUserRoleId()
 {
     return DB::table('user_role')->where('user_id', '=', Helper::userId())->first()->role_id;
 }
 public static function isCurrentUserAssignedToTerminal($terminal_id)
 {
     return TerminalUser::isUserAssignedToTerminal(Helper::userId(), $terminal_id);
 }
Exemplo n.º 6
0
 public static function insertAnalyticsQueueNumber($action, $transaction_number, $service_id, $date, $time, $terminal_id, $queue_platform)
 {
     $values = ['transaction_number' => $transaction_number, 'date' => $date, 'business_id' => Business::getBusinessIdByServiceId($service_id), 'branch_id' => Service::branchId($service_id), 'service_id' => $service_id, 'terminal_id' => $terminal_id, 'queue_platform' => $queue_platform, 'user_id' => Helper::userId(), 'action' => $action, 'action_time' => $time];
     Analytics::saveQueueAnalytics($values);
 }