Export (0) Print
Expand All

Security.CreateTemplates Method

Office 2007

Creates one or more security templates.

Namespace:  WebSvcSecurity
Assembly:  ProjectServerWebServices (in ProjectServerWebServices.dll)

[SoapDocumentMethodAttribute("http://schemas.microsoft.com/office/project/server/webservices/Security/CreateTemplates", RequestNamespace = "http://schemas.microsoft.com/office/project/server/webservices/Security/", 
	ResponseNamespace = "http://schemas.microsoft.com/office/project/server/webservices/Security/", 
	Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public void CreateTemplates(
	SecurityTemplatesDataSet templates
)

Parameters

templates
Type: WebSvcSecurity.SecurityTemplatesDataSet
Contains the information about one or more security templates.

The templates parameter must contain at least one SecurityTemplatesDataSet.SecurityTemplatesRow in the SecurityTemplates table that defines a new template. The SecurityTemplatesDataTable can contain multiple SecurityTemplatesRow objects. Project Server validates each SecurityTemplatesRow for the following:

  • Unique template name and GUID

There are three DataTable objects in a SecurityTemplatesDataSet. Only the SecurityTemplatesDataTable must contain data. The data tables are in order as follows:

  1. SecurityTemplates   Each row specifies the category GUID, name, and description. Only the GUID and name (WSEC_TMPL_UID and WSEC_TMPL_NAME) are required to create a security category.

  2. CategoryPermissions   Optional. Each row specifies the template GUID and category permission GUID, and sets Allow or Deny for the permission. For the category permissions, see the PSSecurityCategoryPermission structure.

  3. GlobalPermissions   Optional. Each row specifies the template GUID, the global permission GUID, and sets Allow or Deny for the permission. For the global permissions, see the PSSecurityGlobalPermission structure.

For examples of valid templates, click a template on the Manage Templates page in Project Web Access to see the fields and settings on the Add or Edit Template page.

Project Server Permissions

Permission

Description

ManageSecurity

Manage Project Server security. Global permission.

The following example creates a security template and adds a global permission set to Allow for the group.

For additional information and a basic sample application for testing the Security class methods, see Using Security Methods in the PSI. You can add the following code to the test application.

/*
 * 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.
SecurityWebSvc.SecurityTemplatesDataSet templateDs =
   new SecurityWebSvc.SecurityTemplatesDataSet();
SecurityWebSvc.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.
SecurityWebSvc.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);

Community Additions

ADD
Show:
© 2015 Microsoft