@EXT\Route(
"/user/{user}/bulletinComportementWidget/",
name="laurentBulletinComportementWidget"
)

@param User $user
552663
public function bulletinComportementWidgetAction(User $user)
    {
        $comportements = $this->totauxManager->getMoyenneComportement($user);

        $params = array('comportements' => $comportements);

        return $this->render('LaurentBulletinBundle::BulletinComportementWidget.html.twig', $params);
    }
717300
public function setUser(\Concrete\Core\Entity\User\User $user)
    {
        $this->author = $user;
        $this->save();
    }
1170461
public function getWidget($widgetType, $widgetId, User $user)
    {
        /** @var \Icap\PortfolioBundle\Repository\Widget\AbstractWidgetRepository $abstractWidgetRepository */
        $abstractWidgetRepository = $this->entityManager->getRepository('IcapPortfolioBundle:Widget\AbstractWidget');
        $widget = $abstractWidgetRepository->findOneByWidgetType($widgetType, $widgetId, $user);

        return $widget;
    }
1010074
public function getUserGuidedPortfoliosData(User $user)
    {
        /** @var \Icap\PortfolioBundle\Entity\Portfolio[] $portfolios */
        $portfolios = $this->entityManager->getRepository('IcapPortfolioBundle:Portfolio')->findAvailableToGuideByUser($user);

        $data = [];

        foreach ($portfolios as $portfolio) {
            $data[] = $this->getUserGuidedPortfolioData($portfolio, $user);
        }

        return $data;
    }
509692
public function setLocale(User $user, $locale = 'en')
    {
        $user->setLocale($locale);
        $this->objectManager->persist($user);
        $this->objectManager->flush();
    }
1133427
public function render_user_notification_preferences($user) {
        $processors = get_message_processors();
        $providers = message_get_providers_for_user($user->id);

        $preferences = \core_message\api::get_all_message_preferences($processors, $providers, $user);
        $notificationlistoutput = new \core_message\output\preferences\notification_list($processors, $providers,
            $preferences, $user);
        return $this->render_from_template('message/notification_preferences',
            $notificationlistoutput->export_for_template($this));
    }
181021
public function getNewDataWidget($widgetType, User $user)
    {
        $widget = $this->widgetFactory->createDataWidget($widgetType);
        $widget
            ->setId(uniqid())
            ->setUser($user);

        return $widget;
    }
639178
public function updateUser(User $user)
    {
        $request = $user->toJson();
        $this->client->put(sprintf('/v2/user/%s', $user->getId()), $request);
    }
411467
private function userProvider(ContainerBuilder $container, $user)
    {
        $container->setDefinition(
            'bengor.user_bundle.security.' . $user . '_provider',
            new Definition(
                UserProvider::class, [
                    $container->getDefinition(
                        'bengor.user.application.query.' . $user . '_of_email'
                    ),
                    $container->getDefinition(
                        'bengor.user_bundle.security.' . $user . '_symfony_data_transformer'
                    ),
                ]
            )
        )->setPublic(false);

        $container->setAlias(
            'bengor_user.' . $user . '.provider',
            'bengor.user_bundle.security.' . $user . '_provider'
        );
    }
639554
public function checkPortfolioToolAccess(User $user = null, Portfolio $portfolio = null)
    {
        if (!$this->getPortfolioToolAccess()) {
            throw $this->createNotFoundException();
        }

        if (null !== $user && null !== $portfolio && $portfolio->getUser() !== $user) {
            $portfolioGuide = $this->getPortfolioGuideManager()->getByPortfolioAndGuide($portfolio, $user);

            if (null === $portfolioGuide) {
                throw $this->createNotFoundException();
            }
        }
    }
1068672
public function addUser(User $user)
    {
        if (!$this->users->contains($user)) {
            $this->users->add($user);
        }

        return $this;
    }
1372944
public function can_export_discussions(stdClass $user) : bool {
        global $CFG;
        return $CFG->enableportfolios && has_capability('mod/forum:exportdiscussion', $this->get_context(), $user);
    }
520229
public function sendRegisteredEmailMessage($user)
    {
        $templateName = 'CoreBundle:Email:registration.email.html.twig';
        $contractPath = null;
        $context = array(
            'user' => $user
        );

        $this->sendMessage(
                    $templateName, 
                    $context, 
                    $this->twigGlobal->getParameter('admin_email'), 
                    $user->getEmail()
//                    $contractPath
                    );
    }
752157
static private function updateUserDraft( $user )
    {
        $userObject = eZContentObject::fetch( $user->id() );

        foreach ( $userObject->dataMap() as $attribute )
        {
            if ( $attribute->ContentClassAttributeIdentifier == 'user_account' )
            {
                $attribute->setAttribute( 'data_text', eZUserType::serializeDraft( $user ) );
                $attribute->store();
                break;
            }
        }
    }
286375
public function updateUser(User $user)
    {
        $this->find("id", $user->id);
        $this->setUserData($user);
        $this->save();
    }
613705
protected function sendPasswordResetEmail(User $user)
    {
        $email = $user->email;

        /** @var \DreamFactory\Core\User\Services\User $parent */
        $parent = $this->getService();

        if (!empty($parent->passwordEmailServiceId)) {
            try {
                /** @var EmailServiceInterface $emailService */
                $emailService = ServiceManager::getServiceById($parent->passwordEmailServiceId);

                if (empty($emailService)) {
                    throw new ServiceUnavailableException("Bad email service identifier.");
                }

                $data = [];
                if (!empty($parent->passwordEmailTemplateId)) {
                    // find template in system db
                    $template = EmailTemplate::whereId($parent->passwordEmailTemplateId)->first();
                    if (empty($template)) {
                        throw new NotFoundException("Email Template id '{$parent->passwordEmailTemplateId}' not found");
                    }

                    $data = $template->toArray();
                }

                if (empty($data) || !is_array($data)) {
                    throw new ServiceUnavailableException("No data found in default email template for password reset.");
                }

                $data['to'] = $email;
                $data['content_header'] = 'Password Reset';
                $data['first_name'] = $user->first_name;
                $data['last_name'] = $user->last_name;
                $data['name'] = $user->name;
                $data['phone'] = $user->phone;
                $data['email'] = $user->email;
                $data['link'] = url(\Config::get('df.confirm_reset_url')) .
                    '?code=' . $user->confirm_code .
                    '&email=' . $email .
                    '&username=' . $user->username .
                    '&admin=' . $user->is_sys_admin;
                $data['confirm_code'] = $user->confirm_code;

                $bodyHtml = array_get($data, 'body_html');
                $bodyText = array_get($data, 'body_text');

                if (empty($bodyText) && !empty($bodyHtml)) {
                    $bodyText = strip_tags($bodyHtml);
                    $bodyText = preg_replace('/ +/', ' ', $bodyText);
                }

                $emailService->sendEmail($data, $bodyText, $bodyHtml);

                return true;
            } catch (\Exception $ex) {
                throw new InternalServerErrorException("Error processing password reset.\n{$ex->getMessage()}");
            }
        }

        return false;
    }
1077062
public function grantTo($user): void
    {
        $userModel = config('auth.providers.users.model');

        if (is_int($user) && !$userModel::find($user)) {
            return;
        }

        $this->users()->attach($user);
    }