Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @param Comment $subject
- * @param $user
- * @return bool
- */
- private function canView(Comment $subject, $user) :bool
- {
- if ($subject->getVisibilite() === 'all' || (
- $user !== self::USER_ANONYMOUS && (
- in_array($user->getIntId(), $subject->getProfilsAutorises()) ||
- $user->getIntId() === $subject->getAuteur()->getId() ||
- in_array('ROLE_ADMIN', $user->getRoles()) ||
- $subject->getVisibilite() === 'adherent'
- )
- )) {
- return true;
- }
- return false;
- }
- /**
- * @param Comment $subject
- * @param $user
- * @return bool
- */
- private function canEdit(Comment $subject, $user) :bool
- {
- if ($user !== self::USER_ANONYMOUS &&
- $user->getIntId() === $subject->getAuteur()->getId() ||
- $user !== self::USER_ANONYMOUS && in_array('ROLE_ADMIN', $user->getRoles()
- )
- ) {
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement