Поделиться через


Метод Security.CreateTemplates

Создает один или несколько шаблонов безопасности.

Пространство имен:  WebSvcSecurity
Сборка:  ProjectServerServices (в ProjectServerServices.dll)

Синтаксис

'Декларация
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Security/CreateTemplates", 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 CreateTemplates ( _
    templates As SecurityTemplatesDataSet _
)
'Применение
Dim instance As Security
Dim templates As SecurityTemplatesDataSet

instance.CreateTemplates(templates)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/office/project/server/webservices/Security/CreateTemplates", 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 CreateTemplates(
    SecurityTemplatesDataSet templates
)

Параметры

Замечания

Параметр templates должен содержать по крайней мере один SecurityTemplatesDataSet.SecurityTemplatesRow в таблице SecurityTemplates , который определяет новый шаблон. SecurityTemplatesDataTable может содержать несколько объектов SecurityTemplatesRow . Project Server проверяет каждый SecurityTemplatesRow из следующих:

  • Уникальное имя шаблона и GUID

Существует три объекта DataTable в SecurityTemplatesDataSet. SecurityTemplatesDataTable должен содержать данные. Таблицы данных выполняется в порядке, следующим образом:

  1. SecurityTemplates   Каждая строка указывает категорию GUID, имя и описание. Для создания категории безопасности требуются только идентификатор GUID и имя (WSEC_TMPL_UID и WSEC_TMPL_NAME).

  2. CategoryPermissions   Необязательный атрибут. Каждая строка указывает идентификатор GUID шаблона и разрешение категории GUID и задает Allow или Deny для разрешения. Сведения о разрешениях категории Просмотр структуры PSSecurityCategoryPermission .

  3. GlobalPermissions   Необязательный атрибут. Каждая строка указывает идентификатор GUID шаблона и глобальное разрешение GUID и задает Allow или Deny для разрешения. Сведения о глобальных разрешений Просмотр структуры PSSecurityGlobalPermission .

Примеры допустимого шаблонов выберите шаблон на странице "Управление шаблонами" в Project Web App для просмотра полей и параметров на странице "Добавление или изменение шаблона".

Разрешения Project Server

Разрешение

Описание

ManageSecurity

Позволяет пользователю управлять безопасности сервера Project Server. Глобальное разрешение.

Примеры

В следующем примере создается шаблон безопасности и добавляет глобальное разрешение, которое задано значение Allow для группы.

Дополнительные сведения и пример базового приложения для тестирования методов класса Security , в разделе С помощью методов безопасности в PSI. Можно добавить следующий код для примера приложения.

/*
 * Add this code to the sample application code in the article 
 * Using Security Methods in the PSI.
 */

// Create a GUID for the new template.
Guid templateGuid = Guid.NewGuid();

// Specify basic template information.
SvcSecurity.SecurityTemplatesDataSet templateDs =
   new SvcSecurity.SecurityTemplatesDataSet();
SvcSecurity.SecurityTemplatesDataSet.SecurityTemplatesRow templateRow =
   templateDs.SecurityTemplates.NewSecurityTemplatesRow();
templateRow.WSEC_TMPL_NAME = "SDK Test Template";
templateRow.WSEC_TMPL_UID = templateGuid;
templateRow.WSEC_TMPL_DESC = "This is the SDK Test Template.";
templateDs.SecurityTemplates.AddSecurityTemplatesRow(templateRow);

// Specify a global permission for the template.
SvcSecurity.SecurityTemplatesDataSet.GlobalPermissionsRow globalPermissionRow =
   templateDs.GlobalPermissions.NewGlobalPermissionsRow();
globalPermissionRow.WSEC_TMPL_UID = templateGuid;
// Add a permission that applies to the group. 
// For example, add the "About Microsoft Office Project Server" permission.
globalPermissionRow.WSEC_FEA_ACT_UID =
   PSLibrary.PSSecurityGlobalPermission.AboutMicrosoftOfficeProjectServer;
globalPermissionRow.WSEC_ALLOW = true;
templateDs.GlobalPermissions.AddGlobalPermissionsRow(globalPermissionRow);

// Now that the rows are added to the relevant tables, create the template.
security.CreateTemplates(templateDs);

См. также

Справочные материалы

Security класс

Элементы Security

Пространство имен WebSvcSecurity