I am working on jdbc provisioning rule.
This is my first time working on it need some direction below is the creation of account store proc can someone tell me how can this be integrated in the rule so that i can draft rest all the operations accordingly.
Please note the sugvtte i have is native identity value
EXEC AppSource.dbo.genericsCreateAccount @loginID = ‘NAMCK\sugvtte’, @acctName = ‘sugvtte’, @email = ‘[email protected]’, @firstName = ‘test1’, @lastName = ‘test2’
Since this is your first time working on a JDBC Provisioning Rule, I’ll guide you through integrating your stored procedure for account creation, deploying the rule to ISC, and attaching it to your JDBC source.
Writing the JDBC Provisioning Rule
Here’s how to integrate your stored procedure’s:
Example:
import java.sql.Connection;
import java.sql.CallableStatement;
import java.sql.SQLException;
import java.util.List;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.object.ProvisioningResult;
public String getAttributeRequestValue(AccountRequest acctReq, String attribute) {
if (acctReq != null) {
AttributeRequest attrReq = acctReq.getAttributeRequest(attribute);
if (attrReq != null) {
return attrReq.getValue();
}
}
return null;
}
ProvisioningResult result = new ProvisioningResult();
CallableStatement statement = null;
if (plan != null) {
List accounts = plan.getAccountRequests();
if (accounts != null && accounts.size() > 0) {
for (AccountRequest account : accounts) {
try {
if (AccountRequest.Operation.Create.equals(account.getOperation())) {
// Prepare the stored procedure call
String procCall = "{call AppSource.dbo.genericsCreateAccount(?,?,?,?,?)}";
statement = connection.prepareCall(procCall);
// Set parameters based on your stored procedure
String nativeIdentity = (String) account.getNativeIdentity();
statement.setString(1, "NAMCK\\" + nativeIdentity); // @loginID
statement.setString(2, nativeIdentity); // @acctName
statement.setString(3, getAttributeRequestValue(account, "email"));
statement.setString(4, getAttributeRequestValue(account, "firstName"));
statement.setString(5, getAttributeRequestValue(account, "lastName"));
// Execute the stored procedure
statement.execute();
// Mark the operation as successful
result.setStatus(ProvisioningResult.STATUS_COMMITTED);
} else if (AccountRequest.Operation.Modify.equals(account.getOperation())) {
// for Modify logic
log.debug("Modify operation not yet implemented for: " + account.getNativeIdentity());
} else if (AccountRequest.Operation.Delete.equals(account.getOperation())) {
// for Delete logic
log.debug("Delete operation not yet implemented for: " + account.getNativeIdentity());
} else {
log.debug("Unsupported operation: " + account.getOperation());
}
} catch (SQLException e) {
result.setStatus(ProvisioningResult.STATUS_FAILED);
result.addError(e);
log.error("Provisioning failed: " + e.getMessage());
} finally {
if(statement != null) {
statement.close();
}
}
}
}
}
return result;
How did you get these attribute names?
email
firstName etc how can i know what all are available
also for next stored proc grant access i need rolename and roleid how to get that in the code?
The attribute names like email, firstName, etc., typically come from the ProvisioiningPolicy defined for your JDBC source. for create operation use can use Create Profile.
Getting rolename and roleid for Stored Procedure Grant Access
For your next use case with the stored procedure to grant access, I assume roleid is an entitlement type (like a role or group in your system), and rolename is its readable name. To fetch these in your code in a Provisioning Rule, you can extract them from the provisioning plan’s account requests.
Access the Provisioning Plan: SailPoint passes the plan object, which contains all the provisioning details. You can loop through the AccountRequest objects to find entitlement-related data.
Fetch Entitlements: Entitlements (like roleid) are typically requested as AttributeRequest objects within an AccountRequest. You can check for these and grab their values.
The video was helpful.
this is the add access stored proc
EXEC AppSource.dbo.genericsGrantAccess @acctName = ‘sugvtte’, @entID = ‘268’, @entName = ‘Admin (Security)’;
here i need in @entName i need name and @entid i need id
this is how the role is defined
both the create account and add access should run in the create operation.
another question if during deletion i need an account attribute (userid) - this is an account level attribute not present at identity level how can i put that in the code
You can creating a disable provisioning policy using REST API onto your JDBC source.
By doing this, whenever there is a disable operation on your accounts, the attributes from this disable provisioning policy can be fetched in your JDBC Provisioning Rule with the plan keyword.
Ensure to use usageType as DISABLE and add the attributes that you would want to invoke during account disablement. And make changes in your JDBC Provisioning rule accordingly.
In another post someone suggested writing the non-null values from the provisioning plan then read the attributes that are null from the application table to write a complete record. It seems to be working.