Security Administration (ISecurityAdmin Interface) |
Applies the authorizations defined in an ACT to the specified resource.
Category: General authorization administration methods
Syntax |
ApplyACTToObj(tCtxt,resource,flags,ACTresource);
Parameters |
Details |
The ACT must exist before you can apply it with the ApplyACTToObj method. You can create an ACT with the CreateAccessControlTemplate method.
When TCTXT is set to a valid value, the permanent application of the ACT is deferred until the EndTransactionContext method is invoked on a resource with the SECAD_COMMIT_TC flag. However, a subsequent call to the GetAccessControlTemplatesOnObj method with the TCTXT value returns the applied ACT for the object represented by TCTXT.
When TCTXT is null and RESOURCE is set to a valid value, the ACT is applied to the specified resource immediately by the SAS Metadata Server.
The method fails if the caller does not have WriteMetadata permission on the target resource, and ReadMetadata permission for the ACT being applied.
Exceptions Thrown |
The SAS Open Metadata Interface explicitly returns the following exceptions for the ApplyACTToObj method:
SECAD_INVALID_TC_HANDLE
SECAD_INVALID_RESOURCE_SPEC
SECAD_INVALID_ACTION
SECAD_OBJECT_NOT_ACT
SECAD_ACT_DOES_NOT_EXIST
SECAD_ACT_IN_DEPENDENT_REPOSITORY
SECAD_NOT_AUTHORIZED
Examples |
The following code fragment shows how the ApplyACTToObj method is issued in a Java environment:
public void applyAccessControlTemplateToObj(String transCtxt, String resource, int options, String ACTspec ) throws Exception { try { iSecurityAdmin.ApplyACTToObj(transCtxt, resource, options, ACTspec); } catch (Exception e) { System.out.println("ApplyACTToObj: Exceptions"); e.printStackTrace(); throw e; } }
The following example issues the ApplyACTToObj method to apply a predefined ACT to an existing Tree object that represents a folder. The ACT is identified by ACTSPEC:
public void ApplyACTToObj() throws Exception { // Define an object variable for the Tree Tree_URN = "OMSOBJ:Tree/metadata-identifier"; // Apply the ACT to a Tree. Because a value is specified in the // resource parameter, the tCtxt parameter is null. iSecurityAdmin.ApplyAccessControlTemplateToObj("",Tree_URN, 0, ACTspec); //If we had submitted a tCtxt value, resource would be null. } catch (Exception e) { throw e; } }
Related Methods |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.