Ejemplo n.º 1
0
 if ($groupM->getGroupUserMap($groupM->getId('guests'), $userM->getIdByName('#core#_#0#')) == 0) {
     $groupM->addGroupUserMap($groupM->getId('guests'), $userM->getIdByName('#core#_#0#'));
 }
 // Add default auth
 echo ' - Fill auths table<BR>';
 $authM = new authManager();
 $authMethodM = new authMethodManager();
 $userM = new userManager();
 if ($authM->getId($userM->getIdByName('admin'), $authMethodM->getId('LOCAL')) == 0) {
     $authM->create($userM->getIdByName('admin'), $authMethodM->getId('LOCAL'), 'admin', 'gob', 'lib/avatars/brain.jpg', '', '', 'admin');
 }
 // Add default access
 echo ' - Fill access table<BR>';
 $accessM = new accessManager();
 $objectM = new objectManager();
 $groupM = new groupManager();
 $pluginM = new pluginManager();
 if ($accessM->getId($objectM->getId(getTableId('core_groups'), $groupM->getId('admins')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core'))) == 0) {
     $accessM->create($objectM->getId(getTableId('core_groups'), $groupM->getId('admins')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core')), 100);
 }
 if ($accessM->getId($objectM->getId(getTableId('core_groups'), $groupM->getId('members')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core'))) == 0) {
     $accessM->create($objectM->getId(getTableId('core_groups'), $groupM->getId('members')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core')), 20);
 }
 if ($accessM->getId($objectM->getId(getTableId('core_groups'), $groupM->getId('guests')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core'))) == 0) {
     $accessM->create($objectM->getId(getTableId('core_groups'), $groupM->getId('guests')), $objectM->getId(getTableId('core_plugins'), $pluginM->getId('core')), 10);
 }
 // Add default job
 echo ' - Fill jobs table<BR>';
 $jobM = new jobManager();
 $pluginM = new pluginManager();
 if ($jobM->getId($pluginM->getId('core'), 'translate') == 0) {
Ejemplo n.º 2
0
 case 'group_user_map_create':
     if (isset($_GET['id'])) {
         $id = $_GET['id'];
     } elseif (isset($_POST['id'])) {
         $id = $_POST['id'];
     } else {
         // TODO ERROR
     }
     if (isset($_GET['userId'])) {
         $userId = $_GET['userId'];
     } elseif (isset($_POST['userId'])) {
         $userId = $_POST['userId'];
     } else {
         // TODO ERROR
     }
     $groupM = new groupManager();
     if ($groupM->getGroupUserMap($id, $userId) == 0) {
         $groupM->addGroupUserMap($id, $userId);
         // TODO
         echo 'Le membre vient d\'être ajouté!';
         echo '<script type="text/javascript">$( \'#popupContent\' ).load(\'index.php?m=a&g=core&p=admin_groups&a=group_user_map&id=' . $id . '\');</script>';
     } else {
         // TODO
         echo 'Ce membre existe déjà.';
     }
     break;
     // Display the table content
 // Display the table content
 case 'jsonList':
     $dataArray['data'] = array();
     $q0 = get_link()->prepare("SELECT id AS ID,name AS NAME FROM " . get_ini('BDD_PREFIX') . "core_groups WHERE deleted_date=0 ORDER BY name ASC");
Ejemplo n.º 3
0
 function register($method, $name, $password, $avatar, $lastName, $firstName, $mail, $isSendMail = 'TRUE')
 {
     $authM = new authManager();
     $authMethodM = new authMethodManager();
     $groupM = new groupManager();
     // Check if the user already exist
     if ($mail != '' && mailCheck($mail) && $this->getId($mail) == 0) {
         // $authM->getId($userId,$methodId) && ($method,$mail,$password) == 0
         // Generate a password
         $generatedPassword = stringGenerate();
         if ($isSendMail == 'TRUE') {
             // On envoie le mail de confirmation avec le mot de passe
             $sujet = 'Création d\'un compte ' . get_ini('APPLICATION_NAME');
             $message = '
         	            Bonjour,<br />
         	            <br />
         	            Voici vos identifiants pour l\'application ' . get_ini('APPLICATION_NAME') . '<br />
         	            Login: <strong>' . $mail . '</strong><br />
         	            Password: <strong>' . $generatedPassword . '</strong><br />
         	            <br />
         	            Merci!<br />
         	            <br />
         	            ' . get_ini('ADMIN_MAIL') . '
         	            ';
             $destinataire = strtolower($mail);
             $headers = "From: " . get_ini('ADMIN_MAIL') . "\n";
             $headers .= "Reply-To: " . get_ini('ADMIN_MAIL') . "\n";
             $headers .= "Content-Type: text/html; charset=\"UTF-8\"";
             if (!mail($destinataire, $sujet, $message, $headers)) {
                 echo "Une erreur c'est produite lors de l'envois de l'email.";
             }
         }
         // On créé l'utilisateur
         $q0_last_insert = $this->create($name, $avatar, $mail);
         // On ajoute la méthode de connexion locale
         $authM->create($q0_last_insert, $authMethodM->getId('LOCAL'), $name, $generatedPassword, $avatar, $lastName, $firstName, $mail);
         // On ajoute le groupe par défaut si il y en a un
         if (get_ini('default_group') != '') {
             $groupM->addGroupUserMap($groupM->getId(get_ini('default_group')), $q0_last_insert);
         }
         // On ajoute d'éventuelle autre méthode d'authentification (Facebook, google, ...)
         switch ($method) {
             case 'LDAP':
                 $authM->create($q0_last_insert, $authMethodM->getId('LDAP'), strtolower($name), '', get_ini('DEFAULT_AVATAR'), '', '', $mail, 'FALSE');
                 break;
             case 'FACEBOOK':
                 $authM->create($q0_last_insert, $authMethodM->getId('FACEBOOK'), $name, $password, $avatar, $lastName, $firstName, $mail);
                 break;
             case 'GOOGLE':
                 $authM->create($q0_last_insert, $authMethodM->getId('GOOGLE'), $name, $password, $avatar, $lastName, $firstName, $mail);
                 break;
         }
     } else {
         // Todo error
     }
 }
Ejemplo n.º 4
0
<?php

require_once "include/Page.class.php";
require_once "include/tools.php";
// DEBUT du contenu specifique
require_once "orchestra/groupManager.class.php";
$gm = new groupManager();
$page = new Page("Management de groupe pour " . $gm->getNameFundation());
$page->topMenu();
$editGroup = array();
$availableGroups = $gm->getAvailableGroups();
foreach ($availableGroups as $group) {
    $edit = array("Editer " . $group[1], "?action=edit&grp_id=" . $group[0]);
    $suppr = array("Supprimer " . $group[1], "?action=del&grp_id=" . $group[0]);
    $editGroup[] = $edit;
    $editGroup[] = $suppr;
}
$sideMenu = array(array("Groupes", array(array("Ajouter un nouveau groupe", "?action=add"))), array("Groupes existants", $editGroup));
$page->sideMenu($sideMenu);
if (isset($_GET["action"])) {
    if (!empty($_GET["action"])) {
        $action = $_GET["action"];
        switch ($action) {
            case "add":
                echo Page_addGroup($gm);
                break;
            case "edit":
                echo Page_editGroup($gm, $_GET["grp_id"]);
                break;
            case "del":
                echo Page_delGroup($gm, $_GET["grp_id"]);
<?php

// ------------------------------------------------------------------- //
// Add this statements only on the admin_plugins and setup page. This check if the current user is in the admins group
// ------------------------------------------------------------------- //
$groupM = new groupManager();
$user = new user($_SESSION['USER_ID']);
if (!isset($user->groupIdArray) || !in_array($groupM->getId('admins'), $user->groupIdArray)) {
    include 'plugins/core/403.php';
    exit(403);
}
// ------------------------------------------------------------------- //
//$q0 = get_link()->prepare('INSERT INTO GLDEV.gl_core_security ( id, id_source, id_target, secure_level, created_date, edited_date, deleted_date, created_id, edited_id, deleted_id) VALUES ( '1', '21', '1', '100', 0, 0, 0, 0, 0, 0)');
//$q0->execute();
$pageM = new pageManager();
// Populate core_pages table in database
echo '<U>Add new Php pages : </U><BR>';
foreach ($init->pluginsIndex as $plugin) {
    if ($handle = opendir('plugins/' . $plugin)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != ".." && $file != "" && strtolower(substr($file, strrpos($file, '.') + 1)) == 'php') {
                $pageName = strtolower(substr($file, 0, strrpos($file, '.')));
                if ($pageM->getId(getPluginId($plugin), $pageName) == 0) {
                    $pageM->create(getPluginId($plugin), $pageName);
                    echo 'Page ' . $plugin . '/' . $pageName . ' added<BR>';
                }
            }
        }
        closedir($handle);
    }
}