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; } } }
/** * @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))); }
/** * 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; } } }
private function needAuthentication(GitRepository $repository, Git_URL $url) { return !ForgeConfig::areAnonymousAllowed() || $this->isGitPush($url) || !$this->canBeReadByAnonymous($repository) || $this->isInPrivateProject($repository); }
/** * 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); } }
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; }
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; }
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()); }
public function itReturnsFalseIfAccessModeIsRestricted() { ForgeConfig::set(ForgeAccess::CONFIG, ForgeAccess::RESTRICTED); $this->assertFalse(ForgeConfig::areAnonymousAllowed()); }
/** * 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); } }
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 }