/** * getGrant * * @param $member * * @return array */ protected function getGrant($member) { $logged = Auth::user(); $grant = ['modify' => false, 'manage' => false]; if ($logged->getId() === $member->getId()) { $grant['modify'] = true; } if (Rating::compare($logged->getRating(), Rating::MANAGER) >= 0) { $grant['manage'] = true; $grant['modify'] = true; return $grant; } return $grant; }
/** * User 가 권한이 있는 등급인지 판별 * * @param string $criterion user rating keyword * @return bool */ protected function ratingInspect($criterion) { if (Rating::compare($this->userRating(), $criterion) == -1) { return false; } return true; }
/** * Finds whether member has manager or super rating. * * @return boolean */ public function isManager() { return Rating::compare($this->getRating(), Rating::MANAGER) >= 0; }
/** * @expectedException \Xpressengine\Member\Exceptions\UnknownCriterionException */ public function testCampareThrowException() { Rating::compare(Rating::MEMBER, 'foo'); }