p4 protects

Display protections in place for a given user, group, or path.

Syntax

p4 [g-opts] protects [-s spec][-a | -g  group | -u user]
                     [-h host] | -H] [-m] [-S | -A] [file ...]
p4 [g-opts] protects -M [-g group | -u user] [-h host | -H] [file ...]

Syntax conventions

Description

Use the p4 protects command to display the lines from the protections table that apply to a user, group, or set of files.

The output of p4 protects is scoped to the user who runs the command. For example, p4 protects -h host displays the lines, if any, for the current user at the specified host IP address.

A user with the super access level has the additional ability to run:

  • -a to display lines for all users.

  • -u user to display lines for the specified user.

  • -g group to display lines for the specified group.

With no options, p4 protects displays the lines in the protections table that apply to the current user.

If a file argument is provided, only those lines in the protection table that apply to the named files are displayed.

Use the -H option to display lines that apply to the current client's host (IP address).

Use the -m option to display a one-word summary of the maximum applicable access level, ignoring any provided file path.

Use the -M option to display a one-word summary of the maximum access level. Unlike the -m option, it takes into account the specified file path.

Use the -s spec option to dispay the contents of the file in the spec depot rather than the current protections table. This allows the super user back-in-time access to how permission would have behaved in a previous version of the protections spec.

For example, the following command returns information about the user maria in the third revision of the protections table:

            p4 -u super protects -s //spec/protect.p4s#3 -u maria
write user * * //...

This is useful when users lose access privileges at a given point in time and you want to check what changes were made to the protection table just before that date.

To use this option, you must define a spec depot for protect forms. This automatically saves revisions to the protect specification every time you edit the protection table. For information on how to create a spec depot, see p4 depot

  • Use the -S option to report only stream spec protection lines.
  • Use the -A option to report both stream spec and stream file lines.

Options

-a

Display protection lines for all users. This option requires super access.

-g group

Display protection lines that apply to the named group. This option requires super access.

-h host

Display protection lines that apply to the specified host IP address.

-H

Display protection lines that apply to the current client's IP address.

-m

Display a one-word summary of the maximum applicable access level. This does not take into account exclusionary mappings or the specified file path.

-M

Differs from -m because -M does take into account exclusions and the specified path.

-s spec

Display information from the specified earlier version of the protect file. The spec parameter specifies the path of the file version you’re interested in. To automatically save protect revisions every time you edit a form, define a spec depot for protect forms.

-u user

Display protection lines that apply to the specified user. This option requires super access.

-S Display only stream spec protection lines.
-A Display file and stream spec protection lines.

g-opts

See Global options.

Usage notes

Can File Arguments Use Revision Specifier? Can File Arguments Use Revision Range? Minimal Access Level Required

No

No

list,
super for -a, -g, -u

If the dm.protects.allow.admin configurable is set to 1, Helix Core Server administrators, in addition to Helix Core Server superusers, can also use p4 protects -a, -g, and -u.

Related commands

To edit the protections table

p4 protect