return true;
}
public List<Map<String, Object>> getUserRoles (String userId) throws Exception {
List<Map<String, Object>> roleMaps = new ArrayList<Map<String,Object>>();
Role userRole = APILocator.getRoleAPI().loadRoleByKey(RoleAPI.USERS_ROOT_ROLE_KEY);
UserWebAPI uWebAPI = WebAPILocator.getUserWebAPI();
WebContext ctx = WebContextFactory.get();
HttpServletRequest request = ctx.getHttpServletRequest();
// lock down to users with access to Users portlet
User loggedInUser=uWebAPI.getLoggedInUser(request);
if(loggedInUser==null || !APILocator.getPortletAPI().hasUserAdminRights(loggedInUser)) {
SecurityLogger.logInfo(UserAjax.class, "unauthorized attempt to call getUserRoles by user "+loggedInUser!=null?loggedInUser.getUserId():"[not logged in]");
throw new DotSecurityException("not authorized");
}
if(UtilMethods.isSet(userId)){
RoleAPI roleAPI = APILocator.getRoleAPI();
List<com.dotmarketing.business.Role> roles = roleAPI.loadRolesForUser(userId, false);
for(com.dotmarketing.business.Role r : roles) {
String DBFQN = r.getDBFQN();
if(DBFQN.contains(userRole.getId())) {
continue;
}
roleMaps.add(r.toMap());
}
}