hasUsers() public method

Check to see if there are users in the user table.
public hasUsers ( ) : integer
return integer
示例#1
0
 /**
  * Log out the currently logged in user.
  *
  * @return boolean
  */
 public function revokeSession()
 {
     try {
         // Only show this flash if there are users in the system.
         // Not when we're about to get redirected to the "first users" screen.
         if ($this->repositoryUsers->hasUsers()) {
             $this->flashLogger->info(Trans::__('You have been logged out.'));
         }
     } catch (TableNotFoundException $e) {
         // If we have no table, then we definitely have no users
     }
     // Remove all auth tokens when logging off a user
     if ($sessionAuth = $this->session->get('authentication')) {
         $this->repositoryAuthtoken->deleteTokens($sessionAuth->getUser()->getUsername());
     }
     $this->session->remove('authentication');
     $this->session->migrate(true);
     return false;
 }
示例#2
0
文件: Users.php 项目: somekoala/bolt
 /**
  * Test to see if there are users in the user table.
  *
  * @return integer
  */
 public function hasUsers()
 {
     $rows = $this->repository->hasUsers();
     return $rows ? (int) $rows['count'] : 0;
 }