Hi
take a look at the context object (a global object) and the method getUser(). It will give you a user object (directoryuser) with a lot of nice user-related methods, getRoles() for example.
context.getUser().getRoles().contains("<role>") should solve your problem.
Fredrik