SAP Fiori Client Guide

Feature Restriction Policy

Feature restriction is a client policy that can be defined for SAP Fiori Client and other hybrid apps in SAP Mobile Platform Server or SAP HCP, mobile service for development and operations. Feature restriction policies enable the administrator to control which native device features are available for use by SAP Fiori applications.


Traditionally, web apps run inside a browser that does not allow native device API invocation. With hybrid apps built with frameworks such as Cordova, native APIs are exposed in the JavaScript namespace and can be invoked by the hybrid web application as seamlessly as the ones exposed by the browser. It is also easy to swap the JavaScript code running in the hybrid app with the new version.

While this allows you to control and update the application logic from the server side, the risk of letting SAP Fiori apps call native APIs is a point of concern for IT administrators and security experts. Feature restriction and its related policy address this problem by allowing you to define all features an SAP Fiori application is given access to.


  • SAP Fiori Client for iOS or Android, version 1.5 or later, or a custom SAP Fiori client built with SAP Mobile Platform SDK 3.0 SP10 or later

  • SAP Mobile Platform Server 3.0 SP05 or later, or SAP HCP, mobile service for development and operations

Feature Restriction Policy Definition

When the SAP Mobile Platform administrator defines a hybrid application, he or she may choose to apply feature restrictions for the application. The policy explicitly defines features that are not allowed to be used within the application. Typically these features are JavaScript APIs that provide access to the native APIs of the mobile device (implemented as Apache Cordova plugins). The policy is applied for all SAP Fiori launchpad applications running inside SAP Fiori Client. Application users will not have access to any restricted feature.

To restrict certain features, the administrator should know the Cordova metadata for those features. A Cordova plugin’s metadata lives in the plugin.xml file, which lives in the plugin’s folder.

The feature restriction policy is sent to the device through the Settings Plugin REST API, which is invoked by SAP Fiori Client after user registration and every time the application starts or resumes. Changes to the feature restriction policy are communicated to the application by using the REST API commands GET, PUT, and DELETE.

Feature Restriction Policy Enforcement

The feature restriction policy is enforced by un-defining--that is, making the plugin name space in javascript null. Access to the plugin to the native layer is blocked by the enforcement. For example, if the BarcodeScanner is disabled, the name space cordova.plugins.barcodeScanner will become null. Any attempt to use the barcode scanner by forcefully loading barcode scanner using cordova.require("").scan() will fail to run the native code by blocking access to it. Any attempt to call the barcode scanner by an executable also will fail.

iOS Implementation

On iOS, feature restriction is enforced by using method swizzling. The feature restriction enforcement component is loaded automatically during application startup. The Cordova bridge utilizes a PluginManager object to channel all the javascript-native bridge calls. Feature restriction intercepts the javascript-native call to provide additional checking to avoid calls to any invalidated plugin. On iOS, the feature restriction enforcement code looks like this:

if ([g_disabledPluginsMap objectForKey:pluginName] != nil)
        return nil;
} else { 
        return [self performSelector:@selector(NEW_getCommandInstance:) withObject:pluginName]; 

The g_disabledPluginsMap contains the list of disabled plugins. This list is populated by the Settings plugin when it gets the list of disabled plugins from the SAP Mobile Platform server configuration.

Android Implementation

On Android, feature restriction is enforced by using reflection. With reflection, the existing plugin manager is modified to check the list of disabled plugins. On Android, the feature restriction enforcement code looks like this:
public CordovaPlugin getPlugin(String service)
 if (SettingsExchange.isFeatureEnabled(service))
      return super.getPlugin(service);
 } else {
 SettingsExchange.clientLogger.logError("Plugin "+service+" is disabled by feature vector"); 
return null;

The isFeatureEnabled call checks if the requested plugin is in the list of disabled plugins.