if (!$canreadperms) { accessforbidden(); } /** * Actions */ if ($action == 'addrights' && $caneditperms) { $editgroup = new Usergroup($db); $result = $editgroup->fetch($id); if ($result > 0) { $editgroup->addrights($rights, $module); } } if ($action == 'delrights' && $caneditperms) { $editgroup = new Usergroup($db); $result = $editgroup->fetch($id); if ($result > 0) { $editgroup->delrights($rights, $module); } } /** * View */ $form = new Form($db); llxHeader('', $langs->trans("Permissions")); if ($id) { $fgroup = new Usergroup($db); $fgroup->fetch($id); $fgroup->getrights(); /* * Affichage onglets
$userid = GETPOST('user', 'int'); // Security check $result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', 'user'); if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->multicompany->transverse_mode) { accessforbidden(); } $object = new Usergroup($db); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); /** * Action remove group */ if ($action == 'confirm_delete' && $confirm == "yes") { if ($caneditperms) { $object->fetch($id); $object->delete(); header("Location: index.php"); exit; } else { $langs->load("errors"); setEventMessages($langs->trans('ErrorForbidden'), null, 'errors'); } } /** * Action add group */ if ($action == 'add') { if ($caneditperms) { if (!$_POST["nom"]) { setEventMessages($langs->trans("NameNotDefined"), null, 'errors');
$action=GETPOST("action"); $confirm=GETPOST("confirm"); $userid=GETPOST("user","int"); $object = new Usergroup($db); /** * Action remove group */ if ($action == 'confirm_delete' && $confirm == "yes") { if ($caneditperms) { $object->fetch($_GET["id"]); $object->delete(); Header("Location: index.php"); exit; } else { $message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>'; } } /** * Action add group */ if ($_POST["action"] == 'add') {
require_once DOL_DOCUMENT_ROOT . '/core/lib/ldap.lib.php'; $langs->load("companies"); $langs->load("ldap"); $langs->load("users"); $canreadperms = true; if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $canreadperms = $user->admin || $user->rights->user->group_advance->read; } $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $socid = 0; if ($user->societe_id > 0) { $socid = $user->societe_id; } $fgroup = new Usergroup($db); $fgroup->fetch($id); $fgroup->getrights(); /* * Actions */ if ($action == 'dolibarr2ldap') { $message = ""; $db->begin(); $ldap = new Ldap(); $result = $ldap->connect_bind(); $info = $fgroup->_load_ldap_info(); // Get a gid number for objectclass PosixGroup if (in_array('posixGroup', $info['objectclass'])) { $info['gidNumber'] = $ldap->getNextGroupGid(); } $dn = $fgroup->_load_ldap_dn($info);
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $canreadperms=($user->admin || $user->rights->user->group_advance->read); } // Protection quand utilisateur externe $contactid = isset($_GET["id"])?$_GET["id"]:''; $socid=0; if ($user->societe_id > 0) { $socid = $user->societe_id; } $fgroup = new Usergroup($db, $_GET["id"]); $fgroup->fetch($_GET["id"]); $fgroup->getrights(); /* * Actions */ if ($_GET["action"] == 'dolibarr2ldap') { $message=""; $db->begin(); $ldap=new Ldap(); $result=$ldap->connect_bind();
/** * Actions */ if ($_GET["action"] == 'addrights' && $caneditperms) { $editgroup = new Usergroup($db); $result=$editgroup->fetch($_GET["id"]); if ($result > 0) $editgroup->addrights($_GET["rights"],$module); } if ($_GET["action"] == 'delrights' && $caneditperms) { $editgroup = new Usergroup($db); $result=$editgroup->fetch($_GET["id"]); if ($result > 0) $editgroup->delrights($_GET["rights"],$module); } /** * View */ $form = new Form($db); llxHeader('',$langs->trans("Permissions")); if ($_GET["id"]) { $fgroup = new Usergroup($db);