AddCommand
Adds a command right to the role.
Syntax
void AddCommand(Icommand command)
Parameter
Specify the following parameter when using this method:
Parameter | Description |
---|---|
command
|
The command right you want to add to the role. |
Discussion
This command right is not stored in Active Directory until you call the Commit
method.
Exceptions
AddCommand
throws an ApplicationException
if the command right is not in the
current or parent zone.
Example
The following code sample illustrates using AddCommand
in a script:
...
// Get the zone object
IHierarchicalZone objZone =
cims.GetZoneByPath("cn=" + strZone + "," + strContainerDN) as IHierarchicalZone;
if (objZone == null)
{
Console.WriteLine("Zone " + strZone + " does not exist.");
return;
}
IRole objRole = objZone.GetRole(strRole);
if (objRole == null)
{
Console.WriteLine("Role " + strRole + " does not exist.");
return;
}
ICommand objCmd = objZone.GetCommand(strCmd);
if (objCmd == null)
{
Console.WriteLine("Command " + strCmd + " does not exist.");
return;
}
objRole.AddCommand(objCmd);
objRole.Commit();
...