function revokeAllPermissionsByNetIDInArea($netID) { global $area, $db; $perms = pullUserGrantedPermissionIdsCurrentArea($netID); foreach ($perms as $perm) { try { $deleteQuery = $db->prepare("DELETE FROM employeePermissions WHERE netID = :netID AND permission = :permission"); $deleteQuery->execute(array(':netID' => $netID, ':permission' => $perm)); } catch (PDOException $e) { exit("error in query"); } } }
$areaQuery = $db->prepare("SELECT * FROM `permissionArea` JOIN `permission` ON `permissionArea`.`permissionId` = `permission`.`permissionId` WHERE `index` = :id"); $areaQuery->execute(array(':id' => $cur['permID'])); } catch (PDOException $e) { exit("error in query"); } $row = $areaQuery->fetch(PDO::FETCH_ASSOC); $info .= "<label class 'title' > " . $row['longName'] . "</label> (<a href='javascript:void' onclick=\"showHide('" . $row['index'] . "_" . $groupID . "')\">Info</a>)<br/>"; $info .= "<div class='description' id='" . $row['index'] . "_" . $groupID . "' style='display:none;'>" . $row['description'] . "</div><br/>"; } return $info; } printGroups($area, $user); echo "<label class 'title' >All Area Permissions</label> (<a href='javascript:void' onclick=\"showHide('allAreaPermissions')\">See Permissions</a>)<br/>"; echo "<div class='description' id='allAreaPermissions' style='display:none;'>"; $permissions = pullAllPermissionInfoCurrentArea(); $grantedPermissions = pullUserGrantedPermissionIdsCurrentArea($user); $filler = ""; foreach ($permissions as $row) { $filler .= "<input type='checkbox' id='" . $row['index'] . "' name='" . $row['index'] . "' value='" . $row['index'] . "' onclick='if(this.checked){grantPermission(this.value);}else{revokePermission(this.value);}' "; if (in_array($row['index'], $grantedPermissions)) { $filler .= "checked "; } if (checkPermission($row['shortName']) || checkPermission('development')) { if ($row['shortName'] == "permissions" && $user == $netID) { $filler .= "disabled"; } } else { $filler .= "disabled "; } $filler .= "/>"; $filler .= "<label class 'title' for='" . $row['index'] . "'> " . $row['longName'] . "</label> (<a href='javascript:void' onclick=\"showHide('" . $row['index'] . "description')\">Info</a>)<br/>";