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


PHP hasPerm函数代码示例

本文整理汇总了PHP中hasPerm函数的典型用法代码示例。如果您正苦于以下问题:PHP hasPerm函数的具体用法?PHP hasPerm怎么用?PHP hasPerm使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了hasPerm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onValidateId

 protected function onValidateId()
 {
     $id = param("id");
     if (!hasPerm(AUTH_MGR) || is_null(param("id"))) {
         setParam("id", $_SESSION["empId"]);
     }
 }
开发者ID:skyshore2001,项目名称:JDCloud,代码行数:7,代码来源:api_objects.php

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure	$next
  * @param  string	$role
  * @param  string	$type
  * @return mixed
  */
 public function handle($request, Closure $next, $role, $type = null)
 {
     $slug = $type != 'restrict' ? isset($request->slug) ? $request->slug : $request->id : null;
     $permission = hasPerm($role, $slug);
     if ($permission === true) {
         return $next($request);
     }
     return $permission;
 }
开发者ID:bde42,项目名称:website_v2_laravel,代码行数:18,代码来源:ClubAuthorization.php

示例3: intShowUserSearchSetVars

function intShowUserSearchSetVars(&$smarty)
{
    $smarty->assign_by_ref("group_names", getGroupNames($smarty));
    $smarty->assign_by_ref("admin_names", getAdminNames($smarty));
    intSetChargeNames($smarty, null);
    $smarty->assign("can_change", hasPerm("CHANGE USER ATTRIBUTES") or amIGod());
    $smarty->assign("order_by_options", array("user_id" => "User ID", "normal_username" => "Normal Username", "creation_date" => "Creation Date", "owner_id" => "Owner ID", "group_id" => "Group ID", "credit" => "Credit"));
    if (!$smarty->is_assigned("show_results")) {
        $smarty->assign("show_results", FALSE);
    }
}
开发者ID:zeroleo12345,项目名称:freeIBS,代码行数:11,代码来源:search_user_funcs.php

示例4: getRoles

 /** Retrieves roles and contacts associated with this object */
 function getRoles()
 {
     $roles = $this->db->getAll("SELECT id, contact_id, role_id FROM sotf_object_roles WHERE object_id='{$this->id}' ORDER BY role_id, contact_id");
     for ($i = 0; $i < count($roles); $i++) {
         $roles[$i]['role_name'] = $this->repository->getRoleName($roles[$i]['role_id']);
         $cobj = new sotf_Contact($roles[$i]['contact_id']);
         $roles[$i]['contact_data'] = $cobj->getAllWithIcon();
         if (hasPerm($roles[$i]['contact_id'], 'change')) {
             $roles[$i]['change_contact'] = 1;
         }
     }
     return $roles;
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:14,代码来源:sotf_ComplexNodeObject.class.php

示例5: intAssignSelectedPermVals

function intAssignSelectedPermVals(&$smarty)
{
    if (isInRequest("selected")) {
        $has_perm = hasPerm($_REQUEST["selected"], $_REQUEST["admin_username"]);
        $smarty->assign("selected", $_REQUEST["selected"]);
        $smarty->assign("has_selected_perm", $has_perm);
        $smarty->assign("selected_value", requestVal("value"));
        if ($has_perm) {
            $perm_val_req = new AdminPermValue($_REQUEST["selected"], $_REQUEST["admin_username"]);
            list($success, $cur_val) = $perm_val_req->send();
            if ($success) {
                $smarty->assign("cur_val", $cur_val);
            } else {
                $smarty->assign("cur_val", "ERR");
                smartySetPageErr($smarty, $cur_val->getErrorMsgs());
            }
        }
    } else {
        $smarty->assign("selected", "");
    }
}
开发者ID:zeroleo12345,项目名称:freeIBS,代码行数:21,代码来源:show_perms.php

示例6: header

<?php

$killOverride = true;
require_once "authlib.php";
$userID = $_POST['userID'];
$username = $_POST['username'];
if (!empty($userID) && !hasPerm("users.edit")) {
    $conn = $altConn = null;
    header('Location: user.php');
    die;
}
//Check if the username already exists
$cmd = $conn->prepare("select userID from {$userTable} where username = :username");
$cmd->bindParam(":username", $username, PDO::PARAM_STR, 25);
$cmd->execute();
$results = $cmd->fetchAll();
if (count($results) === 0) {
    //Add the value to our table
    $sql = empty($userID) ? "insert into {$userTable} (username, addr) \n\t\tvalues (:username, :addr)" : "update {$userTable} \n\t\tset username = :username where userID = :userID";
    $cmd = $conn->prepare($sql);
    $cmd->bindParam(":username", $username, PDO::PARAM_STR, 25);
    if (empty($userID)) {
        $cmd->bindParam(":addr", $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR, 16);
    } else {
        $cmd->bindParam(":userID", $userID, PDO::PARAM_INT);
    }
    $cmd->execute();
    //Get userID for the Log
    if (empty($userID)) {
        $cmd = $conn->prepare("select userID from {$userTable} where username = :username");
        $cmd->bindParam(":username", $username, PDO::PARAM_STR, 25);
开发者ID:Jujunol,项目名称:SeaAuth,代码行数:31,代码来源:save-user.php

示例7: canListen

 function canListen()
 {
     //global $config;
     //if(!$config['payableMode'])
     //	return 1;
     if ($this->getBool('free_content')) {
         return 1;
     }
     return hasPerm($this, 'listen');
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:10,代码来源:sotf_Programme.class.php

示例8: getRoles

 /** Retrieves roles and contacts associated with this object */
 function getRoles($language = '')
 {
     global $db, $vocabularies, $lang, $repository;
     if (empty($language)) {
         $language = $lang;
     }
     $roles = $db->getAll("SELECT id, contact_id, role_id FROM sotf_object_roles WHERE object_id='{$this->id}' ORDER BY role_id, contact_id");
     for ($i = 0; $i < count($roles); $i++) {
         $cobj =& $repository->getObject($roles[$i]['contact_id']);
         if ($cobj) {
             $roles[$i]['role_name'] = $vocabularies->getRoleName($roles[$i]['role_id'], $language);
             $roles[$i]['creator'] = $vocabularies->isCreator($roles[$i]['role_id']);
             $roles[$i]['contact_data'] = $cobj->getAllWithIcon();
             if (hasPerm($roles[$i]['contact_id'], 'change')) {
                 $roles[$i]['change_contact'] = 1;
             }
         } else {
             logError("Referred contact does not exist: " . $roles[$i]['contact_id']);
             unset($roles[$i]);
         }
     }
     return $roles;
 }
开发者ID:BackupTheBerlios,项目名称:sotf,代码行数:24,代码来源:sotf_ComplexNodeObject.class.php

示例9: raiseError

<?php

require "init.inc.php";
$seriesid = sotf_Utils::getParameter('seriesid');
$page->errorURL = "editSeries.php?seriesid={$seriesid}";
$page->setTitle('edit_series');
$page->popup = true;
$page->forceLogin();
if (!$seriesid) {
    raiseError("Id is missing");
}
if (!hasPerm($seriesid, "change")) {
    raiseError("You have no permission to change series settings!");
}
$series =& new sotf_Series($seriesid);
// save general data
$save = sotf_Utils::getParameter('save');
$finish = sotf_Utils::getParameter('finish');
if ($save || $finish) {
    $series->setWithParam('title');
    $series->setWithParam('description');
    $series->update();
    if ($finish) {
        $page->redirect("closeAndRefresh.php?anchor=series");
    } else {
        $page->redirect("editSeries.php?seriesid={$seriesid}");
    }
    exit;
}
// manage roles
$delrole = sotf_Utils::getParameter('delrole');
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:31,代码来源:editSeries.php

示例10:

<body>
	<?php 
if (isset($_SESSION['isLogged']) && (dirname($_SERVER['REQUEST_URI']) == "/cauth" || $_SERVER['REQUEST_URI'] == "/cauth/")) {
    ?>
	<header>
		<nav class="navbar navbar-default">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mainNav">
					<span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>
				</button>
				<a href="index.php" class="navbar-brand">SeaAuth - Server Protection</a>
			</div>

			<div class="collapse navbar-collapse" id="mainNav">
	    		<ul class="nav navbar-nav">
	    			<li><a href="index.php">Home</a></li>
	    			<?php 
    if (hasPerm("codes.list", $user)) {
        echo '<li><a href="codelist.php">Codes</a></li>';
    }
    if (hasPerm("users.list", $user)) {
        echo '<li><a href="userlist.php">Users</a></li>';
    }
    ?>
	    			<li><a href="logout.php">Logout</a></li>
	    		</ul>
	    	</div>
		</nav>
	</header>
	<?php 
}
开发者ID:Jujunol,项目名称:SeaAuth,代码行数:31,代码来源:header.php

示例11: raiseError

 * Created for the StreamOnTheFly project (IST-2001-32226)
 * Authors: András Micsik, Máté Pataki, Tamás Déri 
 *          at MTA SZTAKI DSD, http://dsd.sztaki.hu
 */
require "init.inc.php";
//$smarty->assign("OKURL", $_SERVER['PHP_SELF'] . "?id=" . rawurlencode($id));
$id = sotf_Utils::getParameter('id');
if ($id) {
    $db->begin();
    $smarty->assign('ID', $id);
    $prg =& $repository->getObject($id);
    if (!$prg) {
        raiseError("no_such_object", $id);
    }
    if (!$prg->getBool('published')) {
        if (!hasPerm($prg->id, 'change')) {
            raiseError("not_published_yet", $id);
            exit;
        }
        $smarty->assign("UNPUBLISHED", 1);
    }
    $page->setTitle($prg->get('title'));
    // general data
    $prgData = $prg->getAll();
    $prgData['icon'] = sotf_Blob::cacheIcon($id);
    $smarty->assign('PRG_DATA', $prgData);
    // station data
    $station = $prg->getStation();
    $smarty->assign('STATION_DATA', $station->getAllWithIcon());
    // series data
    $series = $prg->getSeries();
开发者ID:BackupTheBerlios,项目名称:sotf,代码行数:31,代码来源:get.php

示例12: amIGod

function amIGod()
{
    return hasPerm("GOD");
}
开发者ID:zeroleo12345,项目名称:freeIBS,代码行数:4,代码来源:perm.php

示例13: logEvent

<?php

//Setup Connection and check authorization
require_once "authlib.php";
if (hasPerm("codes.clear")) {
    //Check if a UserID is specified
    $code = base64_decode($_GET['ccode']);
    //Grab the user and set address to null
    logEvent($conn, $logTable, "Cleared SeaCode {$code}");
    $cmd = $conn->prepare("update {$codeTable} set userID = null where codename = :code");
    $cmd->bindParam(":code", $code, PDO::PARAM_INT);
    $cmd->execute();
}
//Disconnect
$conn = $altConn = null;
header('Location: codelist.php');
开发者ID:Jujunol,项目名称:SeaAuth,代码行数:16,代码来源:clear-code.php

示例14: sotf_Programme

    $smarty->assign("PAGETITLE", $page->getlocalized("editmeta"));
}
$page->forceLogin();
$okURL = sotf_Utils::getParameter('okURL');
// delete topic
$delTopic = sotf_Utils::getParameter('deltopic');
if ($delTopic) {
    $repository->delFromTopic($delTopic);
    $page->redirect("editMeta.php?id={$prgId}#topics");
    exit;
}
$prg =& new sotf_Programme($prgId);
if (!$prg->isLocal()) {
    raiseError("You can only edit programmes locally!");
}
if (!hasPerm($prgId, 'change')) {
    raiseError("no permission to change files in this programme");
    exit;
}
$finishpublish = sotf_Utils::getParameter('finishpublish');
$finish = sotf_Utils::getParameter('finish');
$save = sotf_Utils::getParameter('save');
if ($save || $finish || $finishpublish) {
    $params = array('title' => 'text', 'alternative_title' => 'text', 'episode_title' => 'text', 'episode_sequence' => 'number', 'keywords' => 'text', 'abstract' => 'text', 'language' => 'text', 'genre_id' => 'number', 'spatial_coverage' => 'text', 'temporal_coverage' => 'date', 'production_date' => 'date', 'broadcast_date' => 'date', 'expiry_date' => 'date');
    foreach ($params as $param => $type) {
        $value = sotf_Utils::getParameter($param);
        if ($type == 'text') {
            $value = strip_tags($value);
        } elseif ($type == 'number') {
            if (empty($value)) {
                $value = '';
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:31,代码来源:editMeta.php

示例15: raiseError

<?php

// -*- tab-width: 3; indent-tabs-mode: 1; -*-
// $Id$
require "init.inc.php";
$page->popup = true;
$page->forceLogin();
$stationId = sotf_Utils::getParameter('stationid');
$seriesTitle = sotf_Utils::getParameter('title');
if (!hasPerm($stationId, "create")) {
    raiseError("You have no permission to create new series!");
}
if ($seriesTitle) {
    // create a new series
    $series = new sotf_Series();
    $series->set('title', $seriesTitle);
    $series->set('station_id', $stationId);
    $series->set('entry_date', date('Y-m-d'));
    $status = $series->create();
    if (!$status) {
        $page->addStatusMsg('series_create_failed');
    } else {
        $permissions->addPermission($series->id, $user->id, 'admin');
        $page->redirect("editSeries.php?seriesid=" . $series->id);
        exit;
    }
}
// general data
$smarty->assign("TITLE", $seriesTitle);
$page->sendPopup();
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:30,代码来源:createSeries.php


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