Security.CheckUserResourcePermissions method
Checks whether the current user has one or more of the specified security category permissions for a specified resource.
Namespace: WebSvcSecurity
Assembly: ProjectServerServices (in ProjectServerServices.dll)
Syntax
'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Security/CheckUserResourcePermissions", 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 CheckUserResourcePermissions ( _
resourceUid As Guid, _
categoryPermissionUids As Guid() _
) As Boolean()
'Usage
Dim instance As Security
Dim resourceUid As Guid
Dim categoryPermissionUids As Guid()
Dim returnValue As Boolean()
returnValue = instance.CheckUserResourcePermissions(resourceUid, _
categoryPermissionUids)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Security/CheckUserResourcePermissions", 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[] CheckUserResourcePermissions(
Guid resourceUid,
Guid[] categoryPermissionUids
)
Parameters
resourceUid
Type: System.GuidThe GUID of the resource.
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 resource.
Remarks
CheckUserResourcePermissions wraps a call to CheckUserObjectPermissions. To check for a single category permission for a resource, you can use CheckUserResourcePermission. 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 |
---|---|
Allows a user to log on to Project Server. Global permission. |
Examples
The following example checks whether the current user has three different category permissions for an existing 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();
SvcSecurity.Security security = new SvcSecurity.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 resource.
Guid resourceUid = new Guid("a1fcbf91-e91d-44e2-a4a7-3b4b698cb984");
Guid[] permissionChecks = {
PSLibrary.PSSecurityCategoryPermission.AssignResource,
PSLibrary.PSSecurityCategoryPermission.AdjustTimesheet,
PSLibrary.PSSecurityCategoryPermission.ViewResourceAssignmentsInAssignmentViews };
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.
}
. . .
See also
Reference
Other resources
Using Security Methods in the PSI
Walkthrough: Creating and Using Custom Project Server Permissions