40 Restricting Additional Bundles Purchase Based on Roles

Learn how to customize Oracle Communications Billing Care to restrict the purchase of additional bundles based on user roles or permissions.

Topics in this document:

About Restricting Bundles

By default, the Billing Care Purchase Catalogue screen displays all bundles (/deal objects) retrieved from the BRM database. Customer service representatives (CSRs) can select these bundles for purchase. You can customize Billing Care to display any additional bundles that can be purchased based on a CSR's role or permission.

Restricting Bundles Based on Roles

You can use the Billing Care SDK and OPSS policies to customize the Purchase Catalogue screen to display bundles for additional purchase based on CSR roles or permissions.

To restrict the bundles displayed for additional purchase:

  1. Define a new ResourceType and Resource for bundles in the OPSS Server, such as DealNameResourceType and DealNameResource.
  2. Add the new ResourceType to the CustomConfigurations.xml file. For example:
    <keyvals> 
       <key>authorizationResourceTypes</key> 
       <value>DealnameResourceType</value> 
       <desc>Add comma separated OPSS Resource Types(values) for authorization. 
             Also these resource types should be defined in OPSS. 
             Please note that the key should not be changed here. 
       </desc> 
    </keyvals>

    For more information about updating the CustomConfigurations.xml file, see "Editing the Billing Care Configuration File".

  3. Create a custom view model to define the display of bundles in the Purchase Catalogue screen. See "Creating the Custom Bundle Selection View Model".
  4. Configure Billing Care to use the custom view model that you created. See "Configuring the Custom Bundle Selection View Model in the Registry".
  5. Deploy your customizations using one of the methods described in "Using an Exploded Archive during Customization" or "Packaging and Deploying Customizations".

Creating the Custom Bundle Selection View Model

Billing Care uses view models to define the display of screens in Billing Care. You must create the custom view model, customBundleSectionViewModel, containing the details to customize the display of bundles in the Purchase Catalogue screen for additional purchase.

See "About View Models" for more information about Billing Care view models.

To create the custom bundle selection view model:

  1. Create the customBundleSectionViewModel.js file in myproject/web/custom/viewmodels/purchase directory, where myproject is the folder containing your NetBeans IDE project.
  2. Add the following code in the customBundleSectionViewModel.js file using a text editor:
    define(['knockout', 
        'jquery', 
        'underscore', 
        Registry.accountCreation.wizardBase, 
        'viewmodels/purchase/BundleSelectionViewModel'
        ], 
           function(ko, $, _, WizardBaseViewModel, BundleSelectionViewModel) { 
              customBundleSelectionViewModel.prototype = new WizardBaseViewModel(); 
              function customBundleSelectionViewModel(params) { 
                 BundleSelectionViewModel.apply(this, arguments); 
                 var self = this; 
                 self.filterDealsList = function(loadedData) { 
                    1. call the function util.getGrantedActionsByResource("DealNameResource") and store its return 
                       value in an array (eg. arr). 
                    2. make a set and store array in set. 
                    3. run a loop from var i =0 to i = loadedData.bundle.length and check the value of loadedData.bundle[i].name in set. 
                    4. if value is not present in set then remove it from loadedData.bundle also. 
                    5. return the modified loadedData . 
                 }; 
              } 
              return customBundleSelectionViewModel; 
           ); 
  3. Save the file in your NetBeans IDE project.

Configuring the Custom Bundle Selection View Model in the Registry

After creating the required custom view model, create a custom bundle selection view model entry in the customRegistry.js file. Billing Care uses the custom bundle selection module instead of the default view model during additional purchase and renders the Purchase Catalogue screen containing your customization.

To create the custom bundle selection view model entry in the registry:

  1. Create a customRegistry.js file in your myproject/web/custom/ directory.

  2. Define the custom event adjustment module in this file. For example:

    var CustomRegistry = {
       purchaseSelection: { 
          bundleviewmodel: 'custom/viewmodels/purchase/customBundleSectionViewModel.js' 
       }
    }; 
  3. Save the file in your NetBeans IDE project.