}
return xRoles.toArray(new XRole[0]);
}
public Boolean [] hasRoles(String sessionId, XUser xuser, String [] roles) throws SessionExpiredException {
AdministrationService adminService = ServiceProvider
.getAdministrationService(getLoggedInUser(sessionId));
Boolean [] result = new Boolean[roles.length];
for (int i = 0; i < roles.length; i++) {
result[i] = false;
}
User user = getNative(sessionId, xuser);
for (Role r: adminService.getRoles(user)) {
for (int i = 0; i < roles.length; i++) {
if (r.getName().equalsIgnoreCase(roles[i])) {
result[i] = true;
}
}
}
for (Group g: adminService.getGroups(user)) {
for (Role r: g.getRoles()) {
for (int i = 0; i < roles.length; i++) {
if (r.getName().equalsIgnoreCase(roles[i])) {
result[i] = true;
}