I know how to map users to roles via tomcat-users.xml, and also how to
deny access to particular servlets in this way. However, what I'd
like to do is be able to, programmatically, from within the servlet,
perform different actions based on what roles the current user has
been assigned. ( Specifically, I want to display a "delete" button on
the webpage iff an "admin" role has been granted. )
Any way to do this? If not, any workaround for checking for the user
name directly? ( although this is a substandard hack )
Thanks,
Isaac
nobody - 04 Feb 2004 00:20 GMT
> I know how to map users to roles via tomcat-users.xml, and also how to
> deny access to particular servlets in this way. However, what I'd
> like to do is be able to, programmatically, from within the servlet,
> perform different actions based on what roles the current user has
> been assigned. ( Specifically, I want to display a "delete" button on
> the webpage iff an "admin" role has been granted. )
if (request.isUserInRole("admin")) {
// do admin stuff.
}
> Any way to do this? If not, any workaround for checking for the user
> name directly? ( although this is a substandard hack )
>
> Thanks,
>
> Isaac