What's new

Closed User's role restriction in React JS

Status
Not open for further replies.

Zyzz

Forum Guru
Joined
Dec 7, 2017
Posts
5,309
Reaction
2,513
Points
1,429
What is better in terms of handling user's role (Admin, Superadmin, User) restriction in Single Page Application (SPA) like React JS?

Option 1: All users will be redirected to a single route and hide the restricted component(s) based on their user's role.

Option 2: Each user will be redirected to a designated route based on their user's role.

Why your chosen option is better than another?

If you have any option(s) or suggestion(s) feel free to share. 🙂
 
Last edited:
Option 1 will only be a better choice if all Roles almost share the same UI with some minimal features hidden and is not available from a User role perspective; otherwise option 2 should be used if you have something like Dashboard and Analytics page with subroutes that only superadmin / admin are authorized to see and operate.
 
really dependent sa content ng app mo.

Option 1 and 2 are both great.

Gaya ng sabi ng dalawang lods, options1 ( most common approach ) . Hide na lng ng ibang fields etc.

Sa ibang requirement kse, dapat may sariling admin page, iba yung itsura (if more on adding content sa actual view ng normal user ).
 
Status
Not open for further replies.

Similar threads

Back
Top