resolver->listOperationsForPermission('users'), $this->resolver->listOperationsForPermission('self')), false ); } return false; } /** * Similar to voteOnAttribute, but checking for the anonymous user is already done. * The current user (or the anonymous user) is passed by $user. * @param $attribute * @param $subject * @param User $user * @return bool */ protected function voteOnUser($attribute, $subject, User $user): bool { if($subject instanceof User) { //Check if the checked user is the user itself if($subject->getID() === $user->getID() && $this->resolver->isValidOperation('self', $attribute)) { //Then we also need to check the self permission $tmp = $this->resolver->inherit($user, 'self', $attribute) ?? false; //But if the self value is not allowed then use just the user value: if($tmp) return $tmp; } //Else just check users permission: return $this->resolver->inherit($user, 'users', $attribute) ?? false; } return false; } }