Return-Path: X-Original-To: apmail-syncope-commits-archive@www.apache.org Delivered-To: apmail-syncope-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 02F7F17CD2 for ; Tue, 21 Apr 2015 09:33:35 +0000 (UTC) Received: (qmail 99353 invoked by uid 500); 21 Apr 2015 09:33:31 -0000 Delivered-To: apmail-syncope-commits-archive@syncope.apache.org Received: (qmail 99268 invoked by uid 500); 21 Apr 2015 09:33:31 -0000 Mailing-List: contact commits-help@syncope.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@syncope.apache.org Delivered-To: mailing list commits@syncope.apache.org Received: (qmail 98538 invoked by uid 99); 21 Apr 2015 09:33:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Apr 2015 09:33:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 20A65E0D64; Tue, 21 Apr 2015 09:33:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ilgrosso@apache.org To: commits@syncope.apache.org Date: Tue, 21 Apr 2015 09:33:53 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [24/57] syncope git commit: [SYNCOPE-119] Renaming Role to Group http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDetailsPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDetailsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDetailsPanel.java deleted file mode 100644 index 03d2e75..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleDetailsPanel.java +++ /dev/null @@ -1,435 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.syncope.client.console.panels; - -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.commons.JexlHelpUtil; -import org.apache.syncope.client.console.pages.RoleSelectModalPage; -import org.apache.syncope.client.console.pages.UserOwnerSelectModalPage; -import org.apache.syncope.client.console.panels.AttrTemplatesPanel.RoleAttrTemplatesChange; -import org.apache.syncope.client.console.panels.AttrTemplatesPanel.Type; -import org.apache.syncope.client.console.rest.RoleRestClient; -import org.apache.syncope.client.console.rest.UserRestClient; -import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel; -import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel; -import org.apache.syncope.common.lib.to.RoleTO; -import org.apache.syncope.common.lib.to.UserTO; -import org.apache.syncope.common.lib.types.AttributableType; -import org.apache.wicket.Page; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; -import org.apache.wicket.ajax.markup.html.AjaxLink; -import org.apache.wicket.event.Broadcast; -import org.apache.wicket.event.IEvent; -import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink; -import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.panel.Fragment; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.PropertyModel; -import org.apache.wicket.spring.injection.annot.SpringBean; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RoleDetailsPanel extends Panel { - - private static final long serialVersionUID = 855618618337931784L; - - /** - * Logger. - */ - protected static final Logger LOG = LoggerFactory.getLogger(RoleDetailsPanel.class); - - @SpringBean - private UserRestClient userRestClient; - - @SpringBean - private RoleRestClient roleRestClient; - - private final Fragment parentFragment; - - private final WebMarkupContainer ownerContainer; - - private final OwnerModel userOwnerModel; - - private final OwnerModel roleOwnerModel; - - private ParentModel parentModel; - - public RoleDetailsPanel(final String id, final RoleTO roleTO, final boolean templateMode) { - super(id); - - ownerContainer = new WebMarkupContainer("ownerContainer"); - ownerContainer.setOutputMarkupId(true); - this.add(ownerContainer); - - final ModalWindow userOwnerSelectWin = new ModalWindow("userOwnerSelectWin"); - userOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); - userOwnerSelectWin.setCookieName("create-userOwnerSelect-modal"); - this.add(userOwnerSelectWin); - final ModalWindow roleOwnerSelectWin = new ModalWindow("roleOwnerSelectWin"); - roleOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); - roleOwnerSelectWin.setCookieName("create-roleOwnerSelect-modal"); - this.add(roleOwnerSelectWin); - final ModalWindow parentSelectWin = new ModalWindow("parentSelectWin"); - parentSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); - parentSelectWin.setCookieName("create-parentSelect-modal"); - this.add(parentSelectWin); - - if (templateMode) { - parentFragment = new Fragment("parent", "parentFragment", this); - - parentModel = new ParentModel(roleTO); - @SuppressWarnings("unchecked") - final AjaxTextFieldPanel parent = new AjaxTextFieldPanel("parent", "parent", parentModel); - parent.setReadOnly(true); - parent.setOutputMarkupId(true); - parentFragment.add(parent); - final AjaxLink parentSelect = new IndicatingAjaxLink("parentSelect") { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target) { - parentSelectWin.setPageCreator(new ModalWindow.PageCreator() { - - private static final long serialVersionUID = -7834632442532690940L; - - @Override - public Page createPage() { - return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin, - ParentSelectPayload.class); - } - }); - parentSelectWin.show(target); - } - }; - parentFragment.add(parentSelect); - final IndicatingAjaxLink parentReset = new IndicatingAjaxLink("parentReset") { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target) { - parentModel.setObject(null); - target.add(parent); - } - }; - parentFragment.add(parentReset); - } else { - parentFragment = new Fragment("parent", "emptyFragment", this); - } - parentFragment.setOutputMarkupId(true); - this.add(parentFragment); - - final AjaxTextFieldPanel name = - new AjaxTextFieldPanel("name", "name", new PropertyModel(roleTO, "key")); - - final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp"); - - final AjaxLink questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp"); - this.add(questionMarkJexlHelp); - questionMarkJexlHelp.add(jexlHelp); - - if (!templateMode) { - name.addRequiredLabel(); - questionMarkJexlHelp.setVisible(false); - } - this.add(name); - - userOwnerModel = new OwnerModel(roleTO, AttributableType.USER); - @SuppressWarnings("unchecked") - final AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel("userOwner", "userOwner", userOwnerModel); - userOwner.setReadOnly(true); - userOwner.setOutputMarkupId(true); - ownerContainer.add(userOwner); - final AjaxLink userOwnerSelect = new IndicatingAjaxLink("userOwnerSelect") { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target) { - userOwnerSelectWin.setPageCreator(new ModalWindow.PageCreator() { - - private static final long serialVersionUID = -7834632442532690940L; - - @Override - public Page createPage() { - return new UserOwnerSelectModalPage(getPage().getPageReference(), userOwnerSelectWin); - } - }); - userOwnerSelectWin.show(target); - } - }; - ownerContainer.add(userOwnerSelect); - final IndicatingAjaxLink userOwnerReset = new IndicatingAjaxLink("userOwnerReset") { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target) { - userOwnerModel.setObject(null); - target.add(userOwner); - } - }; - ownerContainer.add(userOwnerReset); - - roleOwnerModel = new OwnerModel(roleTO, AttributableType.ROLE); - @SuppressWarnings("unchecked") - final AjaxTextFieldPanel roleOwner = new AjaxTextFieldPanel("roleOwner", "roleOwner", roleOwnerModel); - roleOwner.setReadOnly(true); - roleOwner.setOutputMarkupId(true); - ownerContainer.add(roleOwner); - final AjaxLink roleOwnerSelect = new IndicatingAjaxLink("roleOwnerSelect") { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target) { - parentSelectWin.setPageCreator(new ModalWindow.PageCreator() { - - private static final long serialVersionUID = -7834632442532690940L; - - @Override - public Page createPage() { - return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin, - RoleOwnerSelectPayload.class); - } - }); - parentSelectWin.show(target); - } - }; - ownerContainer.add(roleOwnerSelect); - final IndicatingAjaxLink roleOwnerReset = new IndicatingAjaxLink("roleOwnerReset") { - - private static final long serialVersionUID = -7978723352517770644L; - - @Override - public void onClick(final AjaxRequestTarget target) { - roleOwnerModel.setObject(null); - target.add(roleOwner); - } - }; - ownerContainer.add(roleOwnerReset); - - final AjaxCheckBoxPanel inhOwner = new AjaxCheckBoxPanel("inheritOwner", "inheritOwner", - new PropertyModel(roleTO, "inheritOwner")); - this.add(inhOwner); - - final AjaxCheckBoxPanel inhTemplates = new AjaxCheckBoxPanel("inheritTemplates", "inheritTemplates", - new PropertyModel(roleTO, "inheritTemplates")); - inhTemplates.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { - - private static final long serialVersionUID = -1107858522700306810L; - - @Override - protected void onUpdate(final AjaxRequestTarget target) { - send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rPlainAttrTemplates, target)); - send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rDerAttrTemplates, target)); - send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rVirAttrTemplates, target)); - } - }); - this.add(inhTemplates); - } - - /** - * This is waiting for events from opened modal windows: first to get the selected user / role, then to update the - * respective text panel. - * - * {@inheritDoc } - */ - @Override - public void onEvent(final IEvent event) { - super.onEvent(event); - - if (event.getPayload() instanceof ParentSelectPayload) { - parentModel.setObject(((ParentSelectPayload) event.getPayload()).getRoleId()); - } - if (event.getPayload() instanceof UserOwnerSelectPayload) { - userOwnerModel.setObject(((UserOwnerSelectPayload) event.getPayload()).getUserId()); - } - if (event.getPayload() instanceof RoleOwnerSelectPayload) { - roleOwnerModel.setObject(((RoleOwnerSelectPayload) event.getPayload()).getRoleId()); - } - - if (event.getPayload() instanceof AjaxRequestTarget) { - ((AjaxRequestTarget) event.getPayload()).add(parentFragment); - ((AjaxRequestTarget) event.getPayload()).add(ownerContainer); - } - } - - private class OwnerModel implements IModel { - - private static final long serialVersionUID = -3865621970810102714L; - - private final RoleTO roleTO; - - private final AttributableType type; - - public OwnerModel(final RoleTO roleTO, final AttributableType type) { - this.roleTO = roleTO; - this.type = type; - } - - @Override - public Object getObject() { - String object = null; - - switch (type) { - case USER: - if (roleTO.getUserOwner() != null) { - UserTO user = null; - try { - user = userRestClient.read(roleTO.getUserOwner()); - } catch (Exception e) { - LOG.warn("Could not find user with id {}, ignoring", roleTO.getUserOwner(), e); - } - if (user == null) { - roleTO.setUserOwner(null); - } else { - object = user.getKey() + " " + user.getUsername(); - } - } - break; - - case ROLE: - RoleTO role = null; - if (roleTO.getRoleOwner() != null) { - try { - role = roleRestClient.read(roleTO.getRoleOwner()); - } catch (Exception e) { - LOG.warn("Could not find role with id {}, ignoring", roleTO.getRoleOwner(), e); - } - if (role == null) { - roleTO.setRoleOwner(null); - } else { - object = role.getDisplayName(); - } - } - break; - - case MEMBERSHIP: - default: - } - - return object; - } - - @Override - public void setObject(final Object object) { - switch (type) { - case USER: - roleTO.setUserOwner((Long) object); - break; - - case ROLE: - roleTO.setRoleOwner((Long) object); - break; - - case MEMBERSHIP: - default: - } - } - - @Override - public void detach() { - // ignore - } - } - - private class ParentModel implements IModel { - - private static final long serialVersionUID = 1006546156848990721L; - - private final RoleTO roleTO; - - public ParentModel(final RoleTO roleTO) { - this.roleTO = roleTO; - } - - @Override - public Object getObject() { - Object object = null; - if (roleTO.getParent() != 0) { - RoleTO parent = null; - try { - parent = roleRestClient.read(roleTO.getParent()); - } catch (Exception e) { - LOG.warn("Could not find role with id {}, ignoring", roleTO.getParent(), e); - } - if (parent == null) { - roleTO.setParent(0); - } else { - object = parent.getDisplayName(); - } - } - return object; - } - - @Override - public void setObject(final Object object) { - roleTO.setParent((object instanceof Long) ? ((Long) object) : 0); - } - - @Override - public void detach() { - // ignore - } - } - - public static class UserOwnerSelectPayload { - - private final Long userId; - - public UserOwnerSelectPayload(final Long userId) { - this.userId = userId; - } - - public Long getUserId() { - return userId; - } - } - - public static class RoleOwnerSelectPayload { - - private final Long roleId; - - public RoleOwnerSelectPayload(final Long roleId) { - this.roleId = roleId; - } - - public Long getRoleId() { - return roleId; - } - } - - public static class ParentSelectPayload { - - private final Long roleId; - - public ParentSelectPayload(final Long roleId) { - this.roleId = roleId; - } - - public Long getRoleId() { - return roleId; - } - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RolePanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RolePanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RolePanel.java deleted file mode 100644 index da04397..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RolePanel.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.syncope.client.console.panels; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import org.apache.syncope.client.console.commons.Mode; -import org.apache.syncope.client.console.commons.XMLRolesReader; -import org.apache.syncope.client.console.commons.status.StatusBean; -import org.apache.syncope.client.console.rest.AuthRestClient; -import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel; -import org.apache.syncope.client.console.wicket.markup.html.form.AjaxPalettePanel; -import org.apache.syncope.common.lib.to.RoleTO; -import org.apache.wicket.PageReference; -import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.model.PropertyModel; -import org.apache.wicket.model.util.ListModel; -import org.apache.wicket.spring.injection.annot.SpringBean; - -public class RolePanel extends Panel { - - private static final long serialVersionUID = 4216376097320768369L; - - @SpringBean - private AuthRestClient authRestClient; - - @SpringBean - private XMLRolesReader xmlRolesReader; - - private final AjaxPalettePanel entitlements; - - public static class Builder implements Serializable { - - private static final long serialVersionUID = 8150440254654306070L; - - private String id; - - private Form form; - - private RoleTO roleTO; - - private Mode mode; - - private PageReference pageReference; - - public Builder(final String id) { - this.id = id; - } - - public Builder form(final Form form) { - this.form = form; - return this; - } - - public Builder roleTO(final RoleTO roleTO) { - this.roleTO = roleTO; - return this; - } - - public Builder roleModalPageMode(final Mode mode) { - this.mode = mode; - return this; - } - - public Builder pageRef(final PageReference pageReference) { - this.pageReference = pageReference; - return this; - } - - public RolePanel build() { - return new RolePanel(this); - } - } - - private RolePanel(final Builder builder) { - super(builder.id); - - this.add(new RoleDetailsPanel("details", builder.roleTO, builder.mode == Mode.TEMPLATE)); - - if (builder.pageReference == null || builder.roleTO.getKey() == 0) { - this.add(new Label("statuspanel", "")); - } else { - StatusPanel statusPanel = new StatusPanel( - "statuspanel", builder.roleTO, new ArrayList(), builder.pageReference); - statusPanel.setOutputMarkupId(true); - MetaDataRoleAuthorizationStrategy.authorize( - statusPanel, RENDER, xmlRolesReader.getEntitlement("Resources", "getConnectorObject")); - this.add(statusPanel); - } - - this.add(new AnnotatedBeanPanel("systeminformation", builder.roleTO)); - - //-------------------------------- - // Attribute templates panel - //-------------------------------- - AttrTemplatesPanel attrTemplates = new AttrTemplatesPanel("templates", builder.roleTO); - this.add(attrTemplates); - - //-------------------------------- - // Attributes panel - //-------------------------------- - this.add(new PlainAttrsPanel( - "plainAttrs", builder.roleTO, builder.form, builder.mode, attrTemplates)); - - final AjaxCheckBoxPanel inhAttributes = new AjaxCheckBoxPanel("inheritPlainAttrs", "inheritPlainAttrs", - new PropertyModel(builder.roleTO, "inheritPlainAttrs")); - inhAttributes.setOutputMarkupId(true); - this.add(inhAttributes); - //-------------------------------- - - //-------------------------------- - // Derived attributes panel - //-------------------------------- - this.add(new DerAttrsPanel("derAttrs", builder.roleTO, attrTemplates)); - - final AjaxCheckBoxPanel inhDerivedAttributes = new AjaxCheckBoxPanel("inheritDerAttrs", - "inheritDerAttrs", new PropertyModel(builder.roleTO, "inheritDerAttrs")); - inhDerivedAttributes.setOutputMarkupId(true); - this.add(inhDerivedAttributes); - //-------------------------------- - - //-------------------------------- - // Virtual attributes panel - //-------------------------------- - this.add(new VirAttrsPanel( - "virAttrs", builder.roleTO, builder.mode == Mode.TEMPLATE, attrTemplates)); - - final AjaxCheckBoxPanel inhVirtualAttributes = new AjaxCheckBoxPanel("inheritVirAttrs", - "inheritVirAttrs", new PropertyModel(builder.roleTO, "inheritVirAttrs")); - inhVirtualAttributes.setOutputMarkupId(true); - this.add(inhVirtualAttributes); - //-------------------------------- - - //-------------------------------- - // Resources panel - //-------------------------------- - this.add(new ResourcesPanel.Builder("resources").attributableTO(builder.roleTO).build(). - setOutputMarkupId(true)); - //-------------------------------- - - //-------------------------------- - // Entitlements - //-------------------------------- - ListModel selectedEntitlements = new ListModel(builder.roleTO.getEntitlements()); - - List allEntitlements = authRestClient.getAllEntitlements(); - if (allEntitlements != null && !allEntitlements.isEmpty()) { - Collections.sort(allEntitlements); - } - ListModel availableEntitlements = new ListModel(allEntitlements); - - entitlements = new AjaxPalettePanel("entitlements", selectedEntitlements, availableEntitlements); - this.add(entitlements); - - //-------------------------------- - // Security panel - //-------------------------------- - this.add(new RoleSecurityPanel("security", builder.roleTO).setOutputMarkupId(true)); - //-------------------------------- - } - - public Collection getSelectedEntitlements() { - return this.entitlements.getModelCollection(); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchPanel.java deleted file mode 100644 index c8d9727..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchPanel.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.syncope.client.console.panels; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import org.apache.syncope.client.lib.SyncopeClient; -import org.apache.syncope.common.lib.search.SyncopeFiqlSearchConditionBuilder; -import org.apache.syncope.common.lib.types.AttributableType; -import org.apache.wicket.model.LoadableDetachableModel; - -public class RoleSearchPanel extends AbstractSearchPanel { - - private static final long serialVersionUID = 5757183539269316263L; - - public static class Builder implements Serializable { - - private static final long serialVersionUID = 6308997285778809579L; - - private String id; - - private String fiql = null; - - private boolean required = true; - - public Builder(final String id) { - this.id = id; - } - - public Builder fiql(final String fiql) { - this.fiql = fiql; - return this; - } - - public Builder required(final boolean required) { - this.required = required; - return this; - } - - public RoleSearchPanel build() { - return new RoleSearchPanel(this); - } - } - - private RoleSearchPanel(final Builder builder) { - super(builder.id, AttributableType.ROLE, builder.fiql, builder.required); - } - - @Override - protected void populate() { - super.populate(); - - this.types = new LoadableDetachableModel>() { - - private static final long serialVersionUID = 5275935387613157437L; - - @Override - protected List load() { - final List result = new ArrayList(); - result.add(SearchClause.Type.ATTRIBUTE); - result.add(SearchClause.Type.ENTITLEMENT); - result.add(SearchClause.Type.RESOURCE); - return result; - } - }; - - this.roleNames = new LoadableDetachableModel>() { - - private static final long serialVersionUID = 5275935387613157437L; - - @Override - protected List load() { - return Collections.emptyList(); - } - }; - } - - @Override - protected SyncopeFiqlSearchConditionBuilder getSearchConditionBuilder() { - return SyncopeClient.getRoleSearchConditionBuilder(); - } - -} http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchResultPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchResultPanel.java deleted file mode 100644 index dfd40d5..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSearchResultPanel.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.syncope.client.console.panels; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.pages.ResultStatusModalPage; -import org.apache.syncope.client.console.pages.RoleModalPage; -import org.apache.syncope.client.console.pages.StatusModalPage; -import org.apache.syncope.client.console.rest.AbstractSubjectRestClient; -import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; -import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink.ActionType; -import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; -import org.apache.syncope.common.lib.SyncopeClientException; -import org.apache.syncope.common.lib.to.AbstractAttributableTO; -import org.apache.syncope.common.lib.to.RoleTO; -import org.apache.wicket.Page; -import org.apache.wicket.PageReference; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; -import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; -import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn; -import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn; -import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn; -import org.apache.wicket.markup.repeater.Item; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.ResourceModel; - -public class RoleSearchResultPanel extends AbstractSearchResultPanel { - - private static final long serialVersionUID = -1180593361914008764L; - - private final static String PAGEID = "Roles"; - - public RoleSearchResultPanel(final String id, final boolean filtered, - final String fiql, final PageReference callerRef, final AbstractSubjectRestClient restClient) { - - super(id, filtered, fiql, callerRef, restClient); - initResultTable(); - } - - @Override - protected List> getColumns() { - final List> columns = new ArrayList<>(); - - for (String item : new String[] { "key", "name", "entitlements" }) { - columns.add(new PropertyColumn(new ResourceModel(item, item), item, item)); - } - - columns.add(new AbstractColumn(new ResourceModel("actions", "")) { - - private static final long serialVersionUID = -3503023501954863131L; - - @Override - public String getCssClass() { - return "action"; - } - - @Override - public void populateItem(final Item> cellItem, - final String componentId, final IModel model) { - - final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, page.getPageReference()); - - panel.add(new ActionLink() { - - private static final long serialVersionUID = -3722207913631435501L; - - @Override - public void onClick(final AjaxRequestTarget target) { - statusmodal.setPageCreator(new ModalWindow.PageCreator() { - - private static final long serialVersionUID = -7834632442532690940L; - - @Override - public Page createPage() { - return new StatusModalPage( - page.getPageReference(), statusmodal, (RoleTO) model.getObject()); - } - }); - - statusmodal.show(target); - } - }, ActionLink.ActionType.MANAGE_RESOURCES, PAGEID); - - panel.add(new ActionLink() { - - private static final long serialVersionUID = -3722207913631435501L; - - @Override - public void onClick(final AjaxRequestTarget target) { - editmodal.setPageCreator(new ModalWindow.PageCreator() { - - private static final long serialVersionUID = -7834632442532690940L; - - @Override - public Page createPage() { - return new RoleModalPage( - page.getPageReference(), editmodal, (RoleTO) model.getObject()); - } - }); - - editmodal.show(target); - } - }, ActionLink.ActionType.EDIT, PAGEID); - - panel.add(new ActionLink() { - - private static final long serialVersionUID = -3722207913631435501L; - - @Override - public void onClick(final AjaxRequestTarget target) { - try { - final RoleTO roleTO = (RoleTO) restClient. - delete(model.getObject().getETagValue(), model.getObject().getKey()); - - page.setModalResult(true); - - editmodal.setPageCreator(new ModalWindow.PageCreator() { - - private static final long serialVersionUID = -7834632442532690940L; - - @Override - public Page createPage() { - return new ResultStatusModalPage.Builder(editmodal, roleTO).build(); - } - }); - - editmodal.show(target); - } catch (SyncopeClientException scce) { - error(getString(Constants.OPERATION_ERROR) + ": " + scce.getMessage()); - feedbackPanel.refresh(target); - } - } - }, ActionLink.ActionType.DELETE, PAGEID); - - cellItem.add(panel); - } - }); - - return columns; - } - - @Override - protected Collection getBulkActions() { - return Collections.singletonList(ActionLink.ActionType.DELETE); - } - - @Override - protected String getPageId() { - return PAGEID; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSecurityPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSecurityPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSecurityPanel.java deleted file mode 100644 index b60d1e4..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSecurityPanel.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.syncope.client.console.panels; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.rest.PolicyRestClient; -import org.apache.syncope.client.console.wicket.markup.html.form.AjaxCheckBoxPanel; -import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDropDownChoicePanel; -import org.apache.syncope.common.lib.to.AbstractAttributableTO; -import org.apache.syncope.common.lib.to.AbstractPolicyTO; -import org.apache.syncope.common.lib.types.PolicyType; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.form.ChoiceRenderer; -import org.apache.wicket.markup.html.form.DropDownChoice; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.model.IModel; -import org.apache.wicket.model.LoadableDetachableModel; -import org.apache.wicket.model.PropertyModel; -import org.apache.wicket.spring.injection.annot.SpringBean; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RoleSecurityPanel extends Panel { - - /** - * Logger. - */ - protected static final Logger LOG = LoggerFactory.getLogger(RoleSecurityPanel.class); - - private static final long serialVersionUID = -7982691107029848579L; - - @SpringBean - private PolicyRestClient policyRestClient; - - private IModel> passwordPolicies = null; - - private IModel> accountPolicies = null; - - public RoleSecurityPanel(final String id, final T entityTO) { - super(id); - - setOutputMarkupId(true); - - passwordPolicies = new LoadableDetachableModel>() { - - private static final long serialVersionUID = 5275935387613157437L; - - @Override - protected Map load() { - Map res = new HashMap<>(); - for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.PASSWORD, false)) { - res.put(policyTO.getKey(), policyTO.getDescription()); - } - return res; - } - }; - - accountPolicies = new LoadableDetachableModel>() { - - private static final long serialVersionUID = -2012833443695917883L; - - @Override - protected Map load() { - Map res = new HashMap<>(); - for (AbstractPolicyTO policyTO : policyRestClient.getPolicies(PolicyType.ACCOUNT, false)) { - res.put(policyTO.getKey(), policyTO.getDescription()); - } - return res; - } - }; - - final WebMarkupContainer securityContainer = new WebMarkupContainer("security"); - - securityContainer.setOutputMarkupId(true); - add(securityContainer); - - // ------------------------------- - // Password policy specification - // ------------------------------- - final AjaxDropDownChoicePanel passwordPolicy = new AjaxDropDownChoicePanel("passwordPolicy", - "passwordPolicy", new PropertyModel(entityTO, "passwordPolicy")); - - passwordPolicy.setChoiceRenderer(new PolicyRenderer(PolicyType.PASSWORD)); - - passwordPolicy.setChoices(new ArrayList(passwordPolicies.getObject().keySet())); - - ((DropDownChoice) passwordPolicy.getField()).setNullValid(true); - - securityContainer.add(passwordPolicy); - - final AjaxCheckBoxPanel inhPasswordPolicy = new AjaxCheckBoxPanel("inheritPasswordPolicy", - "inheritPasswordPolicy", new PropertyModel(entityTO, "inheritPasswordPolicy")); - - passwordPolicy.setReadOnly(inhPasswordPolicy.getModelObject()); - - inhPasswordPolicy.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { - - private static final long serialVersionUID = -1107858522700306810L; - - @Override - protected void onUpdate(final AjaxRequestTarget target) { - passwordPolicy.setReadOnly(inhPasswordPolicy.getModelObject()); - target.add(passwordPolicy); - } - }); - - securityContainer.add(inhPasswordPolicy); - // ------------------------------- - - // ------------------------------- - // Account policy specification - // ------------------------------- - final AjaxDropDownChoicePanel accountPolicy = new AjaxDropDownChoicePanel("accountPolicy", - "accountPolicy", new PropertyModel(entityTO, "accountPolicy")); - - accountPolicy.setChoiceRenderer(new PolicyRenderer(PolicyType.ACCOUNT)); - - accountPolicy.setChoices(new ArrayList(accountPolicies.getObject().keySet())); - - ((DropDownChoice) accountPolicy.getField()).setNullValid(true); - - securityContainer.add(accountPolicy); - - final AjaxCheckBoxPanel inhAccountPolicy = new AjaxCheckBoxPanel("inheritAccountPolicy", - "inheritAccountPolicy", new PropertyModel(entityTO, "inheritAccountPolicy")); - accountPolicy.setReadOnly(inhAccountPolicy.getModelObject()); - - inhAccountPolicy.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { - - private static final long serialVersionUID = -1107858522700306810L; - - @Override - protected void onUpdate(final AjaxRequestTarget target) { - accountPolicy.setReadOnly(inhAccountPolicy.getModelObject()); - target.add(accountPolicy); - } - }); - - securityContainer.add(inhAccountPolicy); - // ------------------------------- - } - - private class PolicyRenderer extends ChoiceRenderer { - - private static final long serialVersionUID = 8060500161321947000L; - - private PolicyType type; - - public PolicyRenderer(final PolicyType type) { - super(); - this.type = type; - } - - @Override - public Object getDisplayValue(final Long object) { - Object displayValue; - switch (type) { - case ACCOUNT: - displayValue = accountPolicies.getObject().get(object); - break; - case PASSWORD: - displayValue = passwordPolicies.getObject().get(object); - break; - default: - displayValue = ""; - } - return displayValue; - } - - @Override - public String getIdValue(Long object, int index) { - return String.valueOf(object != null - ? object - : 0L); - } - }; -} http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSummaryPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSummaryPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSummaryPanel.java deleted file mode 100644 index d7663be..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleSummaryPanel.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.syncope.client.console.panels; - -import java.io.Serializable; -import org.apache.syncope.client.console.commons.XMLRolesReader; -import org.apache.syncope.client.console.pages.RoleModalPage; -import org.apache.syncope.client.console.rest.RoleRestClient; -import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; -import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; -import org.apache.syncope.common.lib.SyncopeClientException; -import org.apache.syncope.common.lib.to.RoleTO; -import org.apache.wicket.Page; -import org.apache.wicket.PageReference; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; -import org.apache.wicket.markup.html.panel.Fragment; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.model.Model; -import org.apache.wicket.spring.injection.annot.SpringBean; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class RoleSummaryPanel extends Panel { - - private static final long serialVersionUID = 643769814985593156L; - - /** - * Logger. - */ - private static final Logger LOG = LoggerFactory.getLogger(RoleSummaryPanel.class); - - @SpringBean - private XMLRolesReader xmlRolesReader; - - @SpringBean - private RoleRestClient restClient; - - private RoleTO selectedNode; - - public static class Builder implements Serializable { - - private static final long serialVersionUID = 4164563358509351832L; - - private String id; - - private ModalWindow window; - - private PageReference callerPageRef; - - private Long selectedNodeId = null; - - public Builder(final String id) { - this.id = id; - } - - public RoleSummaryPanel.Builder window(final ModalWindow window) { - this.window = window; - return this; - } - - public RoleSummaryPanel.Builder callerPageRef(final PageReference callerPageRef) { - this.callerPageRef = callerPageRef; - return this; - } - - public RoleSummaryPanel.Builder selectedNodeId(final Long selectedNodeId) { - this.selectedNodeId = selectedNodeId; - return this; - } - - public RoleSummaryPanel build() { - return new RoleSummaryPanel(this); - } - } - - private RoleSummaryPanel(final Builder builder) { - super(builder.id); - - if (builder.selectedNodeId == null || builder.selectedNodeId == 0) { - selectedNode = null; - } else { - try { - selectedNode = restClient.read(builder.selectedNodeId); - } catch (SyncopeClientException e) { - LOG.error("Could not read {}", builder.selectedNodeId, e); - selectedNode = null; - builder.selectedNodeId = null; - } - } - - Fragment fragment = new Fragment("roleSummaryPanel", - builder.selectedNodeId == null - ? "fakerootFrag" - : (builder.selectedNodeId == 0 ? "rootPanel" : "roleViewPanel"), - this); - - if (builder.selectedNodeId != null) { - if (builder.selectedNodeId == 0) { - @SuppressWarnings("rawtypes") - final ActionLinksPanel links = new ActionLinksPanel("actionLinks", new Model(), builder.callerPageRef); - links.setOutputMarkupId(true); - fragment.add(links); - - links.addWithRoles(new ActionLink() { - - private static final long serialVersionUID = -3722207913631435501L; - - @Override - public void onClick(final AjaxRequestTarget target) { - builder.window.setPageCreator(new ModalWindow.PageCreator() { - - private static final long serialVersionUID = -7834632442532690940L; - - @Override - public Page createPage() { - return new RoleModalPage(builder.callerPageRef, builder.window, new RoleTO()); - } - }); - - builder.window.show(target); - } - }, ActionLink.ActionType.CREATE, xmlRolesReader.getEntitlement("Roles", "create")); - } else { - RoleTabPanel roleTabPanel = - new RoleTabPanel("nodeViewPanel", selectedNode, builder.window, builder.callerPageRef); - roleTabPanel.setOutputMarkupId(true); - fragment.add(roleTabPanel); - } - } - add(fragment); - } - - public RoleTO getSelectedNode() { - return selectedNode; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleTabPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleTabPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleTabPanel.java deleted file mode 100644 index 7c483b5..0000000 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/RoleTabPanel.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.syncope.client.console.panels; - -import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.commons.Mode; -import org.apache.syncope.client.console.commons.XMLRolesReader; -import org.apache.syncope.client.console.pages.ResultStatusModalPage; -import org.apache.syncope.client.console.pages.RoleModalPage; -import org.apache.syncope.client.console.pages.Roles; -import org.apache.syncope.client.console.pages.StatusModalPage; -import org.apache.syncope.client.console.rest.RoleRestClient; -import org.apache.syncope.client.console.rest.UserRestClient; -import org.apache.syncope.client.console.wicket.ajax.markup.html.ClearIndicatingAjaxButton; -import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; -import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; -import org.apache.syncope.client.lib.SyncopeClient; -import org.apache.syncope.common.lib.SyncopeClientException; -import org.apache.syncope.common.lib.to.RoleTO; -import org.apache.wicket.Page; -import org.apache.wicket.PageReference; -import org.apache.wicket.ajax.AjaxRequestTarget; -import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.Form; -import org.apache.wicket.markup.html.panel.Panel; -import org.apache.wicket.model.CompoundPropertyModel; -import org.apache.wicket.model.Model; -import org.apache.wicket.model.ResourceModel; -import org.apache.wicket.spring.injection.annot.SpringBean; - -public class RoleTabPanel extends Panel { - - private static final long serialVersionUID = 859236186975983959L; - - @SpringBean - private XMLRolesReader xmlRolesReader; - - @SpringBean - private RoleRestClient roleRestClient; - - @SpringBean - private UserRestClient userRestClient; - - @SuppressWarnings({ "unchecked", "rawtypes" }) - public RoleTabPanel(final String id, final RoleTO selectedNode, final ModalWindow window, - final PageReference pageRef) { - - super(id); - - this.add(new Label("displayName", selectedNode.getDisplayName())); - - final ActionLinksPanel links = new ActionLinksPanel("actionLinks", new Model(), pageRef); - links.setOutputMarkupId(true); - this.add(links); - links.addWithRoles(new ActionLink() { - - private static final long serialVersionUID = -3722207913631435501L; - - @Override - public void onClick(final AjaxRequestTarget target) { - window.setPageCreator(new ModalWindow.PageCreator() { - - private static final long serialVersionUID = -7834632442532690940L; - - @Override - public Page createPage() { - RoleTO roleTO = new RoleTO(); - roleTO.setParent(selectedNode.getKey()); - return new RoleModalPage(pageRef, window, roleTO); - } - }); - - window.show(target); - } - }, ActionLink.ActionType.CREATE, xmlRolesReader.getEntitlement("Roles", "create")); - links.addWithRoles(new ActionLink() { - - private static final long serialVersionUID = -3722207913631435501L; - - @Override - public void onClick(final AjaxRequestTarget target) { - window.setPageCreator(new ModalWindow.PageCreator() { - - private static final long serialVersionUID = -7834632442532690940L; - - @Override - public Page createPage() { - return new StatusModalPage(pageRef, window, roleRestClient.read(selectedNode.getKey())); - } - }); - - window.show(target); - } - }, ActionLink.ActionType.MANAGE_RESOURCES, xmlRolesReader.getEntitlement("Roles", "update")); - links.addWithRoles(new ActionLink() { - - private static final long serialVersionUID = -3722207913631435501L; - - @Override - public void onClick(final AjaxRequestTarget target) { - window.setPageCreator(new ModalWindow.PageCreator() { - - private static final long serialVersionUID = -7834632442532690940L; - - @Override - public Page createPage() { - RoleTO roleTO = roleRestClient.read(selectedNode.getKey()); - return new RoleModalPage(pageRef, window, roleTO); - } - }); - - window.show(target); - } - }, ActionLink.ActionType.EDIT, xmlRolesReader.getEntitlement("Roles", "update")); - links.addWithRoles(new ActionLink() { - - private static final long serialVersionUID = -3722207913631435501L; - - @Override - public void onClick(final AjaxRequestTarget target) { - try { - final RoleTO roleTO = roleRestClient.delete(selectedNode.getETagValue(), selectedNode.getKey()); - - ((Roles) pageRef.getPage()).setModalResult(true); - - window.setPageCreator(new ModalWindow.PageCreator() { - - private static final long serialVersionUID = -7834632442532690940L; - - @Override - public Page createPage() { - return new ResultStatusModalPage.Builder(window, roleTO).build(); - } - }); - - window.show(target); - } catch (SyncopeClientException e) { - error(getString(Constants.OPERATION_ERROR) + ": " + e.getMessage()); - ((Roles) pageRef.getPage()).getFeedbackPanel().refresh(target); - } - } - }, ActionLink.ActionType.DELETE, xmlRolesReader.getEntitlement("Roles", "delete")); - - final Form form = new Form("roleForm"); - form.setModel(new CompoundPropertyModel(selectedNode)); - form.setOutputMarkupId(true); - - final RolePanel rolePanel = new RolePanel.Builder("rolePanel").form(form).roleTO(selectedNode). - roleModalPageMode(Mode.ADMIN).build(); - rolePanel.setEnabled(false); - form.add(rolePanel); - - final WebMarkupContainer userListContainer = new WebMarkupContainer("userListContainer"); - - userListContainer.setOutputMarkupId(true); - userListContainer.setEnabled(true); - userListContainer.add(new UserSearchResultPanel("userList", true, null, pageRef, userRestClient)); - userListContainer.add(new ClearIndicatingAjaxButton("search", new ResourceModel("search"), pageRef) { - - private static final long serialVersionUID = -958724007591692537L; - - @Override - protected void onSubmitInternal(final AjaxRequestTarget target, final Form form) { - userListContainer.replace(new UserSearchResultPanel("userList", - true, - SyncopeClient.getUserSearchConditionBuilder().hasRoles(selectedNode.getKey()).query(), - pageRef, - userRestClient)); - - target.add(userListContainer); - } - }); - - form.add(userListContainer); - add(form); - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/SearchView.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SearchView.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SearchView.java index b432d82..c081cd3 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SearchView.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SearchView.java @@ -52,7 +52,7 @@ public class SearchView extends ListView { private final IModel> dnames; - private final IModel> roleNames; + private final IModel> groupNames; private final IModel> resourceNames; @@ -64,7 +64,7 @@ public class SearchView extends ListView { final IModel> types, final IModel> anames, final IModel> dnames, - final IModel> roleNames, + final IModel> groupNames, final IModel> resourceNames, final IModel> entitlements) { @@ -75,7 +75,7 @@ public class SearchView extends ListView { this.types = types; this.anames = anames; this.dnames = dnames; - this.roleNames = roleNames; + this.groupNames = groupNames; this.resourceNames = resourceNames; this.entitlements = entitlements; } @@ -290,7 +290,7 @@ public class SearchView extends ListView { break; case MEMBERSHIP: - property.setChoices(roleNames); + property.setChoices(groupNames); property.setChoiceRenderer(new IChoiceRenderer() { private static final long serialVersionUID = -4288397951948436434L; http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/SelectOnlyUserSearchResultPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SelectOnlyUserSearchResultPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SelectOnlyUserSearchResultPanel.java index a55db53..efa5a3d 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SelectOnlyUserSearchResultPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SelectOnlyUserSearchResultPanel.java @@ -79,7 +79,7 @@ public class SelectOnlyUserSearchResultPanel extends UserSearchResultPanel { @Override public void onClick(final AjaxRequestTarget target) { send(pageRef.getPage(), Broadcast.BREADTH, - new RoleDetailsPanel.UserOwnerSelectPayload(rowModel.getObject().getKey())); + new GroupDetailsPanel.UserOwnerSelectPayload(rowModel.getObject().getKey())); window.close(target); } }, ActionLink.ActionType.SELECT, "Users"); http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/StatusPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/StatusPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/StatusPanel.java index 4faea4e..fb74065 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/StatusPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/StatusPanel.java @@ -29,7 +29,7 @@ import org.apache.syncope.client.console.commons.status.Status; import org.apache.syncope.client.console.commons.status.StatusBean; import org.apache.syncope.client.console.commons.status.StatusUtils; import org.apache.syncope.client.console.pages.ConnObjectModalPage; -import org.apache.syncope.client.console.rest.RoleRestClient; +import org.apache.syncope.client.console.rest.GroupRestClient; import org.apache.syncope.client.console.rest.UserRestClient; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLinksPanel; @@ -38,7 +38,7 @@ import org.apache.syncope.common.lib.mod.StatusMod; import org.apache.syncope.common.lib.to.AbstractAttributableTO; import org.apache.syncope.common.lib.to.AbstractSubjectTO; import org.apache.syncope.common.lib.to.ConnObjectTO; -import org.apache.syncope.common.lib.to.RoleTO; +import org.apache.syncope.common.lib.to.GroupTO; import org.apache.syncope.common.lib.to.UserTO; import org.apache.wicket.Page; import org.apache.wicket.PageReference; @@ -78,7 +78,7 @@ public class StatusPanel extends Panel implements IHeaderContributor { private UserRestClient userRestClient; @SpringBean - private RoleRestClient roleRestClient; + private GroupRestClient groupRestClient; private final ModalWindow connObjectWin; @@ -107,7 +107,7 @@ public class StatusPanel extends Panel implements IHeaderContributor { connObjectWin.setCookieName("connobject-modal"); add(connObjectWin); - statusUtils = new StatusUtils(subject instanceof RoleTO ? roleRestClient : userRestClient); + statusUtils = new StatusUtils(subject instanceof GroupTO ? groupRestClient : userRestClient); connObjects = statusUtils.getConnectorObjects(subject); @@ -128,8 +128,8 @@ public class StatusPanel extends Panel implements IHeaderContributor { } } syncope.setStatus(syncopeStatus); - } else if (subject instanceof RoleTO) { - syncope.setAccountLink(((RoleTO) subject).getDisplayName()); + } else if (subject instanceof GroupTO) { + syncope.setAccountLink(((GroupTO) subject).getDisplayName()); syncope.setStatus(Status.ACTIVE); } @@ -137,11 +137,10 @@ public class StatusPanel extends Panel implements IHeaderContributor { initialStatusBeanMap.put(syncope.getResourceName(), syncope); for (ConnObjectWrapper entry : connObjects) { - final StatusBean statusBean = statusUtils.getStatusBean( - entry.getAttributable(), + final StatusBean statusBean = statusUtils.getStatusBean(entry.getAttributable(), entry.getResourceName(), entry.getConnObjectTO(), - subject instanceof RoleTO); + subject instanceof GroupTO); initialStatusBeanMap.put(entry.getResourceName(), statusBean); statusBeans.add(statusBean); @@ -161,7 +160,7 @@ public class StatusPanel extends Panel implements IHeaderContributor { add(checkGroup); CheckGroupSelector groupSelector = new CheckGroupSelector("groupselector", checkGroup); - if (subject instanceof RoleTO) { + if (subject instanceof GroupTO) { groupSelector.setVisible(false); } add(groupSelector); @@ -175,7 +174,7 @@ public class StatusPanel extends Panel implements IHeaderContributor { item.add(statusUtils.getStatusImage("icon", item.getModelObject().getStatus())); final Check check = new Check("check", item.getModel(), checkGroup); - if (subject instanceof RoleTO) { + if (subject instanceof GroupTO) { check.setVisible(false); } item.add(check); http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/SyncTasksPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/SyncTasksPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/SyncTasksPanel.java index f520391..5561716 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/SyncTasksPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/SyncTasksPanel.java @@ -21,7 +21,7 @@ package org.apache.syncope.client.console.panels; import java.util.ArrayList; import java.util.List; import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.pages.RoleTemplateModalPage; +import org.apache.syncope.client.console.pages.GroupTemplateModalPage; import org.apache.syncope.client.console.pages.SyncTaskModalPage; import org.apache.syncope.client.console.pages.UserTemplateModalPage; import org.apache.syncope.client.console.wicket.extensions.markup.html.repeater.data.table.ActionColumn; @@ -70,8 +70,7 @@ public class SyncTasksPanel extends AbstractProvisioningTasksPanel { syncTaskscolumns.add(new PropertyColumn( new StringResourceModel("latestExecStatus", this, null), "latestExecStatus", "latestExecStatus")); - syncTaskscolumns.add( - new ActionColumn(new StringResourceModel("actions", this, null, "")) { + syncTaskscolumns.add(new ActionColumn(new StringResourceModel("actions", this, null, "")) { private static final long serialVersionUID = 2054811145491901166L; @@ -137,13 +136,13 @@ public class SyncTasksPanel extends AbstractProvisioningTasksPanel { @Override public Page createPage() { - return new RoleTemplateModalPage(pageRef, window, taskTO); + return new GroupTemplateModalPage(pageRef, window, taskTO); } }); window.show(target); } - }, ActionLink.ActionType.ROLE_TEMPLATE, TASKS); + }, ActionLink.ActionType.GROUP_TEMPLATE, TASKS); panel.add(new ActionLink() { http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchPanel.java index 2ca1b94..6618728 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/UserSearchPanel.java @@ -21,10 +21,10 @@ package org.apache.syncope.client.console.panels; import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import org.apache.syncope.client.console.rest.RoleRestClient; +import org.apache.syncope.client.console.rest.GroupRestClient; import org.apache.syncope.client.lib.SyncopeClient; -import org.apache.syncope.common.lib.search.SyncopeFiqlSearchConditionBuilder; -import org.apache.syncope.common.lib.to.RoleTO; +import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder; +import org.apache.syncope.common.lib.to.GroupTO; import org.apache.syncope.common.lib.types.AttributableType; import org.apache.wicket.model.LoadableDetachableModel; import org.apache.wicket.spring.injection.annot.SpringBean; @@ -34,7 +34,7 @@ public class UserSearchPanel extends AbstractSearchPanel { private static final long serialVersionUID = -1769527800450203738L; @SpringBean - private RoleRestClient roleRestClient; + private GroupRestClient groupRestClient; public static class Builder implements Serializable { @@ -87,17 +87,17 @@ public class UserSearchPanel extends AbstractSearchPanel { } }; - this.roleNames = new LoadableDetachableModel>() { + this.groupNames = new LoadableDetachableModel>() { private static final long serialVersionUID = 5275935387613157437L; @Override protected List load() { - List roleTOs = roleRestClient.list(); + List groupTOs = groupRestClient.list(); - List result = new ArrayList(roleTOs.size()); - for (RoleTO role : roleTOs) { - result.add(role.getDisplayName()); + List result = new ArrayList<>(groupTOs.size()); + for (GroupTO group : groupTOs) { + result.add(group.getDisplayName()); } return result; @@ -106,7 +106,7 @@ public class UserSearchPanel extends AbstractSearchPanel { } @Override - protected SyncopeFiqlSearchConditionBuilder getSearchConditionBuilder() { + protected AbstractFiqlSearchConditionBuilder getSearchConditionBuilder() { return SyncopeClient.getUserSearchConditionBuilder(); } http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java index 34d21d5..4a3e103 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/VirAttrsPanel.java @@ -26,8 +26,8 @@ import java.util.Map; import java.util.Set; import java.util.TreeMap; import org.apache.syncope.client.console.commons.Constants; -import org.apache.syncope.client.console.panels.AttrTemplatesPanel.RoleAttrTemplatesChange; -import org.apache.syncope.client.console.rest.RoleRestClient; +import org.apache.syncope.client.console.panels.AttrTemplatesPanel.GroupAttrTemplatesChange; +import org.apache.syncope.client.console.rest.GroupRestClient; import org.apache.syncope.client.console.rest.SchemaRestClient; import org.apache.syncope.client.console.wicket.markup.html.form.AjaxDecoratedCheckbox; import org.apache.syncope.client.console.wicket.markup.html.form.AjaxTextFieldPanel; @@ -35,7 +35,7 @@ import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel import org.apache.syncope.common.lib.to.AbstractAttributableTO; import org.apache.syncope.common.lib.to.AttrTO; import org.apache.syncope.common.lib.to.MembershipTO; -import org.apache.syncope.common.lib.to.RoleTO; +import org.apache.syncope.common.lib.to.GroupTO; import org.apache.syncope.common.lib.to.UserTO; import org.apache.syncope.common.lib.to.VirSchemaTO; import org.apache.syncope.common.lib.types.AttributableType; @@ -69,7 +69,7 @@ public class VirAttrsPanel extends Panel { private SchemaRestClient schemaRestClient; @SpringBean - private RoleRestClient roleRestClient; + private GroupRestClient groupRestClient; private final AttrTemplatesPanel attrTemplates; @@ -105,18 +105,17 @@ public class VirAttrsPanel extends Panel { protected List load() { List schemaTOs; - if (entityTO instanceof RoleTO) { - final RoleTO roleTO = (RoleTO) entityTO; + if (entityTO instanceof GroupTO) { + final GroupTO groupTO = (GroupTO) entityTO; - schemaTOs = schemaRestClient.getVirSchemas(AttributableType.ROLE); + schemaTOs = schemaRestClient.getVirSchemas(AttributableType.GROUP); Set allowed; if (attrTemplates == null) { - allowed = new HashSet(roleTO.getRVirAttrTemplates()); + allowed = new HashSet<>(groupTO.getGVirAttrTemplates()); } else { - allowed = new HashSet(attrTemplates.getSelected( - AttrTemplatesPanel.Type.rVirAttrTemplates)); - if (roleTO.isInheritTemplates() && roleTO.getParent() != 0) { - allowed.addAll(roleRestClient.read(roleTO.getParent()).getRVirAttrTemplates()); + allowed = new HashSet<>(attrTemplates.getSelected(AttrTemplatesPanel.Type.gVirAttrTemplates)); + if (groupTO.isInheritTemplates() && groupTO.getParent() != 0) { + allowed.addAll(groupRestClient.read(groupTO.getParent()).getGVirAttrTemplates()); } } filter(schemaTOs, allowed); @@ -125,7 +124,7 @@ public class VirAttrsPanel extends Panel { } else { schemaTOs = schemaRestClient.getVirSchemas(AttributableType.MEMBERSHIP); Set allowed = new HashSet( - roleRestClient.read(((MembershipTO) entityTO).getRoleId()).getMVirAttrTemplates()); + groupRestClient.read(((MembershipTO) entityTO).getGroupId()).getMVirAttrTemplates()); filter(schemaTOs, allowed); } @@ -285,9 +284,9 @@ public class VirAttrsPanel extends Panel { @Override public void onEvent(final IEvent event) { - if ((event.getPayload() instanceof RoleAttrTemplatesChange)) { - final RoleAttrTemplatesChange update = (RoleAttrTemplatesChange) event.getPayload(); - if (attrTemplates != null && update.getType() == AttrTemplatesPanel.Type.rVirAttrTemplates) { + if ((event.getPayload() instanceof GroupAttrTemplatesChange)) { + final GroupAttrTemplatesChange update = (GroupAttrTemplatesChange) event.getPayload(); + if (attrTemplates != null && update.getType() == AttrTemplatesPanel.Type.gVirAttrTemplates) { update.getTarget().add(this); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java new file mode 100644 index 0000000..91634f2 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/GroupRestClient.java @@ -0,0 +1,184 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.syncope.client.console.rest; + +import java.util.List; + +import javax.ws.rs.core.Response; +import org.apache.syncope.client.console.commons.status.StatusBean; +import org.apache.syncope.client.console.commons.status.StatusUtils; +import org.apache.syncope.common.lib.mod.GroupMod; +import org.apache.syncope.common.lib.to.BulkAction; +import org.apache.syncope.common.lib.to.BulkActionResult; +import org.apache.syncope.common.lib.to.ConnObjectTO; +import org.apache.syncope.common.lib.to.GroupTO; +import org.apache.syncope.common.lib.types.ResourceAssociationActionType; +import org.apache.syncope.common.lib.types.ResourceDeassociationActionType; +import org.apache.syncope.common.lib.types.SubjectType; +import org.apache.syncope.common.lib.wrap.ResourceName; +import org.apache.syncope.common.rest.api.CollectionWrapper; +import org.apache.syncope.common.rest.api.service.ResourceService; +import org.apache.syncope.common.rest.api.service.GroupService; +import org.apache.wicket.extensions.markup.html.repeater.util.SortParam; +import org.springframework.stereotype.Component; + +/** + * Console client for invoking Rest Group's services. + */ +@Component +public class GroupRestClient extends AbstractSubjectRestClient { + + private static final long serialVersionUID = -8549081557283519638L; + + @Override + public int count() { + return getService(GroupService.class).list(1, 1).getTotalCount(); + } + + public List list() { + return getService(GroupService.class).list(1, 1000).getResult(); + } + + @Override + public List list(final int page, final int size, final SortParam sort) { + return getService(GroupService.class).list(page, size, toOrderBy(sort)).getResult(); + } + + @Override + public int searchCount(final String fiql) { + return getService(GroupService.class).search(fiql, 1, 1).getTotalCount(); + } + + @Override + public List search(final String fiql, final int page, final int size, final SortParam sort) { + return getService(GroupService.class).search(fiql, page, size, toOrderBy(sort)).getResult(); + } + + @Override + public ConnObjectTO getConnectorObject(final String resourceName, final Long id) { + return getService(ResourceService.class).getConnectorObject(resourceName, SubjectType.GROUP, id); + } + + public GroupTO create(final GroupTO groupTO) { + Response response = getService(GroupService.class).create(groupTO); + return response.readEntity(GroupTO.class); + } + + public GroupTO read(final Long id) { + return getAnonymousService(GroupService.class).read(id); + } + + public GroupTO update(final String etag, final GroupMod groupMod) { + GroupTO result; + synchronized (this) { + GroupService service = getService(etag, GroupService.class); + result = service.update(groupMod.getKey(), groupMod).readEntity(GroupTO.class); + resetClient(GroupService.class); + } + return result; + } + + @Override + public GroupTO delete(final String etag, final Long id) { + GroupTO result; + synchronized (this) { + GroupService service = getService(etag, GroupService.class); + result = service.delete(id).readEntity(GroupTO.class); + resetClient(GroupService.class); + } + return result; + } + + @Override + public BulkActionResult bulkAction(final BulkAction action) { + return getService(GroupService.class).bulk(action); + } + + public void unlink(final String etag, final long groupId, final List statuses) { + synchronized (this) { + GroupService service = getService(etag, GroupService.class); + service.bulkDeassociation(groupId, ResourceDeassociationActionType.UNLINK, + CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(), + ResourceName.class)); + resetClient(GroupService.class); + } + } + + public void link(final String etag, final long groupId, final List statuses) { + synchronized (this) { + GroupService service = getService(etag, GroupService.class); + service.bulkAssociation(groupId, ResourceAssociationActionType.LINK, + CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(), + ResourceName.class)); + resetClient(GroupService.class); + } + } + + public BulkActionResult deprovision(final String etag, final long groupId, final List statuses) { + BulkActionResult result; + synchronized (this) { + GroupService service = getService(etag, GroupService.class); + result = service.bulkDeassociation(groupId, ResourceDeassociationActionType.DEPROVISION, + CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(), + ResourceName.class)). + readEntity(BulkActionResult.class); + resetClient(GroupService.class); + } + return result; + } + + public BulkActionResult provision(final String etag, final long groupId, final List statuses) { + BulkActionResult result; + synchronized (this) { + GroupService service = getService(etag, GroupService.class); + result = service.bulkAssociation(groupId, ResourceAssociationActionType.PROVISION, + CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(), + ResourceName.class)). + readEntity(BulkActionResult.class); + resetClient(GroupService.class); + } + return result; + } + + public BulkActionResult unassign(final String etag, final long groupId, final List statuses) { + BulkActionResult result; + synchronized (this) { + GroupService service = getService(etag, GroupService.class); + result = service.bulkDeassociation(groupId, ResourceDeassociationActionType.UNASSIGN, + CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(), + ResourceName.class)). + readEntity(BulkActionResult.class); + resetClient(GroupService.class); + } + return result; + } + + public BulkActionResult assign(final String etag, final long groupId, final List statuses) { + BulkActionResult result; + synchronized (this) { + GroupService service = getService(etag, GroupService.class); + result = service.bulkAssociation(groupId, ResourceAssociationActionType.ASSIGN, + CollectionWrapper.wrap(StatusUtils.buildStatusMod(statuses).getResourceNames(), + ResourceName.class)). + readEntity(BulkActionResult.class); + resetClient(GroupService.class); + } + return result; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/4095f1e8/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java index 5ed1f45..2c44211 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java @@ -88,7 +88,7 @@ public class ResourceRestClient extends BaseRestClient { final ResourceDeassociationActionType type, final List subjtectIds) { return getService(ResourceService.class).bulkDeassociation(resourceName, - UserTO.class.isAssignableFrom(typeRef) ? SubjectType.USER : SubjectType.ROLE, + UserTO.class.isAssignableFrom(typeRef) ? SubjectType.USER : SubjectType.GROUP, type, subjtectIds); } }