public static boolean hasRole(long userId, String role) {
try {
List<Role> roles = RoleServiceUtil .getUserRoles(u serId);
for (Role tmpRole : roles) {
if (tmpRole.getNam e().equalsIgnor eCase(role)) {
return true;
}
}
} catch (PortalExceptio n e) {
e.printStackTra ce();
}
catch (SystemExceptio n e) {
e.printStackTra ce();
} catch (RemoteExceptio n e) {
e.printStackTra ce();
}
return false;
}
}
try {
List<Role> roles = RoleServiceUtil .getUserRoles(u serId);
for (Role tmpRole : roles) {
if (tmpRole.getNam e().equalsIgnor eCase(role)) {
return true;
}
}
} catch (PortalExceptio n e) {
e.printStackTra ce();
}
catch (SystemExceptio n e) {
e.printStackTra ce();
} catch (RemoteExceptio n e) {
e.printStackTra ce();
}
return false;
}
}
Comment