Open Closed

How to inject RolesManager and permission manager in Module projects #6726


User avatar
0
Sraman created
  • ABP Framework version: v8.0.0
  • UI Type: / MVC
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

I want to fetch list of permissions for the tenant. And also want to set permissions for specific roles. I don’t find role or permissions manager in the module project. But main project has those interface.

How to inject those interface into module projects?


11 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can add PermissionManagement module as a reference to your module, add depends on it modules and inject the IPermissionManager

  • User Avatar
    0
    Sraman created

    Hi,

    I want only the list of roles where I want use those roles list in another entity as select. Already my main project is installed with Identity module. But I'm unable to get the list of roles in my custom module using role manager. How can I do that? What's the best approach?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    But I'm unable to get the list of roles in my custom module using role manager. How can I do that? What's the best approach

    Can you explain this in detail? Do you get any error logs?

  • User Avatar
    0
    Sraman created

    No errors. I have a main project and a custom module project. I need a list of roles in my custom module. How can I do that? Thats the question.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can add Identity module as a reference to your custom module, add depends on it modules and inject the IdentityRoleManager or IIdentityRoleRepository

  • User Avatar
    0
    Sraman created

    On which layer should I add?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    https://docs.abp.io/en/abp/latest/Best-Practices/Module-Architecture

    | Your Module | operator | Identity Module | | --- | --- | --- | .Application | Add reference & Depends on| Identity.Application | .Application.Contracts |Add reference & Depends on|Identity.Application.Contracts| .Domain | Add reference & Depends on| Identity.Domain| .Domain.Shared | Add reference & Depends on| Identity.Domain.Shared| .EntityFrameworkCore | Add reference & Depends on| Identity.EntityFrameworkCore| .HttpApi | Add reference & Depends on|Identity.HttpApi| .HttpApi.Client | Add reference & Depends on| Identity.HttpApi.Client| .Web | Add reference & Depends on| Identity.Web |

  • User Avatar
    0
    Sraman created

    hi

    https://docs.abp.io/en/abp/latest/Best-Practices/Module-Architecture

    | Your Module | operator | Identity Module | | --- | --- | --- | .Application | Add reference & Depends on| Identity.Application | .Application.Contracts |Add reference & Depends on|Identity.Application.Contracts| .Domain | Add reference & Depends on| Identity.Domain| .Domain.Shared | Add reference & Depends on| Identity.Domain.Shared| .EntityFrameworkCore | Add reference & Depends on| Identity.EntityFrameworkCore| .HttpApi | Add reference & Depends on|Identity.HttpApi| .HttpApi.Client | Add reference & Depends on| Identity.HttpApi.Client| .Web | Add reference & Depends on| Identity.Web |

    Hi, Since its already in my existing main project cant I reuse them? Just to get a list of roles should I do this in my module project?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    . I need a list of roles in my custom module.

    If you want to get roles list in your module then you need add Identity module to your module. If you wan to get roles list inyour main project you don't need to do this.

  • User Avatar
    0
    Sraman created

    Hi, I'm getting following error,

    Error CS0433 The type 'AbpIdentityApplicationContractsModule' exists in both 'Volo.Abp.Identity.Application.Contracts, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Volo.Abp.Identity.Pro.Application.Contracts, Version=8.0.0.0, Culture=neutral, PublicKeyToken=null' In2Facts.Portal.Application.Contracts (net8.0), In2Facts.Portal.Application.Contracts (netstandard2.0), In2Facts.Portal.Application.Contracts (netstandard2.1)

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The packages of Identity.Pro are https://abp.io/packages?moduleName=Volo.Identity.Pro

    Please remove the Volo.Abp.Identity packages and use packages of Volo.Identity.Pro

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09