本文整理汇总了PHP中fAuthorization::requireAuthLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP fAuthorization::requireAuthLevel方法的具体用法?PHP fAuthorization::requireAuthLevel怎么用?PHP fAuthorization::requireAuthLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fAuthorization
的用法示例。
在下文中一共展示了fAuthorization::requireAuthLevel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
include './resources/init.php';
fAuthorization::requireAuthLevel('super');
$tmpl->place('header');
?>
<script type="text/javascript" src="./resources/library/jquery.autocomplete/jquery.autocomplete.min.js"></script>
<script type="text/javascript" src="./resources/library/jquery.autocomplete/lib/jquery.bgiframe.min.js"></script>
<script type="text/javascript" src="./resources/library/jquery.blockUI.js"></script>
<link media="screen, projection" href="./resources/library/jquery.autocomplete/jquery.autocomplete.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="./js/admin-stock.js"></script>
<?php
$tmpl->place('menu');
?>
<div id="content" class="span-24 last">
<?php
$tmpl->place('menuAdmin');
?>
<div id="main" class="span-24 last">
<h2>Administration</h2><h3>Stock</h3>
<br />
<form action = "admin-stock.php" method = "get">
<label for="inv_item">Choose Inventory Item: </label>
<span id="inv_item">
<input id="autocompleteItem" name="item"></input>
</span>
<input id="submitBTN" type="submit" value="Submit" />
</form>
<?php
if (isset($_GET['item'])) {
try {
示例2: Supplier
<?php
include './resources/init.php';
fAuthorization::requireAuthLevel('admin');
$tmpl->place('header');
?>
<script type="text/javascript" src="./js/admin-supplier-view.js"></script>
</head>
<body>
<div class = "container">
<div id="View" class = "view-frame span-23 last">
<?php
if (!isset($_GET['id'])) {
echo "<div class=\"ui-state-error ui-corner-all\">\n\t\t\t\t\t\t<span class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: 30px;\"></span>\n\t\t\t\t\t\tYou arrived to this page in error</div>";
} else {
try {
$supplier = new Supplier($_GET['id']);
?>
<h2><span id="titleName"><?php
echo $supplier->prepareName();
?>
</span></h2>
<input id="key" type="hidden" value="<?php
echo $supplier->prepareId();
?>
" />
<table>
<tr>
<td width="100"><b>Name</b></td>
<td><span id="supName" class="varInput"><?php
echo $supplier->prepareName();
示例3: testRequireAuthLevel
public function testRequireAuthLevel()
{
fAuthorization::setLoginPage('/login/');
fAuthorization::setAuthLevels(array('user' => 20, 'admin' => 50));
fAuthorization::setUserAuthLevel('admin');
$this->assertEquals(NULL, fAuthorization::requireAuthLevel('admin'));
// This is a gross cli wrapper script since we have to test for exit
$code = "fAuthorization::setLoginPage('/login/');";
$code .= "fAuthorization::setAuthLevels(array('user' => 20, 'admin' => 50));";
$code .= "fAuthorization::setUserAuthLevel('user');";
$code .= "fAuthorization::requireAuthLevel('admin');";
$this->assertEquals('http://example.com/login/', shell_exec('php ' . TEST_EXIT_SCRIPT . ' ' . escapeshellarg($code)));
}