Comments (1)
My understanding is that you want to set multiple user access levels.
Currently you can only restrict access to pages based on if a user is logged in or not.
Please see:
If you wish to add additional user access rights, you would need to extend the existing functionality.
For example, if you would like to create ‘user’ and ‘admin’ level access I would suggest the following implementation.
- Add a ‘userLevel’ field to the ‘Users’ schema. This should contain a numerical value for every user that represent their access rights. For example:
0 = basic
1 = admin
You may need to update the registration process to account for this new field.
- Whenever user’s login, we are using a higher order component ‘withSession’ and specifically the ‘GET_CURRENT_USER’ query to fetch user data and pass it as props to the relevant components.
My suggestion would be to update the query referenced above to return the new ‘userLevel’ and then create a new higher order component similar to ‘withAuth’ that restricts access dependant to the ‘userLevel’ and your custom criteria.
I will consider adding this feature for future releases.
from universal-react-apollo-registration.
Related Issues (11)
- Typo in server.js cors options HOT 1
- Is it possible to reverse proxy this application? HOT 6
- Server crashes after visiting home page HOT 1
- Outdated dependencies. Maybe add the lock file? HOT 2
- variable.env HOT 3
- Getting an error when trying to run dev for the first time
- is it ssr? HOT 1
- Babel 7 errors... HOT 2
- Accessing the app remotely HOT 2
- Reloading page cause logout HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from universal-react-apollo-registration.