You view and set properties for an object with domain scope by using the object's get and set methods, just as you do for objects with global scope.
Sometimes, the value of an object's property is not a string or numeric value, but another object. For example, with policies, you add rules and users to the policy, and you set responses for the rules in the policy. All of these values are provided as objects.
Example: Add objects to a policy
In the following example, the policy is configured with a user, rule and response:
use Netegrity::PolicyMgtAPI; $policyapi = Netegrity::PolicyMgtAPI‑>New(); $session = $policyapi‑>CreateSession("adminid", "adminpwd"); $domain=$session‑>GetDomain("engineering"); $policy=$domain‑>GetPolicy("Payroll Policy"); # Add a user to the policy $userdir=$session‑>GetUserDir("Acme North Directory"); @users=$userdir‑>LookupEntry("uid=ppaycheck"); foreach $user(@users) { if ($user‑>GetPath()=="uid=ppaycheck,ou=HR,o=security.com") { $userResult=$policy‑>AddUser($user); $thisUser=$user; } } if ($userResult != 0) { print "Error adding user to policy.\n"; } # Add a rule to the policy $realm=$domain‑>GetRealm("HR"); $rule=$realm‑>GetRule("Payroll Rule"); $ruleResult=$policy‑>AddRule($rule); if ($ruleResult != 0) { print "Error adding rule to policy.\n"; } else { # Set a response for the rule $response=$domain‑>GetResponse("Welcome to Payroll"); $respResult=$policy‑>SetResponse($rule,$response); if ($respResult != 0) { print "Error adding response to policy.\n" } } print "\nAdded these objects to the policy:\n"; print " User DN: ".$thisUser‑>GetPath()."\n" unless $userResult!=0; print " Rule: ".$rule‑>Name()."\n" unless $ruleResult!=0; print " Response: ".$response‑>Name()."\n" unless $respResult!=0;
Copyright © 2010 CA. All rights reserved. | Email CA about this topic |