4
I’m developing an app for a school, where you take control of the students she has. The application makes the registration of students and registration of occurrences (suspension or warning) that the student did. And in that context, I need to login different levels of access.
For example, I need to have three types of profiles: Administrator(who can do everything, total control), Teacher(who can only register and edit new occurrences and view the students' data, but not change or delete them) and Coordinators(who cannot change or delete student data, can only view this data, but can add, edit and delete created occurrences).
I’ve looked in several articles on the subject, but I get more confused, because some use Simplemembershipprovider others use Forms... But my question is: Which implementation would be better and if there is an example I can follow to do this type of authentication in my application ? Would I have to create other views or restrict access to actions ? I wanted your help because I’m new to Asp.net mvc and I don’t know much where to look for something that’s really useful.
Also because I downloaded a booklet, and when you’re going to do the roles, it adds users who can access certain areas at hand, and one is what I want, because at school there are MANY teachers, coordinators, and it would be difficult to maintain this type of code. And ah, remembering that who will add new users is the administrator, because it has all the privileges.
Great approach. Just missed in the code of
Permission
put this comment here://faça aqui de acordo com sua regra de negócio!
– Leonel Sanches da Silva
@Ciganomorrisonmendez, you removed some things that don’t check,
PermissionAttribute
is like this, follows the name of the class, which was created by me, and it has no Alias.– user6026
So, but that’s because you had the spelling mistake I fixed before. From
Atrribute
(with two 'r') toAttribute
. The Framework understands that it is an attribute, so the word can be simply removed.– Leonel Sanches da Silva
@Ciganomorrisonmendez, was made with that name! so I posted so and ratifying did not do the
alias
, could, as it is in my systems, I thought it best to do so so so that the user understands that such a class is aAttribute
, and make correlation, the worst is that you changed in the Methods and Actionresult and left the class with the same name can then give confusion to new users who can see this code, and then wonder why such error already seen that has no alias!!!– user6026
Good, then ok. I had imagined that I was wrong, but if so, no problem. Sorry for the inconvenience.
– Leonel Sanches da Silva
No inconvenience @Ciganomorrisonmendez, I’m just explaining, hope you understand!
– user6026