return false;
}
private SpagoBIUserProfile createSpagoBIUserProfile(String userId) {
logger.debug("IN. userId=" + userId);
SpagoBIUserProfile profile = new SpagoBIUserProfile();
try {
profile.setUniqueIdentifier(userId);
profile.setUserId(userId);
ArrayList roles = new ArrayList();
HashMap userAttributes = new HashMap();
PortalContainer container = PortalContainer.getInstance();
if (container == null) {
ConfigSingleton config = ConfigSingleton.getInstance();
SourceBean securityconfSB = (SourceBean) config
.getAttribute("SPAGOBI.SECURITY.PORTAL-SECURITY-CLASS.CONFIG");
String paramCont = "NAME_PORTAL_APPLICATION";
SecurityProviderUtilities.debug(this.getClass(), "<init(Principal)>", " Use param " + paramCont);
SourceBean paramContSB = (SourceBean) securityconfSB.getAttribute(paramCont);
SecurityProviderUtilities.debug(this.getClass(), "<init(Principal)>",
" Param context name Source Bean " + "retrived: " + paramContSB);
String nameCont = (String) paramContSB.getCharacters();
SecurityProviderUtilities.debug(this.getClass(), "<init(Principal)>", " Use context name " + nameCont);
RootContainer rootCont = RootContainer.getInstance();
SecurityProviderUtilities.debug(this.getClass(), "<init(Principal)>", " Root container retrived: "
+ rootCont);
container = rootCont.getPortalContainer(nameCont);
}
OrganizationService service = (OrganizationService) container
.getComponentInstanceOfType(OrganizationService.class);
// load user roles
Collection tmpRoles = service.getGroupHandler().findGroupsOfUser(userId);
GroupHandler groupHandler = service.getGroupHandler();
SecurityProviderUtilities.debug(this.getClass(), "init", "Group Handler retrived " + groupHandler);
MembershipHandler memberHandler = service.getMembershipHandler();
SecurityProviderUtilities.debug(this.getClass(), "init", "Membership Handler retrived " + memberHandler);
Group group = null;
Matcher matcher = null;
for (Iterator it = tmpRoles.iterator(); it.hasNext();) {
group = (Group) it.next();
String groupID = group.getId();
Pattern pattern = SecurityProviderUtilities.getFilterPattern();
matcher = pattern.matcher(groupID);
if (!matcher.find()) {
continue;
}
roles.add(group.getId());
logger.debug("Roles load into SpagoBI profile: " + group.getId());
}
// start load profile attributes
userAttributes = SecurityProviderUtilities.getUserProfileAttributes(userId, service);
logger.debug("Attributes load into SpagoBI profile: " + userAttributes);
// end load profile attributes
profile.setAttributes(userAttributes);
if (roles.size()==0){
logger.warn("THE LIST OF ROLES IS EMPTY, CHECK THE PROFILING CONFIGURATION...");
}else {
String[] roleStr = new String[roles.size()];
for (int i = 0; i < roles.size(); i++) {
roleStr[i] = (String) roles.get(i);
}
profile.setRoles(roleStr);
}
} catch (Exception e) {
logger.error("Exception", e);
}finally{