Determines whether a given user is a recipient of this channel.
@param \CharlotteDunois\Yasmin\Models\User|string  $user  The User instance or user ID.
@return bool
@throws \InvalidArgumentException
966986
function isRecipient($user) {
        $user = $this->client->users->resolve($user);
        return $this->recipients->has($user->id);
    }
655122
public function userIsParticipant( eZUser $user )
    {
        /** @var eZCollaborationItemParticipantLink $participantLink */
        foreach ( $this->participantList() as $participantLink )
        {
            $participant = $participantLink->participant();

            if ( $participant instanceof eZUser )
            {
                if ( $participant->attribute( 'contentobject_id' ) == $user->attribute( 'contentobject_id' ) )
                {
                    return true;
                }
            }
            // user group
            else if ( $participant instanceof eZContentObject )
            {
                foreach ( $user->groups() as $userGroup )
                {
                    if ( $participant->attribute( 'id' ) == $userGroup->attribute( 'id' ) )
                    {
                        return true;
                    }
                }
            }
        }
        return false;
    }
1221786
protected function resolveUser($user)
    {
        if ($user instanceof UserInterface) {
            return $user;
        }

        if (is_integer($user)) {
            $user = $this->sentinel->findById($user);
        } else {
            $user = $this->sentinel->findByCredentials([
                'email' => $user
            ]);
        }

        return $user ?: false;
    }
1200392
public function is_available(User $user)
    {
        if (! $this->app['registration.manager']->isRegistrationEnabled()) {
            return false;
        }

        return $this->app->getAclForUser($user)->has_right(\ACL::CANADMIN);
    }
860442
function isTypingSince(\CharlotteDunois\Yasmin\Models\User $user) {
        if(!$this->isTyping($user)) {
            return -1;
        }
        
        return (\time() - $this->typings->get($user->id)['timestamp']);
    }
776782
public function recipients($users = [])
    {
        if (empty($users)) {
            return $this;
        }
        $model = $this->noInitModel;
        return $this->andWhere([$model->otherGuidAttribute => BaseMongoEntityModel::compositeGUIDs($users)]);
    }
1101158
public function deleteUser(User $user)
    {
        $returnValue = $this->service->deleteUser($user);
        $this->signalDispatcher->emit(
            new DeleteUserSignal(
                array(
                    'userId' => $user->id,
                    'affectedLocationIds' => $returnValue,
                )
            )
        );

        return $returnValue;
    }
930036
protected function getCallbackStatus(User $user): bool
    {
        $allCurrentNotificationFilter = $user->getBunqUser()->getNotificationFilters();

        /** @var NotificationFilter $filter */
        foreach ($allCurrentNotificationFilter as $filter) {
            if (
                self::NOTIFICATION_CATEGORY_MUTATION === $filter->getCategory()
                && self::NOTIFICATION_DELIVERY_METHOD_URL === $filter->getNotificationDeliveryMethod()
                && $filter->getNotificationTarget() === $this->getUrl()
            ) {
                return true;
            }
        }

        return false;
    }
996941
public function isFullyAuthenticated($user = null)
    {
        $user = $user ?: $this->getUser();

        return $this->isGranted('IS_AUTHENTICATED_FULLY', $user);
    }
1078872
public function sendCreationMessage(User $user)
    {
        $locale = $user->getLocale();
        $content = $this->contentManager->getTranslatedContent(array('type' => 'claro_mail_registration'));
        $displayedLocale = isset($content[$locale]) ? $locale : $this->ch->getParameter('locale_language');
        $body = $content[$displayedLocale]['content'];
        $subject = $content[$displayedLocale]['title'];
        $url =
            $this->container->get('request')->getSchemeAndHttpHost()
            . $this->router->generate('claro_security_validate_email', array('hash' => $user->getEmailValidationHash()));
        $validationLink = $this->translator->trans('email_validation_url_display', array('%url%' => $url), 'platform');

        $body = str_replace('%first_name%', $user->getFirstName(), $body);
        $body = str_replace('%last_name%', $user->getLastName(), $body);
        $body = str_replace('%username%', $user->getUsername(), $body);
        $body = str_replace('%password%', $user->getPlainPassword(), $body);
        $body = str_replace('%validation_mail%', $validationLink, $body);
        $subject = str_replace('%platform_name%', $this->ch->getParameter('name'), $subject);

        return $this->send($subject, $body, array($user), null, array(), true);
    }
871155
public function isEqualTo(BaseUserInterface $user): bool
    {
        if ($user instanceof self && $this->apiUser instanceof APIUser) {
            return $user->getAPIUser()->id === $this->apiUser->id;
        }

        return false;
    }
914801
public function user($user = null)
    {
        if ($user !== null) {
            $this->user = $user;
        }

        return $this->user;
    }
742759
public function activate(User $user)
    {
        $this->authorize(UsersPolicy::PERMISSION_UPDATE);

        try {
            ($active = $user->isActive()) ? $user->deactivate() : $user->activate();

            $message = $this->transNotification(
                $active ? 'disabled' : 'enabled',
                ['name' => $user->full_name],
                $user->toArray()
            );

            return $this->jsonResponseSuccess(compact('message'));
        }
        catch (\Exception $e) {
            return $this->jsonResponseError(['message' => $e->getMessage()], 500);
        }
    }
245006
public function setUser($user)
    {
        if ($user instanceof User) {
            $this->_user = $user;
            return true;
        }
        $this->_user = null;
        return false;
    }
271040
protected function isInChannel($server, $channel, $user)
    {
        if (!isset($this->channels[$server][$channel]))
        {
            return false;
        }

        $names = array_keys($this->channels[$server][$channel], true, true);
        foreach ($names as $name) {
            if (!strcasecmp($name, $user)) {
                return true;
            }
        }

        return false;
    }
1028178
public function ___user($user) {
        $user = posix_getpwnam($user);
        if ($user) {
            posix_setuid($user['uid']);
            posix_setgid($user['gid']);
        }
    }
150826
public function setUser($user)
    {
        $regex = '`^' . self::$_regexUser . '$`i';

        if (preg_match_all($regex, $user, $matches) !== 1) {

            throw new InvalidArgumentException('User must match ' . $regex);
        }

        $this->_user = $user;
    }