Security.CheckUserProjectPermissions 方法
检查当前用户是否具有一个或多个指定的项目的指定的安全类别权限。
命名空间: WebSvcSecurity
程序集: ProjectServerServices(位于 ProjectServerServices.dll 中)
语法
声明
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Security/CheckUserProjectPermissions", 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 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("https://schemas.microsoft.com/office/project/server/webservices/Security/CheckUserProjectPermissions", 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[] CheckUserProjectPermissions(
Guid projectUid,
Guid[] categoryPermissionUids
)
参数
projectUid
类型:System.Guid项目的 GUID。
categoryPermissionUids
类型:[]一个或多个类别权限 Guid 的数组。
返回值
类型:[]
对应于项目的当前用户的安全类别权限的Boolean值的数组。
备注
CheckUserProjectPermissions换行CheckUserObjectPermissions调用。若要检查的项目的单个类别权限,可以使用CheckUserProjectPermissions。检查项目上的另一个用户的类别权限,则需要使用模拟该用户的身份登录。
对于categoryPermissionUids参数, PSSecurityCategoryPermission结构用于获取 Guid 的默认类别权限,或使用ReadCategoryPermissions获取有关自定义类别权限的 Guid。
Project Server 权限
权限 |
说明 |
---|---|
允许用户登录到 Project Server。全局权限。 |
示例
下面的示例检查当前用户是否具有针对现有项目的三种 specificcategory 权限。有关其他信息和完整的示例应用程序,请参阅使用 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 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.
}
. . .