Beispiel #1
0
		$editgroup->values->rights->$_GET['pid'] = true;
		$editgroup->record();
	} catch (Exception $e) {
		$mesg = $e->getMessage();
	}
	Header("Location: " . $_SERVER['PHP_SELF'] . "?id=".$id."&mesg=" . urlencode($mesg));
	exit;
}

if ($action == 'remove' && $caneditperms) {
	$editgroup = new Usergroup($db);
	try {
		$editgroup->load($id);
		unset($editgroup->values->rights->$_GET['pid']);

		$editgroup->record();
	} catch (Exception $e) {
		$mesg = $e->getMessage();
	}
	Header("Location: " . $_SERVER['PHP_SELF'] . "?id=".$id."&mesg=" . urlencode($mesg));
	exit;
}


/**
 * View
 */
$form = new Form($db);

llxHeader('', $langs->trans("Permissions"));
Beispiel #2
0
 *  Action add group
 */
if ($action == 'add') {
	if ($caneditperms) {
		$message = "";
		if (!$_POST["nom"]) {
			$message = '<div class="error">' . $langs->trans("NameNotDefined") . '</div>';
			$action = "create";	// Go back to create page
		}

		if (!$message) {
			$object->name = trim($_POST["nom"]);
			$object->note = trim($_POST["note"]);
			$object->_id = "group:".$object->name;

			$object->record();

			Header("Location: fiche.php?id=" . $object->id);
			exit;
		}
	} else {
		$langs->load("errors");
		$message = '<div class="error">' . $langs->trans('ErrorForbidden') . '</div>';
	}
}

// Add/Remove user into group
if ($action == 'adduser' || $action == 'removeuser') {
	if ($caneditperms) {
		if ($userid) {