Caplin Trader 4.7.1

Class: module:caplin/services/testing/PermissionServiceStub

module:caplin/services/testing/PermissionServiceStub

The PermissionServiceStub serves to provide a way for tests to stub a caplin.services.security.PermissionService providing trading and view allow or deny permissions on tiles and instruments.

Register a module:caplin/trading/testing/PermissioningServiceStub service on the module:caplin/core/ServiceRegistry under the namespace "caplin.services.security.PermissionService".

Constructor

new module:caplin/services/testing/PermissionServiceStub()

Constructs a PermissionServiceStub.
Implements:

Methods

addRegistrationListener(callback)

Allows the user to register a callback method that will be caled every time addPermissionListener() is called this enable a workbench tool to update its GUI.
Parameters:
Name Type Description
callback function Method to be called any time addPermissionListener is called

allow()

Notifies the appropiate listeners that a permission defined by namespace, product and action is allowed

deny()

Notifies the appropiate listeners that a permission defined by namespace, product and action is denied

setAllPermissionsForProductSets(m_permissionedProducts)

This method allows you to override the existing list of product sets. Product set listeners will be notified about product sets changes.
Parameters:
Name Type Description
m_permissionedProducts Object Product set map. Each key will represent a namespace and its value will be an array of products.

setProductSetsPermissions(namespace, products)

Allows to set product sets permissions. It will callback on the product sets listeners registered for the given namespace.
Parameters:
Name Type Description
namespace String Namespace identifying the product set.
products Array Array of products for the given namespace.