Security.CreateGroups 方法
创建一个或多个安全组。
命名空间: WebSvcSecurity
程序集: ProjectServerServices(位于 ProjectServerServices.dll 中)
语法
声明
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Security/CreateGroups", 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 Sub CreateGroups ( _
groups As SecurityGroupsDataSet _
)
用法
Dim instance As Security
Dim groups As SecurityGroupsDataSet
instance.CreateGroups(groups)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Security/CreateGroups", 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 void CreateGroups(
SecurityGroupsDataSet groups
)
参数
groups
类型:WebSvcSecurity.SecurityGroupsDataSet包含有关一个或多个安全组的信息。
备注
groups参数必须包含至少一个SecurityGroupsDataSet.SecurityGroupsRowSecurityGroups table 中定义一个新的组。SecurityGroupsDataTable可以包含多个SecurityGroupsRow对象。Project Server 验证以下每个SecurityGroupsRow :
一组唯一的名称和 GUID
存在组用户 (如果有)
SecurityGroupsDataSet有五个DataTable对象。仅SecurityGroupsDataTable必须包含数据。模拟运算表是按顺序,如下所示:
SecurityGroups 每个行指定类别的 GUID、 名称和说明。创建安全类别需要的 GUID 和 (WSEC_CAT_UID 和 WSEC_CAT_NAME) 的名称。
SecurityPrincipleCategoryRelations 可选。每个行指定组 GUID 和主要安全类别 GUID。Primarycategories,请参阅PSSecurityCategory结构。
CategoryPermissions 可选。每个行指定组 GUID 和类别权限 GUID,并设置Allow或Deny的权限。有关类别权限的信息,请参阅PSSecurityCategoryPermission结构。
GlobalPermissions 可选。每个行指定组 GUID 和全局权限的 GUID,并设置Allow或Deny的权限。有关全局权限的信息,请参阅PSSecurityGlobalPermission结构。
GroupMembers 可选。每个行指定组 GUID 和资源的 GUID。
有关有效的组的示例,单击Project Web App,在管理组页上的组添加或编辑组页上查看的字段和设置。
Project Server 权限
权限 |
说明 |
---|---|
允许用户管理 Project Server 用户和组。全局权限。 |
示例
下面的示例创建一个安全组,将资源添加到组,并将添加到Allow组设置一个全局权限。
有关其他信息和使用一组创建一个安全类别的完整示例应用程序,请参阅使用 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;
. . .
// Create a GUID for the new group.
Guid groupGuid = Guid.NewGuid();
// Specify basic group information.
SvcSecurity.SecurityGroupsDataSet groupDs =
new SvcSecurity.SecurityGroupsDataSet();
SvcSecurity.SecurityGroupsDataSet.SecurityGroupsRow groupRow =
groupDs.SecurityGroups.NewSecurityGroupsRow();
groupRow.WSEC_GRP_NAME = "SDK Test Group";
groupRow.WSEC_GRP_UID = groupGuid;
groupRow.WSEC_GRP_DESC = "This is the SDK Test Group.";
groupDs.SecurityGroups.AddSecurityGroupsRow(groupRow);
// Set the GUID for an existing resource.
Guid resourceUid = new Guid("a1fcbf91-e91d-44e2-a4a7-3b4b698cb984");
// Add the resource to the new group.
SvcSecurity.SecurityGroupsDataSet.GroupMembersRow groupMembersRow =
groupDs.GroupMembers.NewGroupMembersRow();
groupMembersRow.WSEC_GRP_UID = groupGuid;
groupMembersRow.RES_UID = resourceUid;
groupDs.GroupMembers.AddGroupMembersRow(groupMembersRow);
// Specify a global permission for the group.
SvcSecurity.SecurityGroupsDataSet.GlobalPermissionsRow globalPermRow =
groupDs.GlobalPermissions.NewGlobalPermissionsRow();
globalPermRow.WSEC_GRP_UID = groupGuid;
// Add a permission that applies to the group.
// For example, add the "About Microsoft Office Project Server" permission.
globalPermRow.WSEC_FEA_ACT_UID =
PSLibrary.PSSecurityGlobalPermission.AboutMicrosoftOfficeProjectServer;
globalPermRow.WSEC_ALLOW = true;
groupDs.GlobalPermissions.AddGlobalPermissionsRow(globalPermRow);
// Now that all the rows are added to the relevant tables,
// create the group.
security.CreateGroups(groupDs);
. . .