ApplyACTToObj

Short Description

Applies the authorizations defined in an ACT to the specified resource.

Category

General authorization administration methods

Syntax

ApplyACTToObj(tCtxt,resource,flags,ACTresource);

Parameters

Method Parameters
Parameter
Type
Direction
Description
tCtxt
string
in
Optional handle representing a server-side transaction context.
resource
string
in
Optional resource identifier of the object to which the ACT should be applied. If TCTXT is used, do not specify a value in RESOURCE.
flags
int
in
Currently unused. Callers should set this parameter to 0.
ACTresource
string
in
Passed resource identifier of an ACT.

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
	{
		SecurityAdmin.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 resource is used, 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;
        }
}