25.2.6.8.1 Invoking the Provision Account API
Invoke a provisioning API to create the approved patient’s account and assign its role.
As shown below, your Patient Onboarding workflow's Provision Account
activity is an Invoke API that calls the PROVISION_ACCOUNT
procedure.
Figure 25-101 Provision Account Invoke API Activity Creates User Account
The PROVISION_ACCOUNT routine is below. It looks up the patient information using the patient ID passed in, then calls a CREATE_USER procedure in the FRC_APEX_USER package to create the APEX user account. Finally, it calls ADD_USER_ROLE in the APEX_ACL package to add the new account's username to the Access Control List (ACL) role with Static ID PATIENTS. The Woods Clinic application serves both back office staff and patients. It uses Authorization Schemes based on ACL role membership to automatically show each user appropriate pages and functionality based on their role.
procedure provision_account(
p_patient_id number)
is
l_patient t_patient := patient(p_patient_id);
l_clinic_app_id number := frc_app.clinic_app_id();
begin
frc_apex_user.create_user(
p_username => l_patient.username,
p_email => l_patient.email,
p_patient_id => p_patient_id
);
apex_acl.add_user_role(
p_application_id => l_clinic_app_id,
p_user_name => l_patient.username,
p_role_static_id => 'PATIENTS'
);
end;Parent topic: Provisioning a New User Account
