コード例 #1
0
 public function modifiy($name, $description, $generalPermissions)
 {
     if ($this->id == ProfilAdmin::ID_PROFIL_SUPERADMINISTRATEUR) {
         throw new TheliaAdminException("Caanot change Superadministrator permissions", TheliaAdminException::CANNOT_CHANGE_SUPERADMINISTRATOR_PERMISSIONS);
     }
     $this->verifyLoaded();
     $profileDescription = new Profildesc();
     if ($profileDescription->charger($this->id)) {
         $profileDescription->titre = $name;
         $profileDescription->description = $description;
         $profileDescription->maj();
     }
     if ($generalPermissions === null) {
         $generalPermissions = array();
     }
     foreach ($this->query_liste("SELECT * FROM " . Autorisation::TABLE) as $row) {
         $autorisation_profil = new Autorisation_profilAdmin();
         $autorisation_profil->charger($row->id, $this->id);
         if (array_key_exists($row->id, $generalPermissions) && $generalPermissions[$row->id] == 'on') {
             if (!$autorisation_profil->id) {
                 $autorisation_profil->profil = $this->id;
                 $autorisation_profil->autorisation = $row->id;
                 $autorisation_profil->lecture = 0;
                 $autorisation_profil->ecriture = 0;
                 $autorisation_profil->id = $autorisation_profil->add();
             }
             $autorisation_profil->lecture = 1;
             $autorisation_profil->ecriture = 1;
             $autorisation_profil->maj();
         } else {
             if ($autorisation_profil->id) {
                 $autorisation_profil->lecture = 0;
                 $autorisation_profil->ecriture = 0;
                 $autorisation_profil->maj();
             }
         }
     }
     redirige("droits.php?profil=" . $this->id);
 }
コード例 #2
0
ファイル: droits.php プロジェクト: anti-conformiste/thelia1
<?php

require_once "auth.php";
require_once "../fonctions/divers.php";
if (!est_autorise("acces_configuration")) {
    exit;
}
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
$currentProfil = new ProfilAdmin();
$currentProfil->charger_id($request->get("profil", 0));
if (!$currentProfil->id) {
    $currentProfil->chargerPermier(array(ProfilAdmin::ID_PROFIL_SUPERADMINISTRATEUR));
}
$currentProfilDesc = new Profildesc();
$currentProfilDesc->charger($currentProfil->id);
try {
    ActionsAdminProfil::getInstance()->action($request);
} catch (TheliaAdminException $e) {
    $errorCode = $e->getCode();
    if ($errorCode == TheliaAdminException::BAD_PROFILE_FORMULATION) {
        $addError = 1;
    }
}
?>
<!DOCTYPE html>
<html lang="fr">
    <head>
        <?php 
require_once "title.php";
?>
    </head>