Role-Based Security in the Commerce Manager
Role-Based Security in the Commerce Manager
Overview
Each plugin must extend the "authorizations" extension point defined in the RCP Core plugin, to define the list of permissions that the plugin will use for filtering or modifying the UI based upon the current user's assigned permissions.
Extending the authorizations extension point
Every plugin must maintain a list of all the permissions that it knows about, so that the User Administration and Role Administration screens can assign permissions to roles, and assign those roles to users.
In your plugin's plugin.xml file, you need a new element defined like so:
<!-- Permissions --> <extension point="com.elasticpath.cmclient.core.authorizations"> <permissions> <permission activityId="com.elasticpath.cmclient.fulfillment.authorizations.activity.catalogManagement" key="MANAGE_PRODUCT_PRICING" name="%manageProductPricingPermission.name"> </permission> <permission activityId="com.elasticpath.cmclient.fulfillment.authorizations.activity.catalogManagement" key="MANAGE_PRODUCT_SKU" name="%manageProductsAndSKUsPermission.name"> </permission> ... </permissions> <activity id="com.elasticpath.cmclient.fulfillment.authorizations.activity.catalogManagement" name="%activityPermission.name"> </activity> </extension>
These permission keys should also be kept in a Class file (e.g. CatalogPermissions.java) as constants, similar to the way that ContextIdNames.java is used to keep constant string names for Spring beans. The name attribute references a property in plugin.properties The activityId attribute is used to group permissions in a set of permissions. It should reference an activity defined with the <activity> tag like in the example above.