return nameList;
}
private void controlPannels(boolean userSelecteed)
{
TabbedPanel panel = (TabbedPanel) get("tabs");
ITab tab;
panel.getTabs().clear();
boolean guestUserSelected;
if (userSelecteed)
{
if (principalType.getName().equals(JetspeedPrincipalType.USER))
{
String adminRole = getServiceLocator().getPortalConfiguration().getString(PortalConfigurationConstants.ROLES_DEFAULT_ADMIN);
boolean disableAdminEdit = true;
try
{
if (getPortletRequest().isUserInRole(adminRole) || !((RoleManager)getRoleManager()).isUserInRole(principal.getName(), adminRole))
{
disableAdminEdit = false;
}
}
catch (SecurityException e)
{
// ignore
}
if (disableAdminEdit)
{
return;
}
}
else if (principalType.getName().equals(JetspeedPrincipalType.ROLE))
{
String adminRole = getServiceLocator().getPortalConfiguration().getString(PortalConfigurationConstants.ROLES_DEFAULT_ADMIN);
if (principal.getName().equals(adminRole) && !getPortletRequest().isUserInRole(adminRole))
{
// disallow maintenance on admin role
return;
}
}
guestUserSelected = (principalType.getName().equals(JetspeedPrincipalType.USER) &&
principal.getName().equals(((UserManager)getManager()).getAnonymousUser()));
if (!guestUserSelected)
{
// if guest user: don't show status panel
tab = new AbstractTab(new Model("Status"))
{
public Panel getPanel(String panelId)
{
return new PrincipalStatusPanel(panelId);
}
};
panel.getTabs().add(tab);
}
tab = new AbstractTab(new Model("Associations"))
{
public Panel getPanel(String panelId)
{
return new PrincipalAssociationsPanel(panelId);
}
};
panel.getTabs().add(tab);
tab = new AbstractTab(new Model("Attributes"))
{
public Panel getPanel(String panelId)
{
return new PrincipalAttributesPanel(panelId);
}
};
panel.getTabs().add(tab);
if (!guestUserSelected && principalType.getName().equals(JetspeedPrincipalType.USER))
{
tab = new AbstractTab(new Model("Credentials"))
{
public Panel getPanel(String panelId)
{
return new PrincipalCredentialsPanel(panelId);
}
};
panel.getTabs().add(tab);
}
if (principalType.getName().equals(JetspeedPrincipalType.USER))
{
tab = new AbstractTab(new Model("User Profile"))
{
public Panel getPanel(String panelId)
{
return new UserPrincipalProfilePanel(panelId);
}
};
panel.getTabs().add(tab);
}
panel.setSelectedTab(0);
} else
{
if (principalType.getName().equals(JetspeedPrincipalType.USER))
{
tab = new AbstractTab(new Model("New "
+ principalType.getName().toUpperCase()))
{
public Panel getPanel(String panelId)
{
return new NewUserPrincipalPanel(panelId);
}
};
} else
{
tab = new AbstractTab(new Model("New "
+ principalType.getName().toUpperCase()))
{
public Panel getPanel(String panelId)
{
return new NewPrincipalPanel(panelId);
}
};
}
panel.getTabs().add(tab);
panel.setSelectedTab(0);
}
}