/** Home perspective for the current user */
public class UserHomePerspective implements IPerspectiveFactory {
- public final static String ID = WorkbenchUiPlugin.PLUGIN_ID
- + ".userHomePerspective";
+ public final static String ID = WorkbenchUiPlugin.PLUGIN_ID + ".userHomePerspective";
public void createInitialLayout(IPageLayout layout) {
String editorArea = layout.getEditorArea();
layout.setEditorAreaVisible(true);
layout.setFixed(false);
- IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT,
- 0.30f, editorArea);
+ IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT, 0.30f, editorArea);
left.addView(UserProfile.ID);
left.addView(LogView.ID);
}
-
}
private class MyUserTableViewer extends LdifUsersTable {
private static final long serialVersionUID = 8467999509931900367L;
- private boolean showSystemRoles = false;
+ private boolean showSystemRoles;
private final String[] knownProps = { LdapAttrs.uid.name(),
LdapAttrs.cn.name(), LdapAttrs.DN };
final Button showSystemRoleBtn = new Button(staticFilterCmp,
SWT.CHECK);
showSystemRoleBtn.setText("Show system roles");
+ showSystemRoles = CurrentUser.isInRole(NodeConstants.ROLE_ADMIN);
+ showSystemRoleBtn.setSelection(showSystemRoles);
+
showSystemRoleBtn.addSelectionListener(new SelectionAdapter() {
private static final long serialVersionUID = -7033424592697691676L;
import org.eclipse.jface.viewers.ViewerFilter;
import org.osgi.service.useradmin.User;
+/**
+ * Filter user list using JFace mechanism on the client (yet on the server) side
+ * rather than having the UserAdmin to process the search
+ */
public class UserFilter extends ViewerFilter {
private static final long serialVersionUID = 5082509381672880568L;
private String searchString;
private boolean showSystemRole = true;
- private final String[] knownProps = { LdapAttrs.DN, LdapAttrs.cn.name(),
- LdapAttrs.givenName.name(), LdapAttrs.sn.name(),
- LdapAttrs.uid.name(), LdapAttrs.description.name(),
- LdapAttrs.mail.name() };
+ private final String[] knownProps = { LdapAttrs.DN, LdapAttrs.cn.name(), LdapAttrs.givenName.name(),
+ LdapAttrs.sn.name(), LdapAttrs.uid.name(), LdapAttrs.description.name(), LdapAttrs.mail.name() };
public void setSearchText(String s) {
// ensure that the value can be used for matching
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
User user = (User) element;
- if (!showSystemRole
- && user.getName().matches(
- ".*(" + NodeConstants.ROLES_BASEDN + ")"))
+ if (!showSystemRole && user.getName().matches(".*(" + NodeConstants.ROLES_BASEDN + ")"))
// UserAdminUtils.getProperty(user, LdifName.dn.name())
// .toLowerCase().endsWith(AuthConstants.ROLES_BASEDN))
return false;
for (String key : knownProps) {
String currVal = UserAdminUtils.getProperty(user, key);
- if (notEmpty(currVal)
- && currVal.toLowerCase().matches(searchString))
+ if (notEmpty(currVal) && currVal.toLowerCase().matches(searchString))
return true;
}
return false;