本文整理汇总了PHP中HTTPRequest::getCurrentUser方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTPRequest::getCurrentUser方法的具体用法?PHP HTTPRequest::getCurrentUser怎么用?PHP HTTPRequest::getCurrentUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTPRequest
的用法示例。
在下文中一共展示了HTTPRequest::getCurrentUser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: userIsAdmin
/**
* @param HTTPRequest $request
* @return bool
*/
public function userIsAdmin(HTTPRequest $request)
{
$user = $request->getCurrentUser();
$forge_user_manager = new User_ForgeUserGroupPermissionsManager(new User_ForgeUserGroupPermissionsDao());
$has_special_permission = $forge_user_manager->doesUserHavePermission($user, new User_ForgeUserGroupPermission_MediawikiAdminAllProjects());
return $has_special_permission || $user->isMember($request->getProject()->getID(), 'A');
}
示例2: displayHeader
public function displayHeader(HTTPRequest $request, $title)
{
$toolbar = array();
if ($this->userIsAdmin($request->getCurrentUser())) {
$toolbar[] = array('title' => $GLOBALS['Language']->getText('global', 'Administration'), 'url' => MEDIAWIKI_BASE_URL . '/forge_admin?' . http_build_query(array('group_id' => $request->get('group_id'))));
}
$title = $title . ' - ' . $GLOBALS['Language']->getText('plugin_mediawiki', 'service_lbl_key');
$breadcrumbs = array();
parent::displayHeader($title, $breadcrumbs, $toolbar);
}
示例3: checkAccess
private function checkAccess(HTTPRequest $request)
{
if (!$request->getCurrentUser()->isSuperUser()) {
$GLOBALS['Response']->redirect('/');
}
}
示例4: assertSiteAdmin
private function assertSiteAdmin(HTTPRequest $request)
{
if (!$request->getCurrentUser()->isSuperUser()) {
$GLOBALS['Response']->redirect('/');
}
}
示例5: assertUserIsProjectAdmin
private function assertUserIsProjectAdmin(ServiceMediawiki $service, HTTPRequest $request)
{
if (!$service->userIsAdmin($request->getCurrentUser())) {
$GLOBALS['Response']->redirect(MEDIAWIKI_BASE_URL . '/wiki/' . $request->getProject()->getUnixName());
}
}