public function voteOnAttribute($attribute, $subject, TokenInterface $token) { if (TokenUtilities::isApiRequest($token)) { if ($subject instanceof Society || $object instanceof Venue) { if (!TokenUtilities::hasRole($token, 'ROLE_API_WRITE_ORG')) { return false; } } else { if (!TokenUtilities::hasRole($token, 'ROLE_API_WRITE')) { return false; } } } return $this->aclProvider->isOwner($token->getUser(), $subject); }
public function voteOnAttribute($attribute, $subject, TokenInterface $token) { if (TokenUtilities::isApiRequest($token) && !TokenUtilities::hasRole($token, 'ROLE_API_WRITE_ORG')) { return false; } if ($subject->getVenue()) { if ($this->aclProvider->isOwner($token->getUser(), $subject->getVenue())) { return true; } } if ($subject->getSociety()) { if ($this->aclProvider->isOwner($token->getUser(), $subject->getSociety())) { return true; } } return false; }
public function testIsOwner_NotLoggedIn() { $show = new Show(); $this->assertFalse($this->aclProvider->isOwner(null, $show)); }