Projects

Configure how projects behave in P4 Code Review by updating project-related settings in the config.php file.

Configuration changes take effect only after the configuration cache is reloaded. You must be an admin or super user to reload the cache.

To reload the configuration cache:

  1. Open the user menu (top-right corner of P4 Code Review).

  2. Select System Information.

  3. Open the Cache Info tab.

  4. Click Reload Configuration.

If changes to config.php cause the web interface to become unresponsive, remove the problematic changes and clear the configuration cache:

rm -f /opt/perforce/swarm/data/cache/module-config-cache.php

Restrict project name and branch editing

By default, project members can edit project settings after a project is created.

Restrict changes to the project name and branch definitions to administrators only. This is useful when these settings are used by external systems or build infrastructure.

Update the following settings in SWARM_ROOT/data/config.php.

'projects' => array(
  'edit_name_admin_only' => true,
  'edit_branches_admin_only' => true,
),
  • edit_name_admin_only: Only users with admin-level privileges can modify the project name.

  • edit_branches_admin_only: Only users with admin-level privileges can modify branch definitions.

Both settings default to false.

Restrict project creation

By default, any authenticated user can create projects.

Limit project creation to administrators

Restrict project creation to users with admin-level privileges.

Add or update:

'projects' => array(
  'add_admin_only' => true,
),

When enabled:

  • Only administrators can create projects

  • The Add Project button is hidden from other users

If add_groups_only is also configured, users must meet both conditions (administrator and group member).

Limit project creation to specific groups

Restrict project creation to members of specific groups defined in P4 Server.

Add or update:

'projects' => array(
  'add_groups_only' => array('group1', 'group2'),
),

When both add_admin_only and add_groups_only are enabled:

  • Users must be administrators and members of the specified groups.

Project README

Projects can display a README file on the project overview page.

The README is read from the root of the project’s mainline.

  • The first matching README file is used.

  • Supported file extensions include:

    • md

    • markdown

    • mdown

    • mkdn

    • mkd

    • mdwn

    • mdtxt

    • mdtext

By default, Markdown support is restricted to prevent execution of unsafe HTML or JavaScript.

To configure README behavior:

'projects' => array(
  'readme_mode' => 'enabled',
),
  • enabled: Display README content (default).

  • disabled: Do not display README content.

In earlier versions, additional modes were available. In current versions, Markdown behavior is controlled separately using Markdown configuration settings.

Improve Projects tab load performance

By default, all projects are loaded in a single request when opening the Projects tab.

For systems with many projects, limit the initial fetch to improve performance.

Add or update:

'projects' => array(
  'fetch' => array('maximum' => 50),
),

The default value 0 fetches all projects in a single call.

A positive value loads the first set of projects immediately and loads the rest in the background.

Allow members to view project settings

Control whether project members can view the Settings tab.

Add or update:

'projects' => array(
  'allow_view_settings' => true,
),
  • true (default): Members, owners, and administrators can view project settings

  • false: Only owners and administrators can view settings

When enabled:

  • Members can view configuration settings.

  • Sensitive sections, such as Automated tests and Automated deployment, remain hidden from non-owners.

Enforce branch path permissions

By default, users can create branches without validating access permissions for the specified paths.

To enforce permission checks, enable:

'projects' => array(
  'permission_check' => true,
),

When enabled:

  • P4 Code Review checks user permissions for each branch path.

  • Users without sufficient permissions cannot create the branch.

Permissions are validated using: p4 protects -M

Additional behavior

  • If a branch includes multiple paths, the user must have access to all paths.

  • If the user lacks permission for any path:

    • The branch cannot be created.

    • The branch cannot be deleted.

    • The project-level workflow cannot be modified.

Users who can pass permission checks include:

  • Super users

  • Administrators

  • Project owners

  • Users with write access to the specified paths