Add ACL permissions through plugin installation.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
How would I add a new ACL permission through a plugin's installation?
5 years ago
1) In your plugin, go to the file where your install and uninstall methods are. In there, implement the
    IPermissionService interface.
2) Create a new PermissionRecord
    i.e. public static readonly PermissionRecord NAME_OF_YOUR_PERMISSION = new PermissionRecord { Name = "NAME OF YOUR PERMISSION", SystemName = "NAME_OF_YOUR_PERMISSION", Category = "Standard" };
3) In your install method add  _permissionService.InsertPermissionRecord(NAME_OF_YOUR_PERMISSION_RECORD);
   PS: Add the same line of code to your uninstall method, but use DeletePermissionRecord instead.
4) Now you should be able to install your plugin through Nop's UI, and when you do, you'll be able to see your new ACL

**** Extra ****
If you are modifing an existing plugin, you'll need to uninstall it first. I personally had to go to the "installedPlugins.json" file and remove the plugin from that list as well.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.