Security.CheckUserGlobalPermissions 方法

检查当前用户是否具有一个或多个指定的全局权限。

命名空间:  WebSvcSecurity
程序集:  ProjectServerServices(位于 ProjectServerServices.dll 中)

语法

声明
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Security/CheckUserGlobalPermissions", 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 CheckUserGlobalPermissions ( _
    globalPermissionUids As Guid() _
) As Boolean()
用法
Dim instance As Security
Dim globalPermissionUids As Guid()
Dim returnValue As Boolean()

returnValue = instance.CheckUserGlobalPermissions(globalPermissionUids)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Security/CheckUserGlobalPermissions", 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[] CheckUserGlobalPermissions(
    Guid[] globalPermissionUids
)

参数

  • globalPermissionUids
    类型:[]

    一个或多个全局权限的唯一标识符数组。

返回值

类型:[]
对于globalPermissionUids参数中的每个值的Boolean值的数组。

备注

检查多个全局权限时,请使用复数CheckUserGlobalPermissions方法比CheckUserGlobalPermission更好的性能。检查另一个资源安全权限,则需要使用模拟 (该资源的身份登录。

globalPermissionUids参数中的 GUID 值,使用PSSecurityCategoryPermission结构获取默认全局权限,或使用ReadGlobalPermissions获取自定义全局权限的 Guid。

Project Server 权限

权限

说明

LogOn

允许用户登录到 Project Server。全局权限。

示例

下面的示例检查当前用户是否具有三个特定的全局权限。有关其他信息和检查多个全局权限的完整示例应用程序,请参阅使用 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;

Guid[] permissionChecks = { 
      // Permissions for creating resources and security groups:
   PSLibrary.PSSecurityGlobalPermission.NewResource, 
   PSLibrary.PSSecurityGlobalPermission.ManageUsersAndGroups, 
      // Permission for creating security categories:
   PSLibrary.PSSecurityGlobalPermission.ManageSecurity }; 

bool[] permissionResults = new bool[permissionChecks.Length];
permissionResults = security.CheckUserGlobalPermissions(permissionChecks);

bool permissionOk = true;

for (int i = 0; i < permissionResults.Length; i++)
{
   permissionOk = permissionOk && permissionResults[i];
}

if (permissionOk)
{
   // Continue the application.
}
. . .

另请参阅

引用

Security 类

Security 成员

WebSvcSecurity 命名空间

其他资源

使用 PSI 中的安全方法

演练: 创建和使用自定义 Project Server 权限