Exemple #1
0
	try {
		$editgroup->load($id);

		$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);
Exemple #2
0
			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) {

			$object->load($id);

			if ($action == 'adduser') {
				$object->couchAdmin->addRoleToUser($userid, $object->name);
			}
			if ($action == 'removeuser') {
				$object->couchAdmin->removeRoleFromUser($userid, $object->name);
			}

			if ($result > 0) {
				header("Location: fiche.php?id=" . $object->id);
				exit;
			} else {
				$message.=$edituser->error;
			}
		}