Support forum for ASP.NET Zero (https://aspnetzero.com/).
By Ricavir
#31189 @aaron : I'm trying to implement additional property to Permission definition. I've subclassed Permission class with MyPermission. My permission has an additional boolean property called "IsExternal".

How can I create a permission based on MyPermission class ?

Do I need to create a new manager based on PermissionManager (eg: MyPermissionManager) ?
I tried to do so but I'm getting lost with IPermissionDefinitionContext and AppAuthorizationProvider !

Please help, I'm getting around this for days now :shock:
By ismcagdas
#31332 Then, you need to create your own PermissionManager similar to this one https://github.com/aspnetboilerplate/as ... Manager.cs.

Then replace IPermissionManager with your version like below in the PreInitialize method of your core module.

Code: Select allConfiguration.ReplaceService<IPermissionManager, MyPermisisonManager>(DependencyLifeStyle.Singleton);


add a field to AbpSession as explained here https://gist.github.com/ismcagdas/6f2a9 ... 72124d59a1.
Then use this field in GetAllPermissions of your PermissionManager to filter permissions by IsExternal field.
By Ricavir
#31539 @ismcagdas : I tried your solution.

I've created a class called PermissionWithExternal that inherits from permission and adds a property ISExternal.
I've created a PermissionWithExternalManager like you suggested on your previous comment (I've took PermissionMAnager has an example)
I've also created a new PermissionDictionary class to manage PermissionWithExternal class.

Now I'm blocked with AppAuthorizationProvider cause I'm obliged to use createPermission method defined in interface IPermissionDefinitionContext (and this method uses Permission class and not PermissionWithExternal)

Is it possible to change this behavior so that I can create permissions by using my own class PermissionWithExternal ?