Get a list of Perforce protection entries for the passed-in file specs

Namespace: Perforce.P4
Assembly: p4api.net (in p4api.net.dll) Version: 2017.3.160.836 (2017.3.160.0836)

Syntax

C#
public IList<ProtectionEntry> GetProtectionEntries(
	IList<FileSpec> filespecs,
	Options options
)
Visual Basic
Public Function GetProtectionEntries ( _
	filespecs As IList(Of FileSpec), _
	options As Options _
) As IList(Of ProtectionEntry)
Visual C++
public:
IList<ProtectionEntry^>^ GetProtectionEntries(
	IList<FileSpec^>^ filespecs, 
	Options^ options
)

Parameters

filespecs
Type: System.Collections.Generic..::..IList<(Of <(<'FileSpec>)>)>
options
Type: Perforce.P4..::..Options

Return Value

Remarks


p4 help protects

protects -- Display protections defined for a specified user and path

p4 protects [-a | -g group | -u user] [-h host] [-m] [file ...]

'p4 protects' displays the lines from the protections table that
apply to the current user. The protections table is managed using
the 'p4 protect' command.

If the -a flag is specified, protection lines for all users are
displayed. If the -g group flag or -u user flag is specified,
protection lines for that group or user are displayed.

If the -h host flag is specified, the protection lines that apply
to the specified host (IP address) are displayed.

If the -m flag is given, a single word summary of the maximum
access level is reported. Note that this summary does not take
exclusions or the specified file path into account.

If the file argument is specified, protection lines that apply to
the specified files are displayed.

The -a/-g/-u flags require 'super' access granted by 'p4 protect'.

Examples

To get the protections for the user tim for the entire server:
CopyC#
GetProtectionEntriesCmdOptions opts =
new GetProtectionEntriesCmdOptions(GetProtectionEntriesCmdFlags.None,
null, "tim", null);

FileSpec filespec =
new FileSpec(new DepotPath("//..."), null);
IList<FileSpec> filespecs = new List<FileSpec>();
filespecs.Add(filespec);

IList<ProtectionEntry> target =
Repository.GetProtectionEntries(filespecs, opts);
To get the protections summary for the group development tim for the entire server when connecting from IP address 10.24.4.6:
CopyC#
GetProtectionEntriesCmdOptions opts =
new GetProtectionEntriesCmdOptions(GetProtectionEntriesCmdFlags.AccessSummary,
"development", null, "10.24.4.6");

FileSpec filespec =
new FileSpec(new DepotPath("//..."), null);
IList<FileSpec> filespecs = new List<FileSpec>();
filespecs.Add(filespec);

IList<ProtectionEntry> target =
Repository.GetProtectionEntries(filespecs, opts);

See Also