Language: PHP
Label: vulnerable
CWE: CWE-281 \u2014 Improper Preservation of Permissions
The product does not preserve permissions or incorrectly preserves permissions when copying, restoring, or sharing objects, which can cause them to have less restrictive permissions than intended.

Code:
    private function updateProjectVisibility(PFUser $user, Project $project, HTTPRequest $request)
    {
        if ($this->project_visibility_configuration->canUserConfigureProjectVisibility($user, $project)) {
            if ($project->getAccess() !== $request->get('project_visibility')) {
                if ($request->get('term_of_service')) {
                    $this->project_manager->setAccess($project, $request->get('project_visibility'));
                    $this->project_manager->clear($project->getID());
                    $this->ugroup_binding->reloadUgroupBindingInProject($project);
                } else {
                    $GLOBALS['Response']->addFeedback(Feedback::ERROR, _("Please accept term of service"));
                }
            }
        }
    }