We are delighted to share our new EIC Delivery Methodology for efficiently managing Saviynt Implementations and delivering quick time to value. CLICK HERE.

DB connector- GrantaccessJSON syntax error

prashanthreddy
New Contributor III
New Contributor III

Hi team,

 

I'm trying to create and grant access to a db account. I'm able to create account but grant access is failing in the same request.

 

GrantaccessJSON: 

{"Roles": "${if(arsTasks.entitlement_valueKey.entitlement_value.toString().contains('#Y#Y#Y#Y')){'GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO '${accountName}'@'%';'} else {'GRANT SELECT ON *.* TO '${accountName}'@'%';'}}"}

Error in the provision comment:

Error while assigning access - trust4_poc_docker#Y#N#N#N to account - dpzkr -dpzkr-Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript14888.groovy: 1: expecting '}', found '@' @ line 1, column 152. LETE ON *.* TO '${accountName}'@'%';'} e ^ 1 error

Appreciate the help. TIA

 

6 REPLIES 6

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @prashanthreddy,

Try with the below queries,

{ "Roles":
"${if(arsTasks.entitlement_valueKey.entitlement_value.toString().contains('#Y#Y#Y#Y')){'GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO '${accountName}''{{@}}''%';'} else {'GRANT SELECT ON *.* TO '${accountName}''{{@}}''%';'}}"
} 


or 

{"Roles" : "${task.entitlement_valueKey.entitlement_value.toString().contains('#Y#Y#Y#Y')?'GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO \"'+accountName+'\";':'GRANT SELECT ON *.* TO \"'+accountName+'\";'}"}



Thanks,




prashanthreddy
New Contributor III
New Contributor III

Hi Sudesh,

Thanks for the response but for the first json I see this error:

Error while assigning access - trust4_poc_docker#Y#N#N#N to account - dpigr -dpigr-Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript22650.groovy: 1: Ambiguous expression could be either a parameterless closure expression or an isolated open code block; solution: Add an explicit closure parameter list, e.g. {it -> ...}, or force it to be treated as an open block by giving it a label, e.g. L:{...} @ line 1, column 166. E ON *.* TO '${accountName}''{{@}}''%';' ^ 1 error

 

 

And for the second one :

Error while assigning access - trust4_poc_docker#Y#N#N#N to account - dpjrl -dpjrl-No such property: entitlement_valueKey for class: java.lang.String

 

 

 

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @prashanthreddy,

Can you please try with the below query,
{
"Roles": "${if(arsTasks.entitlement_valueKey.entitlement_value.toString().contains('#Y#Y#Y#Y')){'GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO \'' + accountName + '\'@\'%\';'} else {'GRANT SELECT ON *.* TO \'' + accountName + '\'@\'%\';'}}"
}

or try with the \\ as well,
{
"Roles": "${if(arsTasks.entitlement_valueKey.entitlement_value.toString().contains('#Y#Y#Y#Y')){'GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO\\'${accountName}\\'@\\'%\\';'} else {'GRANT SELECT ON *.* TO\\'${accountName}\\'@\\'%\\';'}}"
}

Thanks

Error while assigning access - xxxx No such property: entitlement_valueKey for class: java.lang.String
 

@prashanthreddy : Try this ternary operation

{"Roles" : "${task.entitlement_valueKey.entitlement_value.toString().contains('#Y#Y#Y#Y')?'GRANT SELECT, INSERT, UPDATE, DELETE ON *.* TO \"'+accountName+'\";':'GRANT SELECT ON *.* TO \"'+accountName+'\";'}"}


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

prashanthreddy
New Contributor III
New Contributor III

Thanks Saathvik,

It worked.