Git Product home page Git Product logo

role-based-access-control's Introduction

Links

Demo App
Medium Story Version-2

Description

The idea is, simply prevent the app to generate unnecessary routes, rather checking current user role on each route it is great to generate only the routes that user have access.

Benefits

  • Check route access only once when parent route renders
  • Generate only routes that user have access
  • Central roles and private routes configuration file
  • Easy to add/remove a role
  • Easy to add/remove route access from user role
  • Synchronization between routes and navigation
  • Single + Multiple role support

TODO

  • Design same approach for components

role-based-access-control's People

Contributors

dependabot[bot] avatar ukhanzada-nisum-com avatar umair-khanzada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

role-based-access-control's Issues

dynamic route

How can we use dynamic url?

<Route path='/data/:tab' component={Data} />

How to prevent users from changing their own roles?

I noticed that after logging in, I am able to use the Chrome Dev tools to change my role (example: GUEST to SUPER_ADMIN)... all I have to do is navigate to any thing in the app and it instantly shows me all the links on the navbar which are available to the new role I entered. What would be a good way to keep this from happening? I wouldn't want them to see any data or perform any actions that they aren't authorized for.

image

Making nested route?

Is there a possible way to make it a nested route?

for example,
Manager can access into '/service/service1' but can't access into '/service/service2' although
SupportManager can access into it.

and '/service' is the main route for them.

How can I achieve this?

Please note that I did tried, by using this example https://reacttraining.com/react-router/web/example/route-config
implementing it in PrivateRoutes.js
but nested routes are not rendering, help?

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.