MVC 5 admin manually changing user roles
Hey guys! So I applied for my first internship, although I didn't finish my studies yet. I got an mvc project and i'm almost done, but there is just one more thing left and i'm completely lost.
Thanks in advance.
Little backstory: I used VS 2017, MVC 5 with individual authorization(when you make a new project you have a choice between no auth, individual, school and windows I think), my first mistake was not building from scratch.
I made all of the requested functionalities but the main topic of this question is:
- Admin having the privilege to see registered users and change their roles(Admin, Employee, Guest).
- Admin having the privilege to delete users.
So yeah, the users in my app get assigned a guest role when they register and I hard coded one admin.
I wrote an SQL Query as an ActionResult in one of the controllers(I'm thinking now that I should probably make a separate controller for these and I will) to list the registered users (picture) and it works. But I lost so much time trying to write a query for changing roles and deleting users. So if you can help, today or tomorrow I would be very happy. How would these queries look like?
It's not as simple as doing it without this bloody auto generated individual authorization. I would build it again without it if i had the time. I would advise opening this individual auth project before answering, but all help is welcome. These are the tables associated with the problem (picture)
Thank you!
0 comments:
Post a Comment