コード例 #1
0
ファイル: UserModel.php プロジェクト: stevedien/gatekeeper
 /**
  * Check to see if the user is in the group
  *
  * @param integer $groupId Group ID or name
  * @return boolean Found/not found in the group
  */
 public function inGroup($groupId)
 {
     $find = ['user_id' => $this->id];
     if (!is_numeric($groupId)) {
         $g = Gatekeeper::findGroupByName($groupId);
         $groupId = $g->id;
     }
     $find['group_id'] = $groupId;
     $userGroup = new UserGroupModel($this->getDb());
     $userGroup = $this->getDb()->find($userGroup, $find);
     if ($userGroup->id === null) {
         return false;
     }
     return $userGroup->id !== null && $userGroup->groupId == $groupId ? true : false;
 }