本文整理汇总了PHP中ForgeConfig::areAnonymousAllowed方法的典型用法代码示例。如果您正苦于以下问题:PHP ForgeConfig::areAnonymousAllowed方法的具体用法?PHP ForgeConfig::areAnonymousAllowed怎么用?PHP ForgeConfig::areAnonymousAllowed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ForgeConfig
的用法示例。
在下文中一共展示了ForgeConfig::areAnonymousAllowed方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Project $project)
{
if (!$project->isPublic()) {
$this->mapping = array(ProjectUGroup::ANONYMOUS => ProjectUGroup::PROJECT_MEMBERS, ProjectUGroup::AUTHENTICATED => ProjectUGroup::PROJECT_MEMBERS, ProjectUGroup::REGISTERED => ProjectUGroup::PROJECT_MEMBERS);
} elseif (!ForgeConfig::areAnonymousAllowed()) {
$this->mapping[ProjectUGroup::ANONYMOUS] = ProjectUGroup::REGISTERED;
if (ForgeConfig::areRestrictedUsersAllowed() && $project->allowsRestricted()) {
$this->mapping[ProjectUGroup::ANONYMOUS] = ProjectUGroup::AUTHENTICATED;
$this->mapping[ProjectUGroup::AUTHENTICATED] = ProjectUGroup::AUTHENTICATED;
}
}
}
示例2: getAllForProject
/**
* @param Project $project
* @return User_ForgeUGroup[]
*/
public function getAllForProject(Project $project)
{
$user_groups = array();
if (ForgeConfig::areAnonymousAllowed() && $project->isPublic()) {
$user_groups[] = $this->getDynamicForgeUserGroupByName(User_ForgeUGroup::ANON);
}
if (ForgeConfig::areRestrictedUsersAllowed() && $project->allowsRestricted()) {
$user_groups[] = $this->getDynamicForgeUserGroupByName(User_ForgeUGroup::AUTHENTICATED);
}
if ($project->isPublic()) {
$user_groups[] = $this->getDynamicForgeUserGroupByName(User_ForgeUGroup::REGISTERED);
}
$user_groups[] = $this->getDynamicForgeUserGroupByName(User_ForgeUGroup::PROJECT_MEMBERS);
$user_groups[] = $this->getDynamicForgeUserGroupByName(User_ForgeUGroup::PROJECT_ADMINS);
return array_merge($user_groups, $this->getStaticByProject($project), array($this->getDynamicForgeUserGroupByName(User_ForgeUGroup::NOBODY)));
}
示例3: authenticate
/**
* Authentication method
*
* Returns the authenticated user
*
* @return PFUser
*/
function authenticate()
{
// test if username field is empty
if (!$this->issetUsername()) {
$this->setHeader();
} else {
$username = $this->getUsername();
$password = $this->getPassword();
$user = $this->getUser($username, $password);
// Ask again for authentication if the user entered a wrong username or password
// if fields are left blank the user is considered as anonymous unless Tuleap don't accept anonymous access
if ($user->isAnonymous() && ($username || $password || !ForgeConfig::areAnonymousAllowed())) {
$this->setHeader();
} else {
return $user;
}
}
}
示例4: needAuthentication
private function needAuthentication(GitRepository $repository, Git_URL $url)
{
return !ForgeConfig::areAnonymousAllowed() || $this->isGitPush($url) || !$this->canBeReadByAnonymous($repository) || $this->isInPrivateProject($repository);
}
示例5: verifyRequest
/**
* Check if anonymous is granted to access else redirect to login page
*
* @param Array $server
*
* @return void
*/
public function verifyRequest($server)
{
$user = $this->getCurrentUser();
if (!ForgeConfig::areAnonymousAllowed() && $user->isAnonymous() && !$this->isScriptAllowedForAnonymous($server) && !$this->getPermissionsOverriderManager()->doesOverriderAllowUserToAccessPlatform($user)) {
$redirect = new URLRedirect();
$this->urlChunks['script'] = $redirect->buildReturnToLogin($server);
}
}
示例6: getProjectPrivacy
protected function getProjectPrivacy(Project $project)
{
if ($project->isPublic()) {
$privacy = 'public';
if (ForgeConfig::areAnonymousAllowed()) {
$privacy .= '_w_anon';
} else {
$privacy .= '_wo_anon';
}
} else {
$privacy = 'private';
}
return $privacy;
}
示例7: doesPlatformRequireLogin
public function doesPlatformRequireLogin()
{
$anonymous_user = new PFUser(array('user_id' => 0));
if (ForgeConfig::areAnonymousAllowed() && !$this->getPermissionsOverriderManager()->doesOverriderForceUsageOfAnonymous()) {
return false;
} elseif ($this->getPermissionsOverriderManager()->doesOverriderAllowUserToAccessPlatform($anonymous_user)) {
return false;
}
return true;
}
示例8: itReturnsTrueIfRegexpMatchsOnlyTheEndOfTheIP
public function itReturnsTrueIfRegexpMatchsOnlyTheEndOfTheIP()
{
ForgeConfig::set(ForgeAccess::CONFIG, ForgeAccess::ANONYMOUS);
ForgeConfig::set(ForgeAccess::REVERSE_PROXY_REGEXP, '172.*');
$_SERVER['REMOTE_ADDR'] = '2.2.172.1';
$this->assertTrue(ForgeConfig::areAnonymousAllowed());
}
示例9: itReturnsFalseIfAccessModeIsRestricted
public function itReturnsFalseIfAccessModeIsRestricted()
{
ForgeConfig::set(ForgeAccess::CONFIG, ForgeAccess::RESTRICTED);
$this->assertFalse(ForgeConfig::areAnonymousAllowed());
}
示例10: verifyRequest
/**
* Check if anonymous is granted to access else redirect to login page
*
* @param Array $server
*
* @return void
*/
public function verifyRequest($server)
{
$user = $this->getCurrentUser();
if (!ForgeConfig::areAnonymousAllowed() && $user->isAnonymous() && !$this->isScriptAllowedForAnonymous($server)) {
$redirect = new URLRedirect();
$this->urlChunks['script'] = $redirect->buildReturnToLogin($server);
}
}
示例11: menu_print_sidebar
function menu_print_sidebar($params)
{
if (!user_isloggedin()) {
echo menu_notloggedin();
if (!ForgeConfig::areAnonymousAllowed()) {
return;
}
} else {
echo menu_loggedin($params['title']);
}
// LJ Site Admin menu added here
if (user_is_super_user()) {
echo menu_site_admin();
}
echo menu_software();
echo menu_site();
//search menu
echo menu_search();
?>
<div align="center">
<?php
echo $GLOBALS['HTML']->getOsdnNavDropdown();
?>
</div>
<?php
}