예제 #1
0
 public function users()
 {
     $users = \User::all();
     $deleted_users = \User::onlyTrashed()->lists('username', 'id');
     $suspended_users = \Throttle::where('suspended', 1)->count();
     $banned_users = \Throttle::where('banned', 1)->lists('user_id', 'user_id');
     $users_list = \User::all()->lists('username', 'id');
     $roles_list = \Role::lists('name', 'id');
     return \View::make('admin.users', compact('users', 'deleted_users', 'suspended_users', 'users_list', 'banned_users', 'roles_list'));
 }
예제 #2
0
 public function getAllUsersData()
 {
     try {
         $users = array();
         $tempUsers = \User::all()->toArray();
         foreach ($tempUsers as $user) {
             $banned = false;
             $suspended = false;
             $loginAttempt = 0;
             $usersThrottle = \Throttle::where('user_id', $user['id'])->get()->toArray();
             if (sizeof($usersThrottle) != 0) {
                 foreach ($usersThrottle as $userThrottle) {
                     if ($userThrottle['banned'] == true) {
                         $banned = true;
                     }
                     if ($userThrottle['suspended'] == true) {
                         $suspended = true;
                     }
                     $loginAttempt = $loginAttempt + $userThrottle['attempts'];
                 }
                 $user['banned'] = $banned;
                 $user['suspended'] = $suspended;
                 $user['loginAttempt'] = $loginAttempt;
             } else {
                 $user['banned'] = false;
                 $user['suspended'] = false;
                 $user['loginAttempt'] = 0;
             }
             $groupUser = \Sentry::findUserById($user['id']);
             $groups = $groupUser->getGroups()->toArray();
             if (sizeof($groups) != 0) {
                 $user['role'] = $groups[0]['name'];
             } else {
                 $user['role'] = '';
             }
             $users[] = $user;
         }
         return $users;
     } catch (\Exception $e) {
         \Log::error('Something Went Wrong in User Repository - getAllUsersData():' . $e->getMessage());
         throw new SomeThingWentWrongException();
     }
 }
예제 #3
0
 private function getUnactionedUserCount()
 {
     $not_active = User::where('activated', 0)->get()->toArray();
     foreach ($not_active as $index => $user) {
         $throttled = Throttle::where('user_id', $user['id'])->get()->toArray();
         if (isset($throttled[0]) && ($throttled[0]['suspended'] == 1 || $throttled[0]['banned'] == 1)) {
             // Remove this user
             unset($not_active[$index]);
         }
     }
     return array('unactionedUserCount' => count($not_active));
 }