function handle($request) { $groupIdParamName = 'group'; $groupId = Form::getField($request, $groupIdParamName); if (strlen($groupId) == 0) { die(IsatisText::getText("MissingParameter").": ".$groupIdParamName); } $g = SecurityGroup::getById($groupId); if ($g == NULL) { die(Text::getText("GroupNotFound").": '".$groupId."'"); } $allPermissions = SecurityPermission::getAll(); $allResources = SecurityResource::getAll(); foreach ($allResources as $res) { foreach ($allPermissions as $perm) { $fieldName = "res".$res->getId()."_perm".$perm->getId(); $value = Form::getField($request, $fieldName); if ($value == "on") { if (!$g->hasPermission($res, $perm)) { $g->addPermission($res, $perm); } } else { $g->removePermission($res, $perm); } } } return $g; }
function printContent() { ?> <table border="1" cellspacing="1" cellpadding="1" bgcolor="red"> <tr> <td bgcolor="yellow"> <h1><?=IsatisText::getText("ErrorOccurred")?></h1><br> <font class="error"><?=$this->getMessage()?></font> </td> </tr> </table> <? }
require_once RESACCMAN_BASE . "/classes/html/GroupPermissionsForm.php"; $title = Text::getText("GroupPermissions"); if (GroupPermissionsForm::isSubmitted($_REQUEST)) { $g = GroupPermissionsForm::handle($_REQUEST); $today = date("r"); header("Location: groupPermissions.php?id=" . $g->getId() . "&saved=" . $today); } else { if (sizeof($_REQUEST['id']) > 0) { $g = SecurityGroup::getById($id); } } if ($g == NULL) { $errMsg = Text::getText("GroupNotFound") . ": '" . $id . "'"; die($errMsg); } $title .= ": " . $g->getName(); $form = new GroupPermissionsForm($g); if (strlen($_REQUEST['saved']) > 0) { $form->setMessage(IsatisText::getText("Saved") . ": " . $_REQUEST['saved']); } include "header.php"; ?> <h2><?php echo $title; ?> </h2><? $form->printContent(); include("footer.php"); ?>
function printContent() { $title = $this->getTitle(); $action = $this->action; $result = $this->result; $submitCaption = IsatisText::getText("Submit"); ?> <form <? if ($action != NULL) { ?> action="<?php echo $action; ?> "<? } ?> method="post"> <table border="0" cellspacing="10" cellpadding="0" align="left"> <? if ($title != NULL) { ?> <tr> <td colspan="2" align="left"> <h2><?php echo $title; ?> </h2> </td> </tr> <? } ?> <? if ($result != NULL) { ?> <tr> <td colspan="2" align="center"> <? if ($result->isSuccess()) { ?> <?php echo IsatisText::getText("LoginSuccessful"); ?> <? } else { ?> <font class="error"><?php echo $result->getMessage(); ?> </font> <? } ?> </td> </tr> <? } ?> <tr> <td><?php echo IsatisText::getText("Username"); ?> </td> <td><input type="text" name="username"></td> </tr> <tr> <td><?php echo IsatisText::getText("Password"); ?> </td> <td><input type="password" name="password"></td> </tr> <tr> <td colspan="2" align="center"> <input type="hidden" name="submitted" value="yes"> <input type="submit" value="<?php echo $submitCaption; ?> "> </td> </tr> </table> </form> <? }