setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $userManager = new \pvv\admin\UserManager($pdo); require_once(__DIR__ . '/../../../vendor/simplesamlphp/simplesamlphp/lib/_autoload.php'); $as = new SimpleSAML_Auth_Simple('default-sp'); $as->requireAuth(); $attrs = $as->getAttributes(); $uname = $attrs['uid'][0]; if(!$userManager->isAdmin($uname)){ echo 'Ingen tilgang'; exit(); } // 2d array of usernames and their corresponding group flags $userFlags = []; foreach($_POST as $namegroup => $check){ $data = explode('_', $namegroup); if(!isset($userFlags[$data[0]])){ $userFlags[$data[0]] = 0; } $userFlags[$data[0]] = ($userFlags[$data[0]] | $userManager->usergroups[$data[1]]); } foreach($userFlags as $uname => $flag){ $userManager->setGroups($uname, $flag); } header('Location: .'); ?> Om du ikke ble automatisk omdirigert tilbake klikk her