Close

IPermissionProvider

IvanSlater
9 years ago
#8878 Quote
Avatar
  • 89
Hi there!

Could you please include PermissionProvider in all your plugins?

Should be nice allow access to each customer role.

Here is a sample, its is very simple (Replace XXX by plugin name):


namespace Nop.Plugin.XXX.Security
{
    public partial class XXXPermissionProvider : IPermissionProvider
    {
        public static readonly PermissionRecord AccessXXX = new PermissionRecord { Name = "Plugins. XXX", SystemName = "AccessXXX", Category = "Plugin" };




        public virtual IEnumerable<PermissionRecord> GetPermissions()
        {
            return new[] 
            {
                AccessXXX,
            };
        }




        public virtual IEnumerable<DefaultPermissionRecord> GetDefaultPermissions()
        {
            return Enumerable.Empty<DefaultPermissionRecord>();
        }
    }
}



in plugin install and uninstall method, just include:


_permissionService.InstallPermissions(new XXXPermissionProvider());


and 


_permissionService.UninstallPermissions(new XXXPermissionProvider());


Thanks!!!
Boyko
9 years ago
#8889 Quote
Avatar
  • Moderator
  • 1570
IvanSlater wrote:
Hi there!

Could you please include PermissionProvider in all your plugins?

Should be nice allow access to each customer role.

Thanks!!!


Hi Ivan,

Thank you for the suggestion!

I think this needs to be done in the core nopCommerce framework.
This way there will be a way to manage the access to each plugin in nopCommerce out of the box and not every vendor to implement its own mechanism for this.
Regards,
Nop-Templates.com Team
IvanSlater
9 years ago
#8891 Quote
Avatar
  • 89
How to change this code to nop core? 
Boyko
9 years ago
#8892 Quote
Avatar
  • Moderator
  • 1570
IvanSlater wrote:
How to change this code to nop core? 


You don't need to change anything but the nopCommerce team should.
I mean that the nopCommerce framework should handle such scenarios for the plugins. You can suggest this to the nopCommerce team and they can implement it in the next releases. This way not only our plugins but all plugins that you are using will be manageable in the way you want.
Regards,
Nop-Templates.com Team