IBM Support

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

Question & Answer


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.

[{"Product":{"code":"SSYQQ2","label":"Rational Change"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"General Information","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"5.2.0.2;5.2;5.1;5.0;4.7;4.6.1;4.6","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSC6Q5","label":"Rational Synergy"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"General Information","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.1a;7.1;7.0;6.5;6.4","Edition":"All Editions","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
22 December 2020

UID

swg21416701