Security.CheckUserObjectPermission Method

Checks whether the current user has the single specified security category permission 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

[SoapDocumentMethodAttribute("http://schemas.microsoft.com/office/project/server/webservices/Security/CheckUserObjectPermission", 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 CheckUserObjectPermission(
	Guid objectUid,
	Guid objectTypeUid,
	Guid categoryPermissionUid
)

Parameters

objectUid
Type: System.Guid
The GUID of an object.
objectTypeUid
Type: System.Guid
The GUID of an object type.
categoryPermissionUid
Type: System.Guid
The GUID of a security category permission.

Return Value

Type: System.Boolean
True if the current user has the permission; otherwise, false.

To avoid specifying the objectTypeUid, you can use CheckUserProjectPermission or CheckUserResourcePermission instead of CheckUserObjectPermission.

To check multiple object permissions, use CheckUserObjectPermissions, CheckUserProjectPermissions, or CheckUserResourcePermissions for better performance. 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 GUID for one of the default category permissions, or use ReadCategoryPermissions to get the GUID for a custom category permission.

Project Server Permissions

Permission

Description

LogOn

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

The following example checks whether the current user has the "Assign Resource" permission for a specific resource. 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 = "http://ServerName/ProjectServerName/_vti_bin/psi/security.asmx";
security.CookieContainer = cookiecontainer;
security.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Check whether the user has the "Assign Resource" permission for a resource.
// Set the GUID for an existing resource.
Guid resourceUid = new Guid("a1fcbf91-e91d-44e2-a4a7-3b4b698cb984");
Guid resourceType = PSLibrary.PSSecurityObjectType.Resource;
Guid categoryPermission = PSLibrary.PSSecurityCategoryPermission.AssignResource;

bool hasAssignResourcePermission = 
   security.CheckUserObjectPermission(resourceUid, resourceType, categoryPermission);
. . .

Community Additions

Show: