hide inactive delete user button #78 (#79)

This commit is contained in:
Kevin Papst
2018-01-10 23:14:58 +01:00
committed by GitHub
parent 36e72552d8
commit 2644818547
9 changed files with 33 additions and 164 deletions

View File

@@ -70,11 +70,10 @@ class UserVoter extends AbstractVoter
case self::EDIT:
case self::PASSWORD:
return $this->canEdit($subject, $user, $token);
case self::VIEW_ALL:
case self::CREATE:
// create actually passes in the current user as $subject, not the new one
case self::DELETE:
// if we allow to delete user for ADMIN: make sure the user to be deleted is not in a higher level
return $this->canDelete($subject, $user, $token);
case self::VIEW_ALL:
case self::CREATE: // create actually passes in the current user as $subject, not the new one
case self::ROLES:
return $this->canAdminUsers($token);
}
@@ -110,6 +109,16 @@ class UserVoter extends AbstractVoter
return $profile->getId() == $user->getId();
}
/**
* @param User $profile
* @param User $user
* @return bool
*/
protected function canDelete(User $profile, User $user, TokenInterface $token)
{
return false;
}
/**
* @param TokenInterface $token
* @return bool