31 Restricting Additional Bundles Purchase Based on Roles

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

About Restricting Bundles

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

Restricting Bundles Based on Roles

You can customize the Purchase Catalogue screen using the Billing Care SDK and Oracle Entitlements Server (OES) to display bundles for additional purchase based on CSR roles or permissions.

To restrict bundles displayed for additional purchase:

  1. Define a new ResourceType and Resource for bundles in the OES Server. For example, DealNameResourceType, DealNameResource.

  2. Add the new ResourceType to the CustomConfigurations.xml file. For example:

    <keyvals> 
    <key>authorizationResourceTypes</key> 
    <value>DealnameResourceType</value> 
    <desc>Add comma separated OES Resource Types(values) for authorization. 
    Also these resource types should be defined in OES. 
    Please note that the key should not be changed here. 
    </desc> 
    </keyvals>
    
  3. Create a custom view model to define the display of bundles in Purachse Catalogue screen. See "Creating the Custom Bundle Selection View Model" for more information.

  4. Create a customRegistry.js file to configure Billing Care to use the custom view model that you created. See "Configuring the Custom Bundle Selection View Model in the Registry" for more information.

  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 model to define the display of the 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 myproject/web/custom/ directory.

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

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