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
anneragh
(Raghunath Anne)
September 18, 2024, 7:16pm
3
@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?
anneragh
(Raghunath Anne)
September 18, 2024, 7:30pm
6
As I explained the issue is in this line “return idn.getAccountAttribute(applicationName, input, attribute);”
YOu must pass the 3 arguments.
application Name = sourceName [source]
accountID = input (unique account ID in your source))
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>
anneragh
(Raghunath Anne)
September 18, 2024, 8:01pm
7
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
anneragh
(Raghunath Anne)
September 19, 2024, 2:49pm
9
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>
system
(system)
Closed
November 18, 2024, 2:50pm
10
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.