本文整理汇总了PHP中SecurityGroup::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP SecurityGroup::getById方法的具体用法?PHP SecurityGroup::getById怎么用?PHP SecurityGroup::getById使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SecurityGroup
的用法示例。
在下文中一共展示了SecurityGroup::getById方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
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;
}
示例2: date
<?php
require_once "config.php";
require_once RESACCMAN_BASE . "/classes/Text.php";
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();
示例3: require_once
<? require_once("classes/SecurityGroup.php"); ?>
<? require_once("classes/Text.php"); ?>
<?
$g = SecurityGroup::getById($_REQUEST['id']);
if ($g == NULL) {
$errMsg = Text::getText("GroupNotFound");
$title = Text::getText("Delete");
include("error.php");
} else {
$g->delete();
header("Location: groups.php");
}
?>
示例4: require_once
<? require_once("classes/SecurityGroup.php"); ?>
<? require_once("classes/SecurityResource.php"); ?>
<? require_once("classes/SecurityPermission.php"); ?>
<?
$group = $_REQUEST['group'];
$g = SecurityGroup::getById($group);
if ($g == NULL) {
$errMsg = Text::getText("GroupNotFound");
$title = Text::getText("GroupPermissions");
include("error.php");
exit;
}
$allPermissions = SecurityPermission::getAll();
$allResources = SecurityResource::getAll();
foreach ($allResources as $res) {
foreach ($allPermissions as $perm) {
$fieldName = "res".$res->getId()."_perm".$perm->getId();
$value = $_REQUEST[$fieldName];
//print $fieldName."=".$value."<br>";
if ($value == "on") {
if (!$g->hasPermission($res, $perm)) {
$g->addPermission($res, $perm);
}
} else {
$g->removePermission($res, $perm);
}
}
}
header("Location: groups.php");
?>