当前位置: 首页>>代码示例>>PHP>>正文


PHP SecurityGroup::getById方法代码示例

本文整理汇总了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;
    }
开发者ID:elecnix,项目名称:resaccman,代码行数:28,代码来源:GroupPermissionsForm.php

示例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();
开发者ID:elecnix,项目名称:resaccman,代码行数:31,代码来源:groupPermissions.php

示例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");
    }
?>
开发者ID:elecnix,项目名称:smellyfish,代码行数:13,代码来源:groupDelete.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");
?>
开发者ID:elecnix,项目名称:smellyfish,代码行数:31,代码来源:groupPermissionsSave.php


注:本文中的SecurityGroup::getById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。