Giter VIP home page Giter VIP logo

Comments (3)

JonPSmith avatar JonPSmith commented on July 21, 2024 1

Hi @Arazesh,

Here is how I would implement this:

  1. I would create Roles for each of the features you want to turn on or off. These Roles should be TenantAutoAdd type Roles (see this section of the AuthP docs).
  2. I would create some code to add/remove these feature Roles to a Tenant. To do this you need two methods from the IAuthTenantAdminService. NOTE: These methods needs the TenantId to define what tenant you are changing.
    • Use GetRoleNamesForTenantsAsync to get the current tenant roles
    • Add/remove the current feature Roles
    • Then use UpdateTenantRolesAsync to update the changed tenant Roles.
  3. I would add a Role to make the code in step 2 can only be used by certain users, i.e. tenant admin users
  4. Finally I would add the Role in step 3 to the tenant admin, either during sign on or by the App admin.

I hope that helps.

from authpermissions.aspnetcore.

JonPSmith avatar JonPSmith commented on July 21, 2024

Hi @Arazesh,

The AuthP's Roles are designed allow access to various pages / WebAPI in the application. If a tenant user could create a Role, then they could create a Role that allows them to delete other tenant's data. Therefore tenant user's aren't allowed to create Roles.

From what you say it sounds that you want each tenant to be pick want features in their Tenant. You can do this using the Sign up for a new tenant, with versioning - see this article for a better overview.

The "Sign up for a new tenant, with versioning" examples have simple differences, but there is no reason that you could create a list of features that they pick from instead. You would need to create a code to turn picked features into the format that the ISignInAndCreateTenant needs.

The "Sign up for a new tenant, with versioning" means that the Tenant owner has to decide on signing in, which means they can't thing later. You have two options for changing the tenant's Role in an existing Tenant are:

  • Simple: The App Admin adds/removes the tenant's TenantRoles manually.
  • Complex: You create code that allows the tenant admin to change the TenantRoles within their Tenant.

from authpermissions.aspnetcore.

Arazesh avatar Arazesh commented on July 21, 2024

Hi JonPSmith,

Thanks for the advice

This is exactly what I need
"Complex: You create code that allows the tenant admin to change the TenantRoles within their Tenant."

So , I want to do these things

1- Create a new roletype called TenantCustomeRole

2- Add an attribute to the permissions so that tenant admins can only choose from them "TenantCustomeRoleAttribute"

3- Add IDataKeyFilterReadWrite to the RoleToPermissions table so that if the DataKey has value , it will be applied only to this tenant. (I'm not sure about this , maybe it's better to create a new table)

Do you think this is the right solution or is there a better solution?

from authpermissions.aspnetcore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.