How do you all handle Role based access?
I'm creating a new Next app which will require RBA.
So let's say I have 2 routes for my user roles:
/student/* and /teacher/*
Is it better to handle Authorization to those pages in getServerSideProps and then redirect if the role isn't correct.
Or should I lazy load the main content and then display if the role is right?
E.g. I have a page for showing all tasks. Teachers are supposed to see the tasks only they have created, while students should see all the created tasks. Since both pages show mostly the same components only with some different data, should I make that into 2 routes /students/tasks and /teachers/tasks, and use getSSP like I explained or is it better to just query content depending on role and then when it arrives display it? Or if they aren't logged in at all, show login component.
So let's say I have 2 routes for my user roles:
/student/* and /teacher/*
Is it better to handle Authorization to those pages in getServerSideProps and then redirect if the role isn't correct.
Or should I lazy load the main content and then display if the role is right?
E.g. I have a page for showing all tasks. Teachers are supposed to see the tasks only they have created, while students should see all the created tasks. Since both pages show mostly the same components only with some different data, should I make that into 2 routes /students/tasks and /teachers/tasks, and use getSSP like I explained or is it better to just query content depending on role and then when it arrives display it? Or if they aren't logged in at all, show login component.
