X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.e4%2Fsrc%2Forg%2Fargeo%2Fcms%2Fe4%2Fusers%2FGroupsView.java;h=ddad34fd1e59b2bad78a96618d109ab29b0e2837;hb=35dded721530f8bbc368380a7bcce9dec37f56bb;hp=53937c9d773e8fe78a82348fa0c7a5f79e4ed179;hpb=088c1b517a543e935d8ab65c3b2fd2d0269b551d;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms.e4/src/org/argeo/cms/e4/users/GroupsView.java b/org.argeo.cms.e4/src/org/argeo/cms/e4/users/GroupsView.java index 53937c9d7..ddad34fd1 100644 --- a/org.argeo.cms.e4/src/org/argeo/cms/e4/users/GroupsView.java +++ b/org.argeo.cms.e4/src/org/argeo/cms/e4/users/GroupsView.java @@ -1,18 +1,3 @@ -/* - * Copyright (C) 2007-2012 Argeo GmbH - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ package org.argeo.cms.e4.users; import java.util.ArrayList; @@ -22,9 +7,8 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.inject.Inject; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.argeo.cms.ArgeoNames; +import org.argeo.api.cms.CmsConstants; +import org.argeo.api.cms.CmsLog; import org.argeo.cms.CmsException; import org.argeo.cms.auth.CurrentUser; import org.argeo.cms.e4.users.providers.CommonNameLP; @@ -42,9 +26,8 @@ import org.argeo.cms.e4.users.providers.UserDragListener; import org.argeo.eclipse.ui.ColumnDefinition; import org.argeo.eclipse.ui.EclipseUiUtils; import org.argeo.eclipse.ui.parts.LdifUsersTable; -import org.argeo.naming.LdapAttrs; -import org.argeo.naming.LdapObjs; -import org.argeo.node.NodeConstants; +import org.argeo.util.naming.LdapAttrs; +import org.argeo.util.naming.LdapObjs; import org.eclipse.e4.ui.di.Focus; import org.eclipse.e4.ui.workbench.modeling.EPartService; import org.eclipse.e4.ui.workbench.modeling.ESelectionService; @@ -71,8 +54,8 @@ import org.osgi.service.useradmin.UserAdminEvent; import org.osgi.service.useradmin.UserAdminListener; /** List all groups with filter */ -public class GroupsView implements ArgeoNames { - private final static Log log = LogFactory.getLog(GroupsView.class); +public class GroupsView { + private final static CmsLog log = CmsLog.getLog(GroupsView.class); // public final static String ID = WorkbenchUiPlugin.PLUGIN_ID + ".groupsView"; @Inject @@ -171,14 +154,14 @@ public class GroupsView implements ArgeoNames { public MyUserTableViewer(Composite parent, int style) { super(parent, style); - showSystemRoles = CurrentUser.isInRole(NodeConstants.ROLE_ADMIN); + showSystemRoles = CurrentUser.isInRole(CmsConstants.ROLE_ADMIN); } protected void populateStaticFilters(Composite staticFilterCmp) { staticFilterCmp.setLayout(new GridLayout()); final Button showSystemRoleBtn = new Button(staticFilterCmp, SWT.CHECK); showSystemRoleBtn.setText("Show system roles"); - showSystemRoles = CurrentUser.isInRole(NodeConstants.ROLE_ADMIN); + showSystemRoles = CurrentUser.isInRole(CmsConstants.ROLE_ADMIN); showSystemRoleBtn.setSelection(showSystemRoles); showSystemRoleBtn.addSelectionListener(new SelectionAdapter() { @@ -210,8 +193,12 @@ public class GroupsView implements ArgeoNames { if (tmpBuilder.length() > 1) { builder.append("(&(").append(LdapAttrs.objectClass.name()).append("=") .append(LdapObjs.groupOfNames.name()).append(")"); + // hide tokens + builder.append("(!(").append(LdapAttrs.DN).append("=*").append(CmsConstants.TOKENS_BASEDN) + .append("))"); + if (!showSystemRoles) - builder.append("(!(").append(LdapAttrs.DN).append("=*").append(NodeConstants.ROLES_BASEDN) + builder.append("(!(").append(LdapAttrs.DN).append("=*").append(CmsConstants.ROLES_BASEDN) .append("))"); builder.append("(|"); builder.append(tmpBuilder.toString()); @@ -220,10 +207,12 @@ public class GroupsView implements ArgeoNames { if (!showSystemRoles) builder.append("(&(").append(LdapAttrs.objectClass.name()).append("=") .append(LdapObjs.groupOfNames.name()).append(")(!(").append(LdapAttrs.DN).append("=*") - .append(NodeConstants.ROLES_BASEDN).append(")))"); + .append(CmsConstants.ROLES_BASEDN).append("))(!(").append(LdapAttrs.DN).append("=*") + .append(CmsConstants.TOKENS_BASEDN).append(")))"); else - builder.append("(").append(LdapAttrs.objectClass.name()).append("=") - .append(LdapObjs.groupOfNames.name()).append(")"); + builder.append("(&(").append(LdapAttrs.objectClass.name()).append("=") + .append(LdapObjs.groupOfNames.name()).append(")(!(").append(LdapAttrs.DN).append("=*") + .append(CmsConstants.TOKENS_BASEDN).append(")))"); } roles = userAdminWrapper.getUserAdmin().getRoles(builder.toString());