コード例 #1
0
 /**
  * Returns an instance of class (singleton pattern implementation).
  *
  * @return BOL_AuthorizationUserRoleDao
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
コード例 #2
0
 public function deleteUserRole($userId, $roleId)
 {
     $userId = (int) $userId;
     $roleId = (int) $roleId;
     if ($userId > 0 && $roleId > 0) {
         $this->userRoleDao->deleteUserRole($userId, $roleId);
     }
 }
コード例 #3
0
ファイル: user_dao.php プロジェクト: hardikamutech/loov
 public function countByRoleId($roleId)
 {
     $query = "SELECT COUNT(*)\n    \t\t FROM `{$this->getTableName()}` as `u`\n\n    \t\t INNER JOIN `" . BOL_AuthorizationUserRoleDao::getInstance()->getTableName() . "` as `ur`\n    \t\t \tON( `u`.`id` = `ur`.`userId` )\n    \t\t WHERE `ur`.`roleId` = ? ";
     return $this->dbo->queryForColumn($query, array($roleId));
 }
コード例 #4
0
 public function addRoleByAccountType(BOL_QuestionAccountType $accountType)
 {
     if (empty($accountType)) {
         return;
     }
     $sql = " REPLACE INTO `" . BOL_AuthorizationUserRoleDao::getInstance()->getTableName() . "` ( `userId`, `roleId` ) " . "SELECT u.id, :role FROM " . BOL_UserDao::getInstance()->getTableName() . " u " . " INNER JOIN " . BOL_QuestionAccountTypeDao::getInstance()->getTableName() . " `accountType` ON ( accountType.name = u.accountType ) " . " WHERE  u.accountType = :account ";
     $this->dbo->query($sql, array('account' => $accountType->name, 'role' => $accountType->roleId));
 }
コード例 #5
0
ファイル: user_dao.php プロジェクト: vazahat/dudex
 public function findByRoleIds($count, $roles, $withPhoto = true)
 {
     if (empty($roles)) {
         return array();
     }
     $avatarJoin = !$withPhoto ? '' : "INNER JOIN `" . BOL_AvatarDao::getInstance()->getTableName() . "` as `a`\n    \t\t\tON( `u`.`id` = `a`.`userId` )";
     $query = "\n            SELECT DISTINCT `u`.*\n            FROM `{$this->getTableName()}` AS `u`\n\n    \t\tLEFT JOIN `" . BOL_UserSuspendDao::getInstance()->getTableName() . "` as `s`\n    \t\t\tON( `u`.`id` = `s`.`userId` )\n\n    \t\tLEFT JOIN `" . BOL_UserApproveDao::getInstance()->getTableName() . "` as `d`\n    \t\t\tON( `u`.`id` = `d`.`userId` )\n\n                {$avatarJoin}\n                    \n                INNER JOIN `" . BOL_AuthorizationUserRoleDao::getInstance()->getTableName() . "` as `ur`\n    \t\t \tON( `u`.`id` = `ur`.`userId` )\n\n    \t\tWHERE `s`.`id` IS NULL AND `d`.`id` IS NULL AND `ur`.`roleId` IN ( '" . implode("', '", $roles) . "' )\n\n            ORDER BY `u`.`activityStamp` DESC\n            LIMIT ?, ?\n            ";
     return $this->dbo->queryForObjectList($query, $this->getDtoClassName(), array(0, $count));
 }
コード例 #6
0
 public function findUserRoleList($userId)
 {
     $query = "SELECT `r`.* FROM `{$this->getTableName()}` as `r`\r\n\t\tINNER JOIN `" . BOL_AuthorizationUserRoleDao::getInstance()->getTableName() . "` as `ur`\r\n\t\t\tON(`r`.`id` = `ur`.`roleId`)\r\n\t\tWHERE `ur`.`userId` = ? ORDER BY `sortOrder` ASC\r\n\t\t";
     return $this->dbo->queryForObjectList($query, $this->getDtoClassName(), array($userId));
 }