Supprimer une personne

@return void
329485
public function supprimer()
    {
        global $config;
        $config->connexionBdd->requete(
            "DELETE FROM `_personneEvenement` WHERE idPersonne='".
            mysql_real_escape_string($this->idPersonne)."'"
        );
        $config->connexionBdd->requete(
            "DELETE FROM `_evenementPersonne` WHERE idPersonne='".
            mysql_real_escape_string($this->idPersonne)."'"
        );
        return $config->connexionBdd->requete(
            "DELETE FROM `personne` WHERE idPersonne='".
            mysql_real_escape_string($this->idPersonne)."'"
        );
    }
423612
protected function loginWithCookie() {

        $session_id = $this->getSession()->getId();
        $container  = $this->getContainer();
        $db         = $container->get('db');

        // On récupère l'état associé à la session.
        $isGuest = $db->setQuery("SELECT guest FROM #__session WHERE session_id = " . $db->quote($session_id))->loadResult();

        // On connecte l'utilisateur par cookie, seulement s'il invité.
        if (!isset($isGuest) || $isGuest == "1") {

            $cookieName = $this->getShortHashedUserAgent();

            // On contrôle que le cookie existe.
            if ($this->input->cookie->get($cookieName)) {

                // On effectue une authentification silencieuse.
                $this->login(array('username' => ''), array('useCookie' => true, 'silent' => true));

            }

        }

    }
705760
protected function OnSuccess()
    {
        $newTemplate = $this->Value('Name');
        $action = Action::Create();
        if ($this->template)
        {
            $action = Action::Update();
            $this->UpdateUsages($newTemplate);
            $oldFile = $this->CalcFile($this->template);
            if (File::Exists($oldFile))
            {
                File::Delete($oldFile);
            }
        }
        $logger = new Logger(self::Guard()->GetUser());
        $logger->ReportTemplateAction($this->module->MyType(), $newTemplate, $action);
        if (!Folder::Exists($this->folder))
        {
            Folder::Create($this->folder);
        }
        File::CreateWithText($this->CalcFile($newTemplate), $this->Value('Contents', false));
        Response::Redirect($this->BackLink());
    }
213490
protected function initFaker(): void
    {
        $language = $this->configuration->getConfigValues()['language'];
        $this->faker = \Faker\Factory::create($language);
        $this->faker->addProvider(new \Edyan\Neuralyzer\Faker\Provider\Base($this->faker));
        $this->faker->addProvider(new \Edyan\Neuralyzer\Faker\Provider\UniqueWord($this->faker, $language));
    }
1238652
public function execute() {
        global $CFG, $DB;

        if ($CFG->enablecompletion) {
            require_once($CFG->libdir . "/completionlib.php");

            if (debugging()) {
                mtrace('Marking users as started');
            }

            // This causes it to default to everyone (if there is no student role).
            $sqlroles = '';
            if (!empty($CFG->gradebookroles)) {
                $sqlroles = ' AND ra.roleid IN (' . $CFG->gradebookroles.')';
            }

            // It's purpose is to locate all the active participants of a course with course completion enabled.
            // We also only want the users with no course_completions record as this functions job is to create
            // the missing ones :)
            // We want to record the user's enrolment start time for the course. This gets tricky because there can be
            // multiple enrolment plugins active in a course, hence the possibility of multiple records for each
            // couse/user in the results.
            $sql = "SELECT c.id AS course, u.id AS userid, crc.id AS completionid, ue.timestart AS timeenrolled,
                           ue.timecreated
                      FROM {user} u
                INNER JOIN {user_enrolments} ue ON ue.userid = u.id
                INNER JOIN {enrol} e ON e.id = ue.enrolid
                INNER JOIN {course} c ON c.id = e.courseid
                INNER JOIN {role_assignments} ra ON ra.userid = u.id
                 LEFT JOIN {course_completions} crc ON crc.course = c.id AND crc.userid = u.id
                     WHERE c.enablecompletion = 1
                       AND crc.timeenrolled IS NULL
                       AND ue.status = 0
                       AND e.status = 0
                       AND u.deleted = 0
                       AND ue.timestart < ?
                       AND (ue.timeend > ? OR ue.timeend = 0)
                       $sqlroles
                  ORDER BY course, userid";
            $now = time();
            $rs = $DB->get_recordset_sql($sql, [$now, $now, $now, $now]);

            // Check if result is empty.
            if (!$rs->valid()) {
                // Not going to iterate (but exit), close rs.
                $rs->close();
                return;
            }

            // We are essentially doing a group by in the code here (as I can't find a decent way of doing it
            // in the sql). Since there can be multiple enrolment plugins for each course, we can have multiple rows
            // for each participant in the query result. This isn't really a problem until you combine it with the fact
            // that the enrolment plugins can save the enrol start time in either timestart or timeenrolled.
            // The purpose of the loop is to find the earliest enrolment start time for each participant in each course.
            $prev = null;
            while ($rs->valid() || $prev) {
                $current = $rs->current();
                if (!isset($current->course)) {
                    $current = false;
                } else {
                    // Not all enrol plugins fill out timestart correctly, so use whichever is non-zero.
                    $current->timeenrolled = max($current->timecreated, $current->timeenrolled);
                }

                // If we are at the last record, or we aren't at the first and the record is for a diff user/course.
                if ($prev && (!$rs->valid() ||
                        ($current->course != $prev->course || $current->userid != $prev->userid))) {

                    $completion = new \completion_completion();
                    $completion->userid = $prev->userid;
                    $completion->course = $prev->course;
                    $completion->timeenrolled = (string) $prev->timeenrolled;
                    $completion->timestarted = 0;
                    $completion->reaggregate = time();
                    if ($prev->completionid) {
                        $completion->id = $prev->completionid;
                    }
                    $completion->mark_enrolled();

                    if (debugging()) {
                        mtrace('Marked started user ' . $prev->userid . ' in course ' . $prev->course);
                    }
                } else if ($prev && $current) {
                    // Else, if this record is for the same user/course use oldest timeenrolled.
                    $current->timeenrolled = min($current->timeenrolled, $prev->timeenrolled);
                }
                // Move current record to previous.
                $prev = $current;
                // Move to next record.
                $rs->next();
            }
            $rs->close();
        }
    }
1350267
public function registerAction()
    {
        if ($this->zfcUserAuthentication()->hasIdentity()) {

            return $this->redirect()->toUrl($this->url()->fromRoute($this->getOptions()->getLoginRedirectRoute()));
        }
        $request = $this->getRequest();
        $service = $this->getUserService();
        $form = $this->getRegisterForm();
        $socialnetwork = $this->params()->fromRoute('socialnetwork', false);
        $form->setAttribute('action', $this->url()->fromRoute('frontend/zfcuser/register'));
        $params = array();
        $socialCredentials = array();

        if ($this->getOptions()->getUseRedirectParameterIfPresent() && $request->getQuery()->get('redirect')) {
            $redirect = $request->getQuery()->get('redirect');
        } else {
            $redirect = false;
        }

        if ($socialnetwork) {
            $infoMe = null;
            $infoMe = $this->getProviderService()->getInfoMe($socialnetwork);

            if (!empty($infoMe)) {
                $user = $this->getProviderService()->getUserProviderMapper()->findUserByProviderId($infoMe->identifier, $socialnetwork);

                if ($user || $service->getOptions()->getCreateUserAutoSocial() == true) {
                    //on le dirige vers l'action d'authentification
                    if (!$redirect && $this->getOptions()->getLoginRedirectRoute() != '') {
                        $redirect = $this->url()->fromRoute($this->getOptions()->getLoginRedirectRoute());
                    }
                    // If the user has been authenticated on FB and the user was in a game, we send him back to the game
                    $session = new Container('facebook');
                    if ($session->offsetGet('fb-redirect')) {
                        $redirect = $session->offsetGet('fb-redirect');
                    }
                    //$redir = $this->url()->fromRoute('frontend/zfcuser/login') .'/' . $socialnetwork . ($redirect ? '?redirect=' . $redirect : '');
                    $redir = $this->url()->fromRoute('frontend/zfcuser/authenticate') .'?provider=' . $socialnetwork . ($redirect ? '&redirect=' . $redirect : '');
                    return $this->redirect()->toUrl($redir);
                }

                // Je retire la saisie du login/mdp
                $form->setAttribute('action', $this->url()->fromRoute('frontend/zfcuser/register', array('socialnetwork' => $socialnetwork)));
                $form->remove('password');
                $form->remove('passwordVerify');

                $birthMonth = $infoMe->birthMonth;
                if (strlen($birthMonth) <= 1) {
                    $birthMonth = '0'.$birthMonth;
                }
                $birthDay = $infoMe->birthDay;
                if (strlen($birthDay) <= 1) {
                    $birthDay = '0'.$birthDay;
                }
                $title = '';
                $gender = $infoMe->gender;
                if ($gender == 'female') {
                    $title = 'Me';
                } else {
                    $title = 'M';
                }

                $params = array(
                    //'birth_year'  => $infoMe->birthYear,
                    'title'      => $title,
                    'dob'      => $birthDay.'/'.$birthMonth.'/'.$infoMe->birthYear,
                    'firstname'   => $infoMe->firstName,
                    'lastname'    => $infoMe->lastName,
                    'email'       => $infoMe->email,
                    'postalCode' => $infoMe->zip,
                );
                $socialCredentials = array(
                    'socialNetwork' => strtolower($socialnetwork),
                    'socialId'      => $infoMe->identifier,
                );
            }
        }

        $redirectUrl = $this->url()->fromRoute('frontend/zfcuser/register') .($socialnetwork ? '/' . $socialnetwork : ''). ($redirect ? '?redirect=' . $redirect : '');
        $prg = $this->fileprg($form, $redirectUrl, true);

        if ($prg instanceof Response) {
            return $prg;
        } elseif ($prg === false) {
            $form->setData($params);

            return array(
                'registerForm' => $form,
                'enableRegistration' => $this->getOptions()->getEnableRegistration(),
                'redirect' => $redirect
            );
        }

        $post = $prg;
        $post = array_merge(
            $post,
            $socialCredentials
        );

        if (isset($post['optin'])) {
            $post['optin'] = 1;
        } else {
            $post['optin'] = 0;
        }
        if (isset($post['optin2'])) {
            $post['optin2'] = 1;
        } else {
            $post['optin2'] = 0;
        }
        if (isset($post['optinPartner'])) {
            $post['optinPartner'] = 1;
        } else {
            $post['optinPartner'] = 0;
        }

        if ($service->getOptions()->getUseRecaptcha()) {
            if (!isset($post['g-recaptcha-response']) || $post['g-recaptcha-response'] == '' || !$this->recaptcha()->recaptcha($post['g-recaptcha-response'])) {
                $form->setData($post);

                return array(
                    'registerForm'       => $form,
                    'enableRegistration' => $this->getOptions()->getEnableRegistration(),
                    'redirect'           => $redirect,
                    'message'            => $this->serviceLocator->get('MvcTranslator')->translate(
                        'Invalid Captcha. Please try again.',
                        'playgrounduser'
                    ),
                );

                return $viewModel;
            }
        }

        $user = $service->register($post);

        if (! $user) {
            return array(
                'registerForm' => $form,
                'enableRegistration' => $this->getOptions()->getEnableRegistration(),
                'redirect' => $redirect
            );
        }

        if ($service->getOptions()->getEmailVerification()) {
            $vm = new ViewModel(array('userEmail' => $user->getEmail()));
            $vm->setTemplate('playground-user/register/registermail');

            return $vm;
        } elseif ($service->getOptions()->getLoginAfterRegistration()) {
            $identityFields = $service->getOptions()->getAuthIdentityFields();
            if (in_array('email', $identityFields)) {
                $post['identity'] = $user->getEmail();
            } elseif (in_array('username', $identityFields)) {
                $post['identity'] = $user->getUsername();
            }
            $post['credential'] = isset($post['password'])?$post['password']:'';
            $request->setPost(new Parameters($post));

            return $this->forward()->dispatch(
                'playgrounduser_user',
                array(
                    'action' => 'authenticate'
                )
            );
        }

        $redirect = $this->url()->fromRoute('frontend/zfcuser/login') . ($socialnetwork ? '/' . $socialnetwork : ''). ($redirect ? '?redirect=' . $redirect : '');

        return $this->redirect()->toUrl($redirect);
    }
46113
public function fill()
    {
        $languages = $this->languageRepository->activeLanguages();
        $this->initPages($languages);
        $this->initBasePages($languages);
    }
121023
public function suspend(): void
    {
        if (!userHasPermission('admin:auth:accounts:suspend')) {
            unauthorised();
        }

        // --------------------------------------------------------------------------

        //  Get the user's details
        $oUri       = Factory::service('Uri');
        $oInput     = Factory::service('Input');
        $oSession   = Factory::service('Session', 'nails/module-auth');
        $oUserModel = Factory::model('User', 'nails/module-auth');
        $iUserId    = $oUri->segment(5);
        $oUser      = $oUserModel->getById($iUserId);
        $bOldValue  = $oUser->is_suspended;

        // --------------------------------------------------------------------------

        //  Non-superusers editing superusers is not cool
        if (!isSuperuser() && userHasPermission('superuser', $oUser)) {
            $oSession->setFlashData('error', lang('accounts_edit_error_noteditable'));
            $this->returnToIndex();
        }

        // --------------------------------------------------------------------------

        //  Suspend user
        $oUserModel->suspend($iUserId);

        // --------------------------------------------------------------------------

        //  Get the user's details, again
        $oUser     = $oUserModel->getById($iUserId);
        $bNewValue = $oUser->is_suspended;

        // --------------------------------------------------------------------------

        //  Define messages
        if (!$oUser->is_suspended) {
            $oSession->setFlashData(
                'error',
                lang('accounts_suspend_error', title_case($oUser->first_name . ' ' . $oUser->last_name))
            );
        } else {
            $oSession->setFlashData(
                'success',
                lang('accounts_suspend_success', title_case($oUser->first_name . ' ' . $oUser->last_name))
            );
        }

        // --------------------------------------------------------------------------

        //  Update admin changelog
        $this->oChangeLogModel->add(
            'suspended',
            'a',
            'user',
            $iUserId,
            '#' . number_format($iUserId) . ' ' . $oUser->first_name . ' ' . $oUser->last_name,
            'admin/auth/accounts/edit/' . $iUserId,
            'is_suspended',
            $bOldValue,
            $bNewValue,
            false
        );

        // --------------------------------------------------------------------------

        $this->returnToIndex();
    }
920094
protected function prepareForValidation(): void
    {
        $data = $this->all();

        // Set abilities
        if (! empty($data['abilities'])) {
            if ($this->user($this->route('guard'))->can('grant', \Cortex\Auth\Models\Ability::class)) {
                $abilities = array_map('intval', $this->get('abilities', []));
                $data['abilities'] = $this->user($this->route('guard'))->isA('superadmin') ? $abilities
                    : $this->user($this->route('guard'))->getAbilities()->pluck('id')->intersect($abilities)->toArray();
            } else {
                unset($data['abilities']);
            }
        }

        $this->replace($data);
    }
736628
protected function performEnrichment()
    {
        if ( ! count($this->info->form->fields)) {
            $this->fillDataForEmpty();
        } else {
            $this->enrichCustomData();
        }
    }
1200575
public function run()
	{
		$this->permissionsUserSeeder();
        $this->permissionsRoleSeeder();
        $this->permissionsSeeder();
        $this->permissionsAllSeeder();
        $this->rolesSeeder();
        $this->addPermissionRoleSeeder();
		$this->usersSeeder();
		$this->roleUserSeeder();
	}
946277
protected function OnSuccess()
    {
        $action = $this->group->Exists() ? Action::Update() : Action::Create();
        $this->group->SetName($this->Value('Name'));
        $this->group->SetCreateContainers((bool)$this->Value('CreateContainers'));
        $this->group->SetCreateLayouts((bool)$this->Value('CreateLayouts'));
        $this->group->SetCreateContainers((bool)$this->Value('CreateContainers'));
        $this->group->Save();
        $logger = new Logger(self::Guard()->GetUser());
        $logger->ReportUserGroupAction($this->group, $action);
        $target = BackendRouter::ModuleUrl(new UsergroupList());
        Response::Redirect($target);
    }
1122163
protected function getInput() {

        @set_time_limit(120);
        @ini_set('max_execution_time', 120);

        // Initialisation.
        $html = array();
        $text = $this->getText();

        // JS
        (new RequireJSUtility())
            ->addDomReadyJS("$('[data-toggle=\"tooltip\"], .hasTooltip').tooltip({container:'body',html:true});", false, "bootstrap");

        if (!empty($this->value)) {
            $value = new Registry($this->value);
        }

        $class = $this->element['class'] ? ' ' . (string)$this->element['class'] : '';

        // On récupère l'instance de gestion ACL.
        $acl    = Acl::getInstance($this->form->getDb());
	    $simple = $acl->getSimpleAcl();

        // On récupère les sections et les actions.
        $actions = $this->getActions();

        // On charge les groupes utilisateurs.
        $groups = $this->getUserGroups();

	    // On charge les rôles.
	    $roles = $acl->getRoles();

        // Building tab nav
        $html[] = '<div role="tabpanel" class="nav-tabs-left">';

        $html[] = '<ul class="nav nav-tabs" role="tablist">';

        foreach ($groups as $i => $group) {
            $tab_class = $i == 0 ? ' class="active"' : '';
            $html[] = '<li role="presentation"' . $tab_class . '><a href="#group-' . $group->id . '" aria-controls="group-' . $group->id . '" role="tab" data-toggle="tab">';
            $html[] = str_repeat('<span class="level">&ndash;</span> ', $curLevel = $group->level) . $group->title;
            $html[] = '</a></li>';
        }

        $html[] = '</ul>';
        $html[] = '<div class="tab-content">';

        foreach ($groups as $i => $group) {

            $tab_class = $i == 0 ? ' active' : '';

            $html[] = '<div role="tabpanel" class="tab-pane' . $tab_class .'" id="group-' . $group->id . '">';

            $html[] = '<table class="rights table table-condensed' . $class . '">';

            $html[] = '<thead>';
            $html[] = '<tr>';
            $html[] = '<th>' . $text->translate('APP_GLOBAL_RIGHTS_HEADING_SECTION') . '</th>';
            $html[] = '<th>' . $text->translate('APP_GLOBAL_RIGHTS_HEADING_ACTION') . '</th>';
            $html[] = '<th>' . $text->translate('APP_GLOBAL_RIGHTS_HEADING_RIGHT') . '</th>';

            if ($group->parent_id) {
                $html[] = '<th id="aclactionth' . $group->id . '">';
                $html[] = '<span class="acl-action">' . $text->translate('APP_GLOBAL_RIGHTS_HEADING_CALCULATED_SETTING') . '</span>';
                $html[] = '</th>';
            }

            $html[] = '</tr>';
            $html[] = '</thead>';

            $html[] = '<tbody>';

            // On parcourt les sections.
            foreach ($actions as $section) {

                $rowspan = count($section->actions);

                foreach ($section->actions as $i => $action) {

                    $html[] = '<tr>';

                    if ($i == 0) {
                        $html[] = '<td class="section" rowspan="' . $rowspan . '"><span class="hasTooltip" title="' . $text->translate($section->description) . '">' . $text->translate($section->title) . '</td>';
                    }

                    $html[] = '<td class="action"><span class="hasTooltip" title="' . $text->translate($action->description) . '">' . $text->translate($action->title) . '</td>';
                    $html[] = '<td class="right">';

                    $html[] = '<select class="form-control input-sm"'
                        . ' name="' . $this->name . '[' . $section->name . '][' . $action->name . '][' . $group->id . ']"'
                        . ' id="' . $this->id . '_' . $section->name . '_' . $action->name	. '_' . $group->id . '"'
                        . ' title="' . $text->sprintf('APP_GLOBAL_RIGHTS_SELECT_ALLOW_DENY_GROUP', $text->translate($action->title), trim($group->title)) . '">';

                    // On récupère les droits pour l'action hérités pour le groupe.
                    $inheritedRule = $acl->checkGroup($group->id, $section->name, $action->name);

                    // On récupère les droits pour l'action NON HÉRITÉS pour le groupe.
                    $assetRule = null;

	                $groups = new RoleAggregate();
	                $groups->addRole($roles[$group->id]);
                    $res = $simple->isAllowedReturnResult($groups, $section->name, $action->name)->collection;

                    if ($res->count() > 0) {
                        $res->top();
                        while($res->valid()) {
                            $priority = $res->current()->getPriority();

                            // La règle est appliqué à ce groupe en particulier si la priorité est à zero.
                            if ($priority == 0) {
                                $assetRule = $res->current()->getAction();
                            }

                            $res->next();
                        }
                    }

                    // Build the dropdowns for the permissions sliders

                    // The parent group has "Not Set", all children can rightly "Inherit" from that.
                    $html[] = '<option value=""' . ($assetRule === null ? ' selected="selected"' : '') . '>'
                        . $text->translate(empty($group->parent_id) ? 'APP_GLOBAL_RIGHTS_NOT_SET' : 'APP_GLOBAL_RIGHTS_INHERITED') . '</option>';
                    $html[] = '<option value="1"' . ($assetRule === true ? ' selected="selected"' : '') . '>' . $text->translate('APP_GLOBAL_RIGHTS_ALLOWED')
                        . '</option>';
                    $html[] = '<option value="0"' . ($assetRule === false ? ' selected="selected"' : '') . '>' . $text->translate('APP_GLOBAL_RIGHTS_DENIED')
                        . '</option>';

                    $html[] = '</select>&#160; ';

                    // If this asset's rule is allowed, but the inherited rule is deny, we have a conflict.
                    if (($assetRule === true) && ($inheritedRule === false)) {
                        $html[] = $text->translate('APP_GLOBAL_RIGHTS_CONFLICT');
                    }

                    $html[] = '</td>';

                    // Build the Calculated Settings column.
                    // The inherited settings column is not displayed for the root group in global configuration.
                    if ($group->parent_id) {

                        $html[] = '<td headers="aclactionth' . $group->id . '">';

                        // This is where we show the current effective settings considering currrent group, path and cascade.
                        // Check whether this is a component or global. Change the text slightly.

                        if ($acl->checkGroup($group->id, "app", "admin") !== true) {

                            if ($inheritedRule === true) {
                                $html[] = '<span class="label label-success">' . $text->translate('APP_GLOBAL_RIGHTS_ALLOWED') . '</span>';
                            } elseif ($inheritedRule === false) {
                                $html[] = '<span class="label label-danger">' . $text->translate('APP_GLOBAL_RIGHTS_NOT_ALLOWED') . '</span>';
                            }

                        } elseif ($section->name != 'app') {
                                $html[] = '<span class="label label-success"><i class="fa fa-lock"></i> ' . $text->translate('APP_GLOBAL_RIGHTS_ALLOWED_ADMIN')
                                    . '</span>';
                        } else {

                            // Special handling for  groups that have global admin because they can't  be denied.
                            // The admin rights can be changed.

                            if ($section->name === 'app' && $action->name === 'admin') {
                                $html[] = '<span class="label label-success">' . $text->translate('APP_GLOBAL_RIGHTS_ALLOWED') . '</span>';
                            } elseif ($inheritedRule === false) {
                                // Other actions cannot be changed.
                                $html[] = '<span class="label label-danger"><i class="fa fa-lock"></i> '
                                    . $text->translate('APP_GLOBAL_RIGHTS_NOT_ALLOWED_ADMIN_CONFLICT') . '</span>';
                            } else {
                                $html[] = '<span class="label label-success"><i class="fa fa-lock"></i> ' . $text->translate('APP_GLOBAL_RIGHTS_ALLOWED_ADMIN')
                                    . '</span>';
                            }
                        }

                        $html[] = '</td>';
                    }

                    $html[] = '</tr>';

                }

            }


            $html[] = '';
            $html[] = '';
            $html[] = '';
            $html[] = '</tbody>';

            $html[] = '</table>';

            $html[] = '</div>';

        }

        $html[] = '</div>';
        $html[] = '</div>';

        return implode($html);

    }
1266996
public function cmdUpdateUser()
    {
        $params = $this->getParam();

        if (empty($params[0]) || count($params) < 2) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        if (!is_numeric($params[0])) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        $this->setSubmitted(null, $params);
        $this->setSubmitted('update', $params[0]);
        $this->setSubmittedJson('data');

        $this->validateComponent('user', array('admin' => true));

        $this->updateUser($params[0]);
        $this->output();
    }
699200
protected function Init()
    {        
        $this->user = new User(Request::GetData('user'));
        
        $this->AddNameField();
        $this->AddEmailField();
        $this->AddPasswordField();
        $this->AddPasswordRepeatField();
        $this->AddIsAdminField();
        $this->AddLanguageField();
        $this->AddSubmit();
        return parent::Init();
    }
805530
protected function init()
    {
        $this->setLevel(ConfigQuery::read(self::VAR_LEVEL, self::DEFAULT_LEVEL));

        $this->dir_destinations = array(
                __DIR__.DS.'Destination',
                THELIA_LOCAL_DIR.'tlog'.DS.'destinations'
        );

        $this->setPrefix(ConfigQuery::read(self::VAR_PREFIXE, self::DEFAUT_PREFIXE));
        $this->setFiles(ConfigQuery::read(self::VAR_FILES, self::DEFAUT_FILES));
        $this->setIp(ConfigQuery::read(self::VAR_IP, self::DEFAUT_IP));
        $this->setDestinations(ConfigQuery::read(self::VAR_DESTINATIONS, self::DEFAUT_DESTINATIONS));
        $this->setShowRedirect(ConfigQuery::read(self::VAR_SHOW_REDIRECT, self::DEFAUT_SHOW_REDIRECT));

        // Au cas ou il y aurait un exit() quelque part dans le code.
        register_shutdown_function(array($this, 'writeOnExit'));
    }
76041
public function actionRoleAssign() : void
    {
        $username = $this->prompt('Username:', ['required' => true]);
        $user = $this->findModel($username);
        $roleName = $this->select('Role:', ArrayHelper::map($this->authManager->getRoles(), 'name', 'description'));
        $role = $this->authManager->getRole($roleName);
        $this->authManager->assign($role, $user->id);
        $this->log(true);
    }