This topic has not yet been rated - Rate this topic

Security.CheckUserProjectPermissions method

Checks whether the current user has one or more of the specified security category permissions for a specified project.

Namespace:  WebSvcSecurity
Assembly:  ProjectServerServices (in ProjectServerServices.dll)
<SoapDocumentMethodAttribute("http://schemas.microsoft.com/office/project/server/webservices/Security/CheckUserProjectPermissions", RequestNamespace := "http://schemas.microsoft.com/office/project/server/webservices/Security/",  _
	ResponseNamespace := "http://schemas.microsoft.com/office/project/server/webservices/Security/",  _
	Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function CheckUserProjectPermissions ( _
	projectUid As Guid, _
	categoryPermissionUids As Guid() _
) As Boolean()
Dim instance As Security
Dim projectUid As Guid
Dim categoryPermissionUids As Guid()
Dim returnValue As Boolean()

returnValue = instance.CheckUserProjectPermissions(projectUid, _
	categoryPermissionUids)
[SoapDocumentMethodAttribute("http://schemas.microsoft.com/office/project/server/webservices/Security/CheckUserProjectPermissions", RequestNamespace = "http://schemas.microsoft.com/office/project/server/webservices/Security/", 
	ResponseNamespace = "http://schemas.microsoft.com/office/project/server/webservices/Security/", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public bool[] CheckUserProjectPermissions(
	Guid projectUid,
	Guid[] categoryPermissionUids
)

Parameters

projectUid
Type: System.Guid
The GUID of the project.
categoryPermissionUids
Type: []
An array of one or more category permission GUIDs.

Return value

Type: []
An array of Boolean values that correspond to security category permissions of the current user for the project.

CheckUserProjectPermissions wraps a call to CheckUserObjectPermissions. To check a single category permission for a project, you can use CheckUserProjectPermissions. Checking a category permission for another user on a project requires using impersonation to log on as that user.

For the categoryPermissionUids parameter, use the PSSecurityCategoryPermission structure to get the GUIDs for the default category permissions, or use ReadCategoryPermissions to get the GUIDs for custom category permissions.

Project Server Permissions

Permission

Description

LogOn

Allows a user to log on to Project Server. Global permission.

The following example checks whether the current user has three specific category permissions for an existing project. For additional information and a complete sample application, see Using Security Methods in the PSI.

using System;
using System.Net;
using PSLibrary = Microsoft.Office.Project.Server.Library;
. . .
CookieContainer cookiecontainer = new CookieContainer();
SvcSecurity.Security security = new SvcSecurity.Security();
security.Url = "http://ServerName/ProjectServerName/_vti_bin/psi/security.asmx";
security.CookieContainer = cookiecontainer;
security.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Set the GUID for an existing project.
Guid projectUid = new Guid("BC323C21-B7E4-4631-AF99-C44E5C52BA4E");

Guid[] permissionChecks = { 
   PSLibrary.PSSecurityCategoryPermission.BuildTeamOnProject, 
   PSLibrary.PSSecurityCategoryPermission.SaveProtectedBaseline, 
   PSLibrary.PSSecurityCategoryPermission.ViewProjectWorkspace };

bool[] permissionResults = new bool[permissionChecks.Length];
permissionResults = security.CheckUserProjectPermissions(projectUid, permissionChecks);

bool permissionOk = true;

for (int i = 0; i < permissionResults.Length; i++)
{
   permissionOk = permissionOk && permissionResults[i];
}
if (permissionOk)
{
   // Continue the application.
}
. . .
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.