Using the CSAPI to get a list of Rational Synergy database users and roles

Technote (FAQ)


Question

Can I use the Change CSAPI to get a list of IBM Rational Synergy database users and roles?

Answer

The csapi GetObjectData function can be used to get the contents of the users attribute on the base model. You would need the cvid of the base model:


ccm query -t model -n base -f %cvid

Usually the value of this is 10001

The CSAPI function loads the details of a compver into data classes in which the details of the compver can be modified or displayed. The return result is an instance of the apiObjectVector class.

Parameters:
apiUser aUser : The current api user's login data.
scalar cvid : The cvid of a compver.
scalar AttrList : A delimited list of attributes.
[attribute_name|attribute_name|attribute_name|...]

Returns: apiObjectVector The contents of the attributes requested.

Example:

my $csapi = new ChangeSynergy::csapi();
eval
{
$csapi->setUpConnection("http", "angler", 8600);
my $aUser = $csapi->Login("u00001", "u00001", "User", \\\\angler\\ccmdb\\cm_database");
my $objVector = $csapi->GetObjectData($aUser, $cv1, "users");
my $i;
my $j = $objVector->getDataSize();
for($i=0; $i < $j; $i++)
{
print "Name : " . $objVector->getDataObject($i)->getName() . "\n";
print "Value: " . $objVector->getDataObject($i)->getValue() . "\n";
}
};
if ($@)
{
print $@;
}


You will need to substitute in some real values in the above script example for your host, port, database path and username. Once the list of users and roles is returned, you can parse it for the particular user you want.


Here's an example with 'real' values:


use ChangeSynergy::csapi;

#Create a new instance of the csapi object.
my $csapi = new ChangeSynergy::csapi();
eval
{
       $csapi->setUpConnection("http", "myserver", 8600);
       my $aUser = $csapi->Login("ccm_root", password, "User", "/shared_data/ccm/mydatabase");
my $objVector = $csapi->GetObjectData($aUser,10001, "users");
my $i;
my $j = $objVector->getDataSize();
for($i=0; $i < $j; $i++)
{
print "Name : " . $objVector->getDataObject($i)->getName() ."\n";
print "Value: " . $objVector->getDataObject($i)->getValue() . "\n";
}
};
if ($@)
{
print $@;
}

Note: The above code is an example only. Methods used in the above example are subject to modifications. You will need to consult the CSAPI documentation of your version of Rational Change for the correct methods and syntax.

Note 2: The setUpConnection method syntax has changed since the advent of Rational Change 5.2. The syntax for Change 5.2 uses a single parameter being the URL of the application. For example:

$csapi->setUpConnection("http: //your_hostname:port/your_context");

See http: //hostname:port/change/trapeze/help/perl_api/index.html for details.


Cross Reference information
Segment Product Component Platform Version Edition
Software Development Rational Synergy General Information AIX, Linux, Solaris, Windows 7.1a, 7.1, 7.0, 6.5, 6.4 All Editions

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

Rational Change
General Information

Software version:

4.6, 4.6.1, 4.7, 5.0, 5.1, 5.2, 5.2.0.2

Operating system(s):

AIX, Linux, Solaris, Windows

Reference #:

1416701

Modified date:

2011-05-12

Translate my page

Machine Translation

Content navigation