Share via


Security.CheckUserObjectPermissions Method

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

Namespace:  [Security Web service]
Service reference: http://ServerName:32843/[Project Service Application GUID]/PSI/Security.svc
Web service reference: http://ServerName/ProjectServerName/_vti_bin/PSI/Security.asmx?wsdl

Syntax

'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Security/CheckUserObjectPermissions", RequestNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Security/",  _
    ResponseNamespace := "https://schemas.microsoft.com/office/project/server/webservices/Security/",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function CheckUserObjectPermissions ( _
    objectUid As Guid, _
    objectTypeUid As Guid, _
    categoryPermissionUids As Guid() _
) As Boolean()
'Usage
Dim instance As Security
Dim objectUid As Guid
Dim objectTypeUid As Guid
Dim categoryPermissionUids As Guid()
Dim returnValue As Boolean()

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

Parameters

  • objectTypeUid
    Type: System.Guid
    The GUID of an object type.
  • categoryPermissionUids
    Type: []
    An array of one or more category permission GUIDs.

Return Value

Type: []
An array of Boolean values for each value in the categoryPermissionUids parameter.

Remarks

To avoid specifying the objectTypeUid, you can use CheckUserProjectPermissions or CheckUserResourcePermissions instead of CheckUserObjectPermissions. Checking a security permission for another resource requires using impersonation to log on as that resource.

For the objectTypeUid parameter, use the PSSecurityObjectType structure to get the GUID for the Project or Resource object type. For the categoryPermissionUid parameter, use the PSSecurityCategoryPermission structure to get the GUIDs of 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 the Project Server. Global permission.

Examples

The following example checks whether the current user has three specific category permissions for a 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();
SecurityWebSvc.Security security = new SecurityWebSvc.Security();
security.Url = "https://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 objectType = PSLibrary.PSSecurityObjectType.Project;

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

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

bool permissionOk = true;

for (int i = 0; i < permissionResults.Length; i++)
{
   permissionOk = permissionOk && permissionResults[i];
}
if (permissionOk)
{
   // Continue the application.
}
. . .

See Also

Reference

Security Class

Security Members

Security Web Service

Other Resources

Using Security Methods in the PSI

Walkthrough: Creating and Using Custom Project Server Permissions