本文整理汇总了PHP中ACL::get_group_token_access方法的典型用法代码示例。如果您正苦于以下问题:PHP ACL::get_group_token_access方法的具体用法?PHP ACL::get_group_token_access怎么用?PHP ACL::get_group_token_access使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACL
的用法示例。
在下文中一共展示了ACL::get_group_token_access方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_group
/**
* Handles GET requests for a group's page.
*/
public function get_group()
{
$group = UserGroup::get_by_id($this->handler_vars['id']);
if (null == $group) {
Utils::redirect(URL::get('admin', 'page=groups'));
} else {
$tokens = ACL::all_tokens('id');
$access_names = ACL::$access_names;
$access_names[] = 'deny';
// attach access bitmasks to the tokens
foreach ($tokens as $token) {
$token->access = ACL::get_group_token_access($group->id, $token->id);
}
// separate tokens into groups
$grouped_tokens = array();
foreach ($tokens as $token) {
$grouped_tokens[$token->token_group][$token->token_type ? 'crud' : 'bool'][] = $token;
}
$group = UserGroup::get_by_id($this->handler_vars['id']);
$potentials = array();
$users = Users::get_all();
$users[] = User::anonymous();
$members = $group->members;
$jsusers = array();
foreach ($users as $user) {
$jsuser = new StdClass();
$jsuser->id = $user->id;
$jsuser->username = $user->username;
$jsuser->member = in_array($user->id, $members);
$jsusers[$user->id] = $jsuser;
}
$this->theme->potentials = $potentials;
$this->theme->users = $users;
$this->theme->members = $members;
$js = '$(function(){groupManage.init(' . json_encode($jsusers) . ');});';
Stack::add('admin_header_javascript', $js, 'groupmanage', 'admin');
$this->theme->access_names = $access_names;
$this->theme->grouped_tokens = $grouped_tokens;
$this->theme->groups = UserGroups::get_all();
$this->theme->group = $group;
$this->theme->id = $group->id;
$this->theme->wsse = Utils::WSSE();
$this->display('group');
}
}
示例2: get_group
/**
* Handles GET requests for a group's page.
*/
public function get_group()
{
$group = UserGroup::get_by_id(Controller::get_var('id'));
if (null == $group) {
Utils::redirect(URL::get('display_groups', 'page=groups'));
} else {
$tokens = ACL::all_tokens('id');
$tokens = Plugins::filter('token_list_display', $tokens);
array_walk($tokens, function (&$value, $key) {
$value->description = Plugins::filter('token_description_display', $value->name);
$value->token_group = Plugins::filter('token_group_display', $value->token_group);
});
$access_names = ACL::access_names();
$access_names[] = 'deny';
$access_display = array();
foreach ($access_names as $name) {
$access_display[$name] = Plugins::filter('permission_display', $name);
}
$bool_access_display['allow'] = Plugins::filter('permission_display', 'allow');
$bool_access_display['deny'] = Plugins::filter('permission_display', 'deny');
// attach access bitmasks to the tokens
foreach ($tokens as $token) {
$token->access = ACL::get_group_token_access($group->id, $token->id);
}
// separate tokens into groups
$grouped_tokens = array();
foreach ($tokens as $token) {
$grouped_tokens[$token->token_group][$token->token_type ? 'crud' : 'bool'][] = $token;
}
$potentials = array();
$users = Users::get_all();
$users[] = User::anonymous();
$members = $group->members;
$jsusers = array();
foreach ($users as $user) {
$jsuser = new \StdClass();
$jsuser->id = $user->id;
$jsuser->username = $user->username;
$jsuser->member = in_array($user->id, $members);
$jsusers[$user->id] = $jsuser;
}
$this->theme->potentials = $potentials;
$this->theme->users = $users;
$this->theme->members = $members;
$js = '$(function(){groupManage.init(' . json_encode($jsusers) . ');});';
Stack::add('admin_header_javascript', $js, 'groupmanage', 'admin-js');
$this->theme->access_names = $access_names;
$this->theme->grouped_tokens = $grouped_tokens;
$this->theme->access_display = $access_display;
$this->theme->bool_access_display = $bool_access_display;
$this->theme->groups = UserGroups::get_all();
$this->theme->group = $group;
$this->theme->id = $group->id;
$this->theme->wsse = Utils::WSSE();
$this->display('group');
}
}