Cloud rule syntax

I am new to ISC and cloud rules, I was looking at the code in this rule and noticed what I thought was an unnecessary assignment:

String input = input;

I omitted that line and submitted the rule, but it failed validation.

I assume adding the rule back will solve this, but why? If the linter succeeds with that line, would we not agree that the linter is broken?

I must be missing something else?

Hey @josephcasale ,

Could you share the edited rule for better understanding. Omit the sensitive parts if any.

1 Like

@josephcasale Please check line 5 in you code

It seems your rule has a line that contains idn.getAccountAttribute(applicationName, input, attribute)

Since you removing the String input=input;

But you are referencing the “variable input” in the method arguments, it is throwing the exception.

Hello guys,
I simplified the original thinking it was not a problem:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="My Rule Name" type="Transform">
  <Description>
    Maps the employee type, city and department lookup key to the corresponding Active Directory SGIC organizational unit.
  </Description>
  <Source><![CDATA[
    String applicationName = "My Source [source]";
    String attribute = "organizationalUnit";

    return idn.getAccountAttribute(applicationName, input, attribute);
  ]]></Source>
</Rule>

Is input not passed in to the rule?

It seems that redundant assignment is necessary, the docs have it?

As I explained the issue is in this line “return idn.getAccountAttribute(applicationName, input, attribute);”

YOu must pass the 3 arguments.

  1. application Name = sourceName [source]
  2. accountID = input (unique account ID in your source))
  3. attribute= “attribute you want to read from source account”
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="My Rule Name" type="Transform">
  <Description>
    Maps the employee type, city and department lookup key to the corresponding Active Directory SGIC organizational unit.
  </Description>
  <Source><![CDATA[
   
    String applicationName = "My Source [source]";
    String attribute = "organizationalUnit";
    public String readAccountAttributeValue( String input ) {
        return idn.getAccountAttribute(applicationName, input, attribute);
    }
    return idn.readAccountAttributeValue(input);
  ]]></Source>
</Rule>

I updated my answer with some code changes (I did not test it)!

Removed necessary assignment “String input = input”

Also, added a new method “readAccountAttributeValue”

Thanks
Raghu

I can confirm, the error seems to be a gap in the linter.

The following code passed and was deployed:

    String input = input;

    String applicationName = "My App Name [source]";
    String attribute = "organizationalUnit";

    return idn.getAccountAttribute(applicationName, input, attribute);

Seems the following cases could use an enhancement in the linter:

  • A list of externally initialized variables that do not trigger the warning.
  • An update to detect an initialized variable outside of a function call as String input = input; should have also been a problem.
1 Like

YEs @josephcasale that’s right finding. That is the reason in my centralized property store blog I am using Sting input=input

Otherwise, as I explained above, we must define a new method and pass input - (Copy pasted form above)

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="My Rule Name" type="Transform">
  <Description>
    Maps the employee type, city and department lookup key to the corresponding Active Directory SGIC organizational unit.
  </Description>
  <Source><![CDATA[
   
    String applicationName = "My Source [source]";
    String attribute = "organizationalUnit";
    public String readAccountAttributeValue( String input ) {
        return idn.getAccountAttribute(applicationName, input, attribute);
    }
    return idn.readAccountAttributeValue(input);
  ]]></Source>
</Rule>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.