This is an old revision of the document!
Authentication: Enforce appropriate role
Of course, the @Authenticated
annotations can specify stronger requirements than simply an authenticated user. For example, moving entire lines should only be allowed for supervisors.
Change your aspect to verify that the user is authenticed and holds at least the role specified by the value()
of the @Authenticated
annotation.
@annotation(Var)
primitive pointcut to bind the annotation of a join point to a variable.
You can compare two Role
objects by comparing their ordinal()
values.
Rerun the figure editor to verify your aspect. As before, you should be presented with an authentication dialog when you create a first point. Login as a normal user and create more points and lines. Now try to move a line. At this point, the authentication dialog should return. Change the role to supervisor to continue.
Continue with Exercise 4.