本文整理汇总了PHP中Acl::setAcl方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::setAcl方法的具体用法?PHP Acl::setAcl怎么用?PHP Acl::setAcl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acl
的用法示例。
在下文中一共展示了Acl::setAcl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authorize
static function authorize($domain, $userid)
{
$context = Model_Context::getInstance();
if (!isset($_SESSION['identity'])) {
$_SESSION['identity'] = array();
}
if (!isset($_SESSION['identity'][$domain])) {
$_SESSION['identity'][$domain] = array();
}
$_SESSION['identity'][$domain] = $userid;
if ($domain != 'textcube') {
return;
}
/* Support code for legacy */
$_SESSION['userid'] = $userid;
if ($userid == 1) {
$ownership = "group.creators";
} else {
$ownership = "group.owners";
}
$data = DBModel::getInstance();
$data->reset('Privileges');
$data->setQualifier('userid', 'equals', intval($userid));
$result = $data->getAll('blogid,acl');
foreach ($result as $rec) {
$priv = array("group.writers", "textcube.{$userid}");
if ($rec['acl'] & BITWISE_OWNER) {
array_push($priv, $ownership);
}
if ($rec['acl'] & BITWISE_EDITOR) {
array_push($priv, "group.editors");
}
if ($rec['acl'] & BITWISE_ADMINISTRATOR) {
array_push($priv, "group.administrators");
}
Acl::setAcl($rec['blogid'], $priv, false);
}
$blogid = getBlogId();
$data->reset('Privileges');
$data->setQualifier('blogid', 'equals', $blogid);
$data->setQualifier('userid', 'equals', intval($userid));
$data->setAttribute('lastLogin', Timestamp::getUNIXtime());
$data->update();
return;
}
示例2: array
<?php
/// Copyright (c) 2004-2016, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('GET' => array('identify' => array('string', 'min' => 1), 'owner' => array('email')));
require ROOT . '/library/preprocessor.php';
requireStrictRoute();
requirePrivilege('group.creators');
if ($uid = User::getUserIdByEmail($_GET['owner'])) {
$result = addBlog('', $uid, $_GET['identify']);
if ($result === true) {
if ($_GET['owner'] == User::getEmail(getUserId())) {
/// Update current user's access list.
$priv = array();
array_push($priv, "group.administrators");
Acl::setAcl($rec['blogid'], $priv, true);
}
Respond::PrintResult(array('error' => 0));
} else {
Respond::PrintResult(array('error' => -1, 'result' => $result));
}
} else {
Respond::PrintResult(array('error' => -2, 'result' => _t('등록되지 않은 소유자 E-mail 입니다.')));
}