Base solution for your next web application
Open Closed

About Configuration.Authoration #219


User avatar
0
nnlee created

Like title .I'm looking at the document about Authoration. I try to code like the document, but when I coding this "Configuration.Authorization.Providers.Add<MyAuthorizationProvider>();" I cant find how to use this configuration,I cant fine the namespace.Please help me .Thank you


4 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Can you share whole code? Have you defined auth provider? Which version of ABP are you using?

  • User Avatar
    0
    nnlee created

    <cite>hikalkan: </cite> Can you share whole code? Have you defined auth provider? Which version of ABP are you using?

    Version 0.6.2 . And I has upadate it ver 0.6.4 ,but always cant find it. Please help me check it ,thank you very muck

    using Abp;
    using Abp.Authorization;
    namespace Foundation.Application
    {
        public class Permission : AuthorizationProvider
        {
            public override void SetPermissions(IPermissionDefinitionContext context)
            {
                var administrator = context.CreatePermission("Administrator", null);
    
                var userManagement = administrator.CreateChildPermission("Administrator.UserManagement");
    
                userManagement.CreateChildPermission("Administrator.UserManagement.CreateUser");
    
                var roleManagement = administrator.CreateChildPermission("Administrator.RoleManagement");
    
                Configuration.Authorization.Providers.Add<Permission>();
              
                
            }
        }
    }
    
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    You are using Configuration.Authorization.Providers.Add<Permission>(); in the Permission class. It's not true. It should be done in PreInitialize method of your module (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Module-System#DocModulePreInit">http://www.aspnetboilerplate.com/Pages/ ... ulePreInit</a>). Also, "Permission" name is not good, I suggest to change it to MyPermissionProvider or something like that.

  • User Avatar
    0
    nnlee created

    <cite>hikalkan: </cite> Hi,

    You are using Configuration.Authorization.Providers.Add<Permission>(); in the Permission class. It's not true. It should be done in PreInitialize method of your module (<a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Module-System#DocModulePreInit">http://www.aspnetboilerplate.com/Pages/ ... ulePreInit</a>). Also, "Permission" name is not good, I suggest to change it to MyPermissionProvider or something like that.

    Thank a lot ,I just read the module topic ,suddenly figured out ,thanks again patiently answered :D