本文整理匯總了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());
}
}