http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/MultiFieldPanel_pt_BR.properties ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/MultiFieldPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/MultiFieldPanel_pt_BR.properties deleted file mode 100644 index d4f5693..0000000 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/MultiFieldPanel_pt_BR.properties +++ /dev/null @@ -1,22 +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. -minLength=Tamanho m\u00EDnimo de senha -maxLength=Tamanho m\u00E1ximo de senha -historyLength=Tamanho dos hist\u00F3rico de senha -digitRequired=Senha precisa contar um ou mais d\u00EDgitos -prefixesNotPermitted=Prefixos de senha n\u00E3o permitidos -apply=Salvar
http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/NonI18nPalette.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/NonI18nPalette.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/NonI18nPalette.html deleted file mode 100644 index 5800d77..0000000 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/NonI18nPalette.html +++ /dev/null @@ -1,69 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - 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. ---> -<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> - <wicket:panel> - - <div style="display: inline-table;"> - <input type="hidden" wicket:id="recorder"/> - - <div style="display: table-row"> - <div id="choices" style="display: table-cell; text-align: center; font-weight: bold;"> - <span wicket:id="availableHeader">[available header]</span> - </div> - - <div id="buttons" style="display: table-cell;"> - </div> - - <div id="selections" style="display: table-cell; text-align: center; font-weight: bold;"> - <span wicket:id="selectedHeader">[selected header]</span> - </div> - </div> - - <div style="display: table-row"> - <div id="choices" style="display: table-cell;"> - <select class="choicesSelect" style="min-width: 100px;" wicket:id="choices">[choices]</select> - </div> - - <div id="buttons" style="display: table-cell; width: 30px; text-align: center; vertical-align: middle;"> - <div style="padding-bottom: 2px;"> - <a wicket:id="addAllButton"><img src="img/addAll.png" alt="remove icon"/></a> - </div> - <div style="padding-top: 2px; padding-bottom: 2px;"> - <a wicket:id="removeAllButton"><img src="img/removeAll.png" alt="move up icon"/></a> - </div> - <div style="padding-top: 2px; padding-bottom: 2px;"> - <a wicket:id="addButton"><img src="img/add.png" alt="add icon"/></a> - </div> - <div style="padding-top: 2px; padding-bottom: 2px;"> - <a wicket:id="removeButton"><img src="img/remove.png" alt="remove icon"/></a> - </div> - <div style="padding-top: 2px; padding-bottom: 2px;"> - <a wicket:id="moveUpButton"><img src="img/moveUp.png" alt="move up icon"/></a> - </div> - <div style="padding-top: 2px;"> - <a wicket:id="moveDownButton"><img src="img/moveDown.png" alt="move down icon"/></a> - </div> - </div> - - <div id="selections" style="display: table-cell;"> - <select class="selectionSelect" style="min-width: 100px;" wicket:id="selection">[selection]</select> - </div> - </div> - </div> - </wicket:panel> -</html> http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/SpinnerFieldPanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/SpinnerFieldPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/SpinnerFieldPanel.html deleted file mode 100644 index a6f0e51..0000000 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/SpinnerFieldPanel.html +++ /dev/null @@ -1,29 +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. ---> -<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> - <wicket:extend> - <script type="text/javascript" wicket:id="spinnerFieldJS"> - </script> - <div style="display: inline-table;"> - <div style="display: table-cell;"> - <input wicket:id="spinnerField"/> - </div> - </div> - </wicket:extend> -</html> http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/AbstractBinaryPreviewer.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/AbstractBinaryPreviewer.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/AbstractBinaryPreviewer.html deleted file mode 100644 index 81e0797..0000000 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/AbstractBinaryPreviewer.html +++ /dev/null @@ -1,24 +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. ---> -<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> - <wicket:head></wicket:head> - <wicket:panel> - <wicket:child /> - </wicket:panel> -</html> http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryCertPreviewer.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryCertPreviewer.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryCertPreviewer.html deleted file mode 100644 index 9733b29..0000000 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryCertPreviewer.html +++ /dev/null @@ -1,24 +0,0 @@ -<!DOCTYPE html> -<!-- -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. ---> -<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> - <wicket:extend> - <div wicket:id = "certCommonName">[certCommonName]</div> - </wicket:extend> -</html> http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryImagePreviewer.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryImagePreviewer.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryImagePreviewer.html deleted file mode 100644 index 3b891b0..0000000 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/preview/BinaryImagePreviewer.html +++ /dev/null @@ -1,23 +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. ---> -<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> - <wicket:extend> - <div><img wicket:id = "previewImage"/></div> - </wicket:extend> -</html> http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupPanel.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupPanel.html b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupPanel.html deleted file mode 100644 index 0f202e9..0000000 --- a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/tree/TreeGroupPanel.html +++ /dev/null @@ -1,25 +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. ---> -<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> - <wicket:panel> - <div class="groupTable" wicket:id="treeContainer"> - <div wicket:id="treeTable" class="group-tree"/> - </div> - </wicket:panel> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/pom.xml ---------------------------------------------------------------------- diff --git a/client/old_console/pom.xml b/client/old_console/pom.xml new file mode 100644 index 0000000..4b5824b --- /dev/null +++ b/client/old_console/pom.xml @@ -0,0 +1,112 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.syncope</groupId> + <artifactId>syncope-client</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <name>Apache Syncope Client OLD Console</name> + <description>To keep only until the new console is ready, DOES NOT BUILD</description> + <groupId>org.apache.syncope.client</groupId> + <artifactId>syncope-client-old_console</artifactId> + <packaging>jar</packaging> + + <properties> + <rootpom.basedir>${basedir}/../..</rootpom.basedir> + </properties> + + <dependencies> + <dependency> + <groupId>javax.servlet</groupId> + <artifactId>javax.servlet-api</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket</artifactId> + <type>pom</type> + </dependency> + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-extensions</artifactId> + </dependency> + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-datetime</artifactId> + </dependency> + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-spring</artifactId> + <!-- exclude spring framework that wicket pulls in --> + <exclusions> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.wicket</groupId> + <artifactId>wicket-auth-roles</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.syncope.client</groupId> + <artifactId>syncope-client-lib</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + </plugin> + </plugins> + + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + </build> +</project> http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/BinaryPreview.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/BinaryPreview.java b/client/old_console/src/main/java/org/apache/syncope/client/console/BinaryPreview.java new file mode 100644 index 0000000..c499d60 --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/BinaryPreview.java @@ -0,0 +1,34 @@ +/* + * 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; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface BinaryPreview { + + public String[] mimeTypes() default {}; + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/ExtensionPanel.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/ExtensionPanel.java b/client/old_console/src/main/java/org/apache/syncope/client/console/ExtensionPanel.java new file mode 100644 index 0000000..5574926 --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/ExtensionPanel.java @@ -0,0 +1,34 @@ +/* + * 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; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface ExtensionPanel { + + public String value(); + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/SyncopeApplication.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/SyncopeApplication.java b/client/old_console/src/main/java/org/apache/syncope/client/console/SyncopeApplication.java new file mode 100644 index 0000000..a1e781d --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/SyncopeApplication.java @@ -0,0 +1,306 @@ +/* + * 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; + +import java.io.Serializable; +import org.apache.commons.lang3.StringUtils; +import org.apache.syncope.client.console.commons.Constants; +import org.apache.syncope.client.console.commons.XMLRolesReader; +import org.apache.syncope.client.console.pages.Configuration; +import org.apache.syncope.client.console.pages.InfoModalPage; +import org.apache.syncope.client.console.pages.Login; +import org.apache.syncope.client.console.pages.Logout; +import org.apache.syncope.client.console.pages.Reports; +import org.apache.syncope.client.console.pages.Resources; +import org.apache.syncope.client.console.pages.Groups; +import org.apache.syncope.client.console.pages.Schema; +import org.apache.syncope.client.console.pages.Tasks; +import org.apache.syncope.client.console.pages.Todo; +import org.apache.syncope.client.console.pages.UserSelfModalPage; +import org.apache.syncope.client.console.pages.Users; +import org.apache.syncope.client.console.pages.WelcomePage; +import org.apache.syncope.client.console.resources.FilesystemResource; +import org.apache.syncope.client.console.resources.WorkflowDefGETResource; +import org.apache.syncope.client.console.resources.WorkflowDefPUTResource; +import org.apache.syncope.client.console.rest.UserSelfRestClient; +import org.apache.syncope.common.lib.to.UserTO; +import org.apache.wicket.Component; +import org.apache.wicket.Page; +import org.apache.wicket.RestartResponseAtInterceptPageException; +import org.apache.wicket.Session; +import org.apache.wicket.WicketRuntimeException; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.markup.html.AjaxLink; +import org.apache.wicket.authorization.IUnauthorizedComponentInstantiationListener; +import org.apache.wicket.authorization.UnauthorizedInstantiationException; +import org.apache.wicket.authroles.authorization.strategies.role.IRoleCheckingStrategy; +import org.apache.wicket.authroles.authorization.strategies.role.RoleAuthorizationStrategy; +import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.image.Image; +import org.apache.wicket.markup.html.link.BookmarkablePageLink; +import org.apache.wicket.protocol.http.WebApplication; +import org.apache.wicket.request.Request; +import org.apache.wicket.request.Response; +import org.apache.wicket.request.resource.ContextRelativeResource; +import org.apache.wicket.request.resource.IResource; +import org.apache.wicket.request.resource.ResourceReference; +import org.apache.wicket.spring.injection.annot.SpringComponentInjector; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** + * SyncopeApplication class. + */ +public class SyncopeApplication + extends WebApplication + implements IUnauthorizedComponentInstantiationListener, IRoleCheckingStrategy, Serializable { + + private static final long serialVersionUID = -2920378752291913495L; + + public static final String IMG_PREFIX = "/img/menu/"; + + public static final String IMG_NOTSEL = "notsel/"; + + private static final String ACTIVITI_MODELER_CONTEXT = "activiti-modeler"; + + private static final int EDIT_PROFILE_WIN_HEIGHT = 550; + + private static final int EDIT_PROFILE_WIN_WIDTH = 800; + + @Override + protected void init() { + super.init(); + + getComponentInstantiationListeners().add(new SpringComponentInjector(this)); + + getResourceSettings().setThrowExceptionOnMissingResource(true); + + getSecuritySettings().setAuthorizationStrategy(new RoleAuthorizationStrategy(this)); + getSecuritySettings().setUnauthorizedComponentInstantiationListener(this); + + getMarkupSettings().setStripWicketTags(true); + getMarkupSettings().setCompressWhitespace(true); + + getRequestCycleListeners().add(new SyncopeRequestCycleListener()); + + final String activitiModelerDirectory = WebApplicationContextUtils.getWebApplicationContext( + WebApplication.get().getServletContext()).getBean("activitiModelerDirectory", String.class); + mountResource("/" + ACTIVITI_MODELER_CONTEXT, new ResourceReference(ACTIVITI_MODELER_CONTEXT) { + + private static final long serialVersionUID = -128426276529456602L; + + @Override + public IResource getResource() { + return new FilesystemResource(ACTIVITI_MODELER_CONTEXT, activitiModelerDirectory); + } + + }); + mountResource("/workflowDefGET", new ResourceReference("workflowDefGET") { + + private static final long serialVersionUID = -128426276529456602L; + + @Override + public IResource getResource() { + return new WorkflowDefGETResource(); + } + }); + mountResource("/workflowDefPUT", new ResourceReference("workflowDefPUT") { + + private static final long serialVersionUID = -128426276529456602L; + + @Override + public IResource getResource() { + return new WorkflowDefPUTResource(); + } + }); + } + + public void setupNavigationPanel(final WebPage page, final XMLRolesReader xmlRolesReader, final boolean notsel) { + final ModalWindow infoModal = new ModalWindow("infoModal"); + page.add(infoModal); + infoModal.setInitialWidth(350); + infoModal.setInitialHeight(300); + infoModal.setCssClassName(ModalWindow.CSS_CLASS_GRAY); + infoModal.setCookieName("infoModal"); + infoModal.setPageCreator(new ModalWindow.PageCreator() { + + private static final long serialVersionUID = -7834632442532690940L; + + @Override + public Page createPage() { + return new InfoModalPage(); + } + }); + + final AjaxLink<Page> infoLink = new AjaxLink<Page>("infoLink") { + + private static final long serialVersionUID = -7978723352517770644L; + + @Override + public void onClick(final AjaxRequestTarget target) { + infoModal.show(target); + } + }; + page.add(infoLink); + + BookmarkablePageLink<Page> schemaLink = new BookmarkablePageLink<>("schema", Schema.class); + MetaDataRoleAuthorizationStrategy.authorize( + schemaLink, WebPage.ENABLE, xmlRolesReader.getEntitlement("Schema", "list")); + page.add(schemaLink); + schemaLink.add(new Image("schemaIcon", new ContextRelativeResource(IMG_PREFIX + (notsel + ? IMG_NOTSEL + : StringUtils.EMPTY) + "schema" + Constants.PNG_EXT))); + + BookmarkablePageLink<Page> usersLink = new BookmarkablePageLink<>("users", Users.class); + MetaDataRoleAuthorizationStrategy.authorize( + usersLink, WebPage.ENABLE, xmlRolesReader.getEntitlement("Users", "list")); + page.add(usersLink); + usersLink.add(new Image("usersIcon", new ContextRelativeResource(IMG_PREFIX + (notsel + ? IMG_NOTSEL + : StringUtils.EMPTY) + "users" + Constants.PNG_EXT))); + + BookmarkablePageLink<Page> groupsLink = new BookmarkablePageLink<>("groups", Groups.class); + MetaDataRoleAuthorizationStrategy.authorize( + groupsLink, WebPage.ENABLE, xmlRolesReader.getEntitlement("Groups", "list")); + page.add(groupsLink); + groupsLink.add(new Image("groupsIcon", new ContextRelativeResource(IMG_PREFIX + (notsel + ? IMG_NOTSEL + : StringUtils.EMPTY) + "groups" + Constants.PNG_EXT))); + + BookmarkablePageLink<Page> resourcesLink = new BookmarkablePageLink<>("resources", Resources.class); + MetaDataRoleAuthorizationStrategy.authorize( + resourcesLink, WebPage.ENABLE, xmlRolesReader.getEntitlement("Resources", "list")); + page.add(resourcesLink); + resourcesLink.add(new Image("resourcesIcon", new ContextRelativeResource(IMG_PREFIX + (notsel + ? IMG_NOTSEL + : StringUtils.EMPTY) + "resources" + Constants.PNG_EXT))); + + BookmarkablePageLink<Page> todoLink = new BookmarkablePageLink<>("todo", Todo.class); + MetaDataRoleAuthorizationStrategy.authorize( + todoLink, WebPage.ENABLE, xmlRolesReader.getEntitlement("Approval", "list")); + page.add(todoLink); + todoLink.add(new Image("todoIcon", new ContextRelativeResource(IMG_PREFIX + (notsel + ? IMG_NOTSEL + : StringUtils.EMPTY) + "todo" + Constants.PNG_EXT))); + + BookmarkablePageLink<Page> reportLink = new BookmarkablePageLink<>("reports", Reports.class); + MetaDataRoleAuthorizationStrategy.authorize( + reportLink, WebPage.ENABLE, xmlRolesReader.getEntitlement("Reports", "list")); + page.add(reportLink); + reportLink.add(new Image("reportsIcon", new ContextRelativeResource(IMG_PREFIX + (notsel + ? IMG_NOTSEL + : StringUtils.EMPTY) + "reports" + Constants.PNG_EXT))); + + BookmarkablePageLink<Page> configurationLink = new BookmarkablePageLink<>("configuration", + Configuration.class); + MetaDataRoleAuthorizationStrategy.authorize( + configurationLink, WebPage.ENABLE, xmlRolesReader.getEntitlement("Configuration", "list")); + page.add(configurationLink); + configurationLink.add(new Image("configurationIcon", new ContextRelativeResource(IMG_PREFIX + (notsel + ? IMG_NOTSEL + : StringUtils.EMPTY) + "configuration" + Constants.PNG_EXT))); + + BookmarkablePageLink<Page> taskLink = new BookmarkablePageLink<>("tasks", Tasks.class); + MetaDataRoleAuthorizationStrategy.authorize( + taskLink, WebPage.ENABLE, xmlRolesReader.getEntitlement("Tasks", "list")); + page.add(taskLink); + taskLink.add(new Image("tasksIcon", new ContextRelativeResource(IMG_PREFIX + (notsel + ? IMG_NOTSEL + : StringUtils.EMPTY) + "tasks" + Constants.PNG_EXT))); + + page.add(new BookmarkablePageLink<Page>("logout", Logout.class)); + } + + public void setupEditProfileModal(final WebPage page, final UserSelfRestClient userSelfRestClient) { + // Modal window for editing user profile + final ModalWindow editProfileModalWin = new ModalWindow("editProfileModal"); + editProfileModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY); + editProfileModalWin.setInitialHeight(EDIT_PROFILE_WIN_HEIGHT); + editProfileModalWin.setInitialWidth(EDIT_PROFILE_WIN_WIDTH); + editProfileModalWin.setCookieName("edit-profile-modal"); + page.add(editProfileModalWin); + + final AjaxLink<Page> editProfileLink = new AjaxLink<Page>("editProfileLink") { + + private static final long serialVersionUID = -7978723352517770644L; + + @Override + public void onClick(final AjaxRequestTarget target) { + final UserTO userTO; + if (SyncopeSession.get().isAuthenticated()) { + try { + userTO = userSelfRestClient.read(); + } catch (Exception e) { + throw new WicketRuntimeException(e); + } + } else { + userTO = new UserTO(); + } + + editProfileModalWin.setPageCreator(new ModalWindow.PageCreator() { + + private static final long serialVersionUID = -7834632442532690940L; + + @Override + public Page createPage() { + return new UserSelfModalPage(page.getPageReference(), editProfileModalWin, userTO); + } + }); + + editProfileModalWin.show(target); + } + }; + + editProfileLink.add(new Label("username", SyncopeSession.get().getUsername())); + + if ("admin".equals(SyncopeSession.get().getUsername())) { + editProfileLink.setEnabled(false); + } + + page.add(editProfileLink); + } + + @Override + public Session newSession(final Request request, final Response response) { + return new SyncopeSession(request); + } + + @Override + public Class<? extends Page> getHomePage() { + return SyncopeSession.get().isAuthenticated() ? WelcomePage.class : Login.class; + } + + @Override + public void onUnauthorizedInstantiation(final Component component) { + SyncopeSession.get().invalidate(); + + if (component instanceof Page) { + throw new UnauthorizedInstantiationException(component.getClass()); + } + + throw new RestartResponseAtInterceptPageException(Login.class); + } + + @Override + public boolean hasAnyRole(final org.apache.wicket.authroles.authorization.strategies.role.Roles roles) { + return SyncopeSession.get().hasAnyRole(roles); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/SyncopeRequestCycleListener.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/SyncopeRequestCycleListener.java b/client/old_console/src/main/java/org/apache/syncope/client/console/SyncopeRequestCycleListener.java new file mode 100644 index 0000000..8b27260 --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/SyncopeRequestCycleListener.java @@ -0,0 +1,84 @@ +/* + * 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; + +import java.security.AccessControlException; +import javax.ws.rs.BadRequestException; +import javax.xml.ws.WebServiceException; +import org.apache.syncope.client.console.pages.ErrorPage; +import org.apache.syncope.common.lib.SyncopeClientException; +import org.apache.wicket.Page; +import org.apache.wicket.authorization.UnauthorizedInstantiationException; +import org.apache.wicket.core.request.handler.PageProvider; +import org.apache.wicket.core.request.handler.RenderPageRequestHandler; +import org.apache.wicket.markup.html.pages.ExceptionErrorPage; +import org.apache.wicket.model.StringResourceModel; +import org.apache.wicket.protocol.http.PageExpiredException; +import org.apache.wicket.request.IRequestHandler; +import org.apache.wicket.request.cycle.AbstractRequestCycleListener; +import org.apache.wicket.request.cycle.RequestCycle; +import org.apache.wicket.request.mapper.parameter.PageParameters; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SyncopeRequestCycleListener extends AbstractRequestCycleListener { + + /** + * Logger. + */ + private static final Logger LOG = LoggerFactory.getLogger(SyncopeRequestCycleListener.class); + + /** + * {@inheritDoc} + */ + @Override + public IRequestHandler onException(final RequestCycle cycle, final Exception e) { + LOG.error("Exception found", e); + + PageParameters errorParameters = new PageParameters(); + errorParameters.add("errorTitle", new StringResourceModel("alert", null).getString()); + + final Page errorPage; + if (e instanceof UnauthorizedInstantiationException) { + errorParameters.add("errorMessage", + new StringResourceModel("unauthorizedInstantiationException", null).getString()); + + errorPage = new ErrorPage(errorParameters); + } else if (e.getCause() instanceof AccessControlException) { + errorParameters.add("errorMessage", new StringResourceModel("accessControlException", null).getString()); + + errorPage = new ErrorPage(errorParameters); + } else if (e instanceof PageExpiredException || !(SyncopeSession.get()).isAuthenticated()) { + errorParameters.add("errorMessage", new StringResourceModel("pageExpiredException", null).getString()); + + errorPage = new ErrorPage(errorParameters); + } else if (e.getCause() instanceof BadRequestException || e.getCause() instanceof WebServiceException + || e.getCause() instanceof SyncopeClientException) { + + errorParameters.add("errorMessage", new StringResourceModel("restClientException", null).getString()); + + errorPage = new ErrorPage(errorParameters); + } else { + // redirect to default Wicket error page + errorPage = new ExceptionErrorPage(e, null); + } + + return new RenderPageRequestHandler(new PageProvider(errorPage)); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/SyncopeSession.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/SyncopeSession.java b/client/old_console/src/main/java/org/apache/syncope/client/console/SyncopeSession.java new file mode 100644 index 0000000..fc7f7b9 --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/SyncopeSession.java @@ -0,0 +1,185 @@ +/* + * 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; + +import java.text.DateFormat; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import javax.ws.rs.core.EntityTag; +import javax.ws.rs.core.MediaType; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.cxf.jaxrs.client.WebClient; +import org.apache.syncope.client.lib.SyncopeClient; +import org.apache.syncope.client.lib.SyncopeClientFactoryBean; +import org.apache.syncope.common.lib.to.SyncopeTO; +import org.apache.syncope.common.rest.api.service.SyncopeService; +import org.apache.wicket.Session; +import org.apache.wicket.authroles.authorization.strategies.role.Roles; +import org.apache.wicket.protocol.http.WebApplication; +import org.apache.wicket.protocol.http.WebSession; +import org.apache.wicket.request.Request; +import org.springframework.context.ApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** + * Custom Syncope Session class. + */ +public class SyncopeSession extends WebSession { + + private static final long serialVersionUID = 7743446298924805872L; + + public static final List<Locale> SUPPORTED_LOCALES = Arrays.asList(new Locale[] { + Locale.ENGLISH, Locale.ITALIAN, new Locale("pt", "BR") }); + + private String username; + + private String password; + + private String version; + + private Roles roles = new Roles(); + + private final SyncopeClientFactoryBean clientFactory; + + private final String anonymousUser; + + private final String anonymousKey; + + private final SyncopeTO syncopeTO; + + private final Map<Integer, SyncopeClient> clients = + Collections.synchronizedMap(new HashMap<Integer, SyncopeClient>()); + + public static SyncopeSession get() { + return (SyncopeSession) Session.get(); + } + + public SyncopeSession(final Request request) { + super(request); + + final ApplicationContext ctx = WebApplicationContextUtils. + getWebApplicationContext(WebApplication.get().getServletContext()); + + clientFactory = ctx.getBean(SyncopeClientFactoryBean.class). + setContentType(SyncopeClientFactoryBean.ContentType.JSON); + anonymousUser = ctx.getBean("anonymousUser", String.class); + anonymousKey = ctx.getBean("anonymousKey", String.class); + + syncopeTO = clientFactory.create(anonymousUser, anonymousKey).getService(SyncopeService.class).info(); + } + + public SyncopeTO getSyncopeTO() { + return syncopeTO; + } + + public void resetClients() { + clients.clear(); + } + + public <T> T getService(final Class<T> service) { + return getService(service, this.username, this.password); + } + + public <T> T getService(final String etag, final Class<T> service) { + T serviceInstance = getService(service, this.username, this.password); + WebClient.client(serviceInstance).match(new EntityTag(etag), false); + + return serviceInstance; + } + + public <T> void resetClient(final Class<T> service) { + T serviceInstance = getService(service, this.username, this.password); + WebClient.client(serviceInstance).reset(); + } + + public <T> T getService(final MediaType mediaType, final Class<T> serviceClass) { + T service; + + synchronized (clientFactory) { + SyncopeClientFactoryBean.ContentType preType = clientFactory.getContentType(); + + clientFactory.setContentType(SyncopeClientFactoryBean.ContentType.fromString(mediaType.toString())); + service = clientFactory.create(username, password).getService(serviceClass); + clientFactory.setContentType(preType); + } + + return service; + } + + public <T> T getAnonymousService(final Class<T> serviceClass) { + return getService(serviceClass, this.anonymousUser, this.anonymousKey); + } + + public <T> T getService(final Class<T> serviceClass, final String username, final String password) { + final int clientKey = new HashCodeBuilder().append(username).append(password).toHashCode(); + + if (!clients.containsKey(clientKey)) { + clients.put(clientKey, clientFactory.create(username, password)); + } + + return clients.get(clientKey).getService(serviceClass); + } + + public String getUsername() { + return username; + } + + public void setUsername(final String username) { + this.username = username; + } + + public void setPassword(final String password) { + this.password = password; + } + + public String getVersion() { + return version; + } + + public void setVersion(final String version) { + this.version = version; + } + + public void setEntitlements(final String[] entitlements) { + String[] defensiveCopy = entitlements.clone(); + roles = new Roles(defensiveCopy); + } + + public Roles getEntitlements() { + return roles; + } + + public boolean isAuthenticated() { + return getUsername() != null; + } + + public boolean hasAnyRole(final Roles roles) { + return this.roles.hasAnyRole(roles); + } + + public DateFormat getDateFormat() { + final Locale locale = getLocale() == null ? Locale.ENGLISH : getLocale(); + + return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/commons/ActionTableCheckGroup.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/commons/ActionTableCheckGroup.java b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/ActionTableCheckGroup.java new file mode 100644 index 0000000..453e0c0 --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/ActionTableCheckGroup.java @@ -0,0 +1,40 @@ +/* + * 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.commons; + +import java.util.Collection; +import org.apache.wicket.markup.html.form.CheckGroup; +import org.apache.wicket.model.IModel; + +public class ActionTableCheckGroup<T> extends CheckGroup<T> { + + private static final long serialVersionUID = 1288270558573401394L; + + public ActionTableCheckGroup(final String id, final Collection<T> collection) { + super(id, collection); + } + + public ActionTableCheckGroup(final String id, final IModel<Collection<T>> model) { + super(id, model); + } + + public boolean isCheckable(final T element) { + return true; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/commons/AttrLayoutType.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/commons/AttrLayoutType.java b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/AttrLayoutType.java new file mode 100644 index 0000000..26764b4 --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/AttrLayoutType.java @@ -0,0 +1,105 @@ +/* + * 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.commons; + +import java.util.ArrayList; +import java.util.List; +import org.apache.syncope.common.lib.types.AttributableType; + +public enum AttrLayoutType { + + ADMIN_USER("admin.user.layout", Mode.ADMIN, AttributableType.USER), + SELF_USER("self.user.layout", Mode.SELF, AttributableType.USER), + ADMIN_GROUP("admin.group.layout", Mode.ADMIN, AttributableType.GROUP), + SELF_GROUP("self.group.layout", Mode.SELF, AttributableType.GROUP), + ADMIN_MEMBERSHIP("admin.membership.layout", Mode.ADMIN, AttributableType.MEMBERSHIP), + SELF_MEMBERSHIP("self.membership.layout", Mode.SELF, AttributableType.MEMBERSHIP); + + private final String confKey; + + private final Mode mode; + + private final AttributableType attrType; + + AttrLayoutType(final String confKey, final Mode mode, final AttributableType attrType) { + this.confKey = confKey; + this.mode = mode; + this.attrType = attrType; + } + + public String getConfKey() { + return confKey; + } + + public Mode getMode() { + return mode; + } + + public AttributableType getAttrType() { + return attrType; + } + + public static List<String> confKeys() { + List<String> confKeys = new ArrayList<String>(); + for (AttrLayoutType value : values()) { + confKeys.add(value.getConfKey()); + } + + return confKeys; + } + + public static AttrLayoutType valueOf(final Mode mode, final AttributableType attrType) { + AttrLayoutType result = null; + if (mode == Mode.ADMIN) { + switch (attrType) { + case USER: + result = ADMIN_USER; + break; + + case MEMBERSHIP: + result = ADMIN_MEMBERSHIP; + break; + + case GROUP: + result = ADMIN_GROUP; + break; + + default: + } + } else if (mode == Mode.SELF) { + switch (attrType) { + case USER: + result = SELF_USER; + break; + + case MEMBERSHIP: + result = SELF_MEMBERSHIP; + break; + + case GROUP: + result = SELF_GROUP; + break; + + default: + } + } + + return result; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/commons/AttributableDataProvider.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/commons/AttributableDataProvider.java b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/AttributableDataProvider.java new file mode 100644 index 0000000..91a797e --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/AttributableDataProvider.java @@ -0,0 +1,101 @@ +/* + * 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.commons; + +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import org.apache.syncope.client.console.rest.AbstractSubjectRestClient; +import org.apache.syncope.common.lib.to.AbstractAttributableTO; +import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; +import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider; +import org.apache.wicket.model.CompoundPropertyModel; +import org.apache.wicket.model.IModel; + +public class AttributableDataProvider extends SortableDataProvider<AbstractAttributableTO, String> { + + private static final long serialVersionUID = 6267494272884913376L; + + private final SortableAttributableProviderComparator comparator; + + private String fiql = null; + + private final int paginatorRows; + + private final boolean filtered; + + private final AbstractSubjectRestClient restClient; + + public AttributableDataProvider(final AbstractSubjectRestClient restClient, + final int paginatorRows, final boolean filtered) { + + super(); + + this.restClient = restClient; + this.filtered = filtered; + this.paginatorRows = paginatorRows; + + // default sorting + setSort("key", SortOrder.ASCENDING); + + this.comparator = new SortableAttributableProviderComparator(this); + } + + public void setFIQL(final String fiql) { + this.fiql = fiql; + } + + @Override + public Iterator<? extends AbstractAttributableTO> iterator(final long first, final long count) { + List<? extends AbstractAttributableTO> result; + + final int page = ((int) first / paginatorRows); + + if (filtered) { + result = fiql == null + ? Collections.<AbstractAttributableTO>emptyList() + : restClient.search(fiql, (page < 0 ? 0 : page) + 1, paginatorRows, getSort()); + } else { + result = restClient.list((page < 0 ? 0 : page) + 1, paginatorRows, getSort()); + } + + Collections.sort(result, comparator); + return result.iterator(); + } + + @Override + public long size() { + long result; + + if (filtered) { + result = fiql == null + ? 0 + : restClient.searchCount(fiql); + } else { + result = restClient.count(); + } + + return result; + } + + @Override + public IModel<AbstractAttributableTO> model(final AbstractAttributableTO object) { + return new CompoundPropertyModel<>(object); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/commons/CloseOnESCBehavior.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/commons/CloseOnESCBehavior.java b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/CloseOnESCBehavior.java new file mode 100644 index 0000000..f3f939c --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/CloseOnESCBehavior.java @@ -0,0 +1,55 @@ +/* + * 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.commons; + +import org.apache.wicket.Component; +import org.apache.wicket.ajax.AjaxEventBehavior; +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.attributes.AjaxCallListener; +import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; +import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; + +public class CloseOnESCBehavior extends AjaxEventBehavior { + + private static final long serialVersionUID = 5826308247642534260L; + + public CloseOnESCBehavior(final String event) { + super(event); + } + + @Override + protected void onEvent(final AjaxRequestTarget target) { + ModalWindow.closeCurrent(target); + } + + @Override + protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) { + super.updateAjaxAttributes(attributes); + + attributes.getAjaxCallListeners().add(new AjaxCallListener() { + + private static final long serialVersionUID = 7160235486520935153L; + + @Override + public CharSequence getPrecondition(final Component aComponent) { + return " if(Wicket.Event.keyCode(attrs.event) != 27){return false;}"; + } + }); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/commons/ConnIdSpecialAttributeName.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/commons/ConnIdSpecialAttributeName.java b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/ConnIdSpecialAttributeName.java new file mode 100644 index 0000000..3533172 --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/ConnIdSpecialAttributeName.java @@ -0,0 +1,34 @@ +/* + * 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.commons; + +public final class ConnIdSpecialAttributeName { + + public static final String ENABLE = "__ENABLE__"; + + public static final String NAME = "__NAME__"; + + public static final String UID = "__UID__"; + + public static final String PASSWORD = "__PASSWORD__"; + + private ConnIdSpecialAttributeName() { + // private constructor for static utility class + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/commons/Constants.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/commons/Constants.java b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/Constants.java new file mode 100644 index 0000000..0b8391a --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/Constants.java @@ -0,0 +1,110 @@ +/* + * 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.commons; + +public final class Constants { + + public static final String ON_CLICK = "onclick"; + + public static final String ON_CHANGE = "onchange"; + + public static final String ON_BLUR = "onblur"; + + public static final String PNG_EXT = ".png"; + + public static final String FEEDBACK = "feedback"; + + public static final String OPERATION_SUCCEEDED = "operation_succeeded"; + + public static final String OPERATION_ERROR = "operation_error"; + + public static final String SEARCH_ERROR = "search_error"; + + public static final String ERROR = "error"; + + public static final String PARAM_PASSWORD_RESET_TOKEN = "pwdResetToken"; + + public static final String PREF_USERS_DETAILS_VIEW = "users.details.view"; + + public static final String PREF_USERS_ATTRIBUTES_VIEW = "users.attributes.view"; + + public static final String PREF_USERS_DERIVED_ATTRIBUTES_VIEW = "users.derived.attributes.view"; + + public static final String PREF_USERS_VIRTUAL_ATTRIBUTES_VIEW = "users.virtual.attributes.view"; + + public static final String PREF_CONF_SCHEMA_PAGINATOR_ROWS = "conf.schema.paginator.rows"; + + public static final String PREF_USER_PLAIN_SCHEMA_PAGINATOR_ROWS = "user.schema.paginator.rows"; + + public static final String PREF_USER_DER_SCHEMA_PAGINATOR_ROWS = "user.derived.schema.paginator.rows"; + + public static final String PREF_USER_VIR_SCHEMA_PAGINATOR_ROWS = "user.virtual.schema.paginator.rows"; + + public static final String PREF_GROUP_PLAIN_SCHEMA_PAGINATOR_ROWS = "group.schema.paginator.rows"; + + public static final String PREF_GROUP_DER_SCHEMA_PAGINATOR_ROWS = "group.derived.schema.paginator.rows"; + + public static final String PREF_GROUP_VIR_SCHEMA_PAGINATOR_ROWS = "group.virtual.schema.paginator.rows"; + + public static final String PREF_MEMBERSHIP_PLAIN_SCHEMA_PAGINATOR_ROWS = "membership.schema.paginator.rows"; + + public static final String PREF_MEMBERSHIP_DER_SCHEMA_PAGINATOR_ROWS = "membership.derived.aschema.paginator.rows"; + + public static final String PREF_MEMBERSHIP_VIR_SCHEMA_PAGINATOR_ROWS = "membership.virtual.aschema.paginator.rows"; + + public static final String PREF_USERS_PAGINATOR_ROWS = "users.paginator.rows"; + + public static final String PREF_RESOURCES_PAGINATOR_ROWS = "resources.paginator.rows"; + + public static final String PREF_CONNECTORS_PAGINATOR_ROWS = "connectors.paginator.rows"; + + public static final String PREF_NOTIFICATION_PAGINATOR_ROWS = "notification.paginator.rows"; + + public static final String PREF_PROPAGATION_TASKS_PAGINATOR_ROWS = "proagationtasks.paginator.rows"; + + public static final String PREF_NOTIFICATION_TASKS_PAGINATOR_ROWS = "notificationtasks.paginator.rows"; + + public static final String PREF_SCHED_TASKS_PAGINATOR_ROWS = "schedtasks.paginator.rows"; + + public static final String PREF_SYNC_TASKS_PAGINATOR_ROWS = "synctasks.paginator.rows"; + + public static final String PREF_TODO_PAGINATOR_ROWS = "todo.paginator.rows"; + + public static final String PREF_REPORT_PAGINATOR_ROWS = "report.paginator.rows"; + + public static final String PAGEPARAM_CREATE = "CREATE"; + + public static final String PAGEPARAM_CURRENT_PAGE = "_current_page"; + + public static final String PREF_POLICY_PAGINATOR_ROWS = "policy.paginator.rows"; + + /** + * ConnId's GuardedString is not in the classpath. + */ + public static final String GUARDED_STRING = "org.identityconnectors.common.security.GuardedString"; + + /** + * ConnId's GuardedByteArray is not in the classpath. + */ + public static final String GUARDED_BYTE_ARRAY = "org.identityconnectors.common.security.GuardedByteArray"; + + private Constants() { + // private constructor for static utility class + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/commons/DateFormatROModel.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/commons/DateFormatROModel.java b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/DateFormatROModel.java new file mode 100644 index 0000000..e72b7d0 --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/DateFormatROModel.java @@ -0,0 +1,50 @@ +/* + * 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.commons; + +import java.util.Date; +import org.apache.syncope.client.console.SyncopeSession; +import org.apache.wicket.model.IModel; +import org.apache.wicket.model.PropertyModel; + +public class DateFormatROModel implements IModel<String> { + + private static final long serialVersionUID = 6677274580927636121L; + + private final PropertyModel model; + + public DateFormatROModel(final PropertyModel model) { + this.model = model; + } + + @Override + public String getObject() { + return model.getObject() == null + ? "" + : SyncopeSession.get().getDateFormat().format((Date) model.getObject()); + } + + @Override + public void setObject(final String object) { + } + + @Override + public void detach() { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/commons/GroupTreeBuilder.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/commons/GroupTreeBuilder.java b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/GroupTreeBuilder.java new file mode 100644 index 0000000..bc7d21b --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/GroupTreeBuilder.java @@ -0,0 +1,128 @@ +/* + * 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.commons; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.DefaultTreeModel; +import javax.swing.tree.TreeModel; +import org.apache.syncope.client.console.rest.GroupRestClient; +import org.apache.syncope.common.lib.to.GroupTO; +import org.springframework.beans.factory.annotation.Autowired; + +public class GroupTreeBuilder { + + @Autowired + private GroupRestClient restClient; + + private final GroupTOComparator comparator = new GroupTOComparator(); + + private List<GroupTO> allGroups; + + private List<GroupTO> getChildGroups(final long parentGroupId, final List<GroupTO> groups) { + List<GroupTO> result = new ArrayList<>(); + for (GroupTO group : groups) { + if (group.getParent() == parentGroupId) { + result.add(group); + } + } + + Collections.sort(result, comparator); + return result; + } + + private void populateSubtree(final DefaultMutableTreeNode subRoot, final List<GroupTO> groups) { + GroupTO group = (GroupTO) subRoot.getUserObject(); + + DefaultMutableTreeNode child; + for (GroupTO subGroupTO : getChildGroups(group.getKey(), groups)) { + child = new DefaultMutableTreeNode(subGroupTO); + subRoot.add(child); + populateSubtree(child, groups); + } + } + + public List<GroupTO> getAllGroups() { + return this.allGroups; + } + + public TreeModel build() { + this.allGroups = this.restClient.list(); + return build(this.allGroups); + } + + public TreeModel build(final List<GroupTO> groups) { + DefaultMutableTreeNode fakeroot = new DefaultMutableTreeNode(new FakeRootGroupTO()); + + populateSubtree(fakeroot, groups); + + return new DefaultTreeModel(fakeroot); + } + + public GroupTO findGroup(final long groupKey) { + GroupTO found = null; + if (getAllGroups() != null) { + for (GroupTO groupTO : getAllGroups()) { + if (groupTO.getKey() == groupKey) { + found = groupTO; + } + } + } + return found; + } + + private static class GroupTOComparator implements Comparator<GroupTO>, Serializable { + + private static final long serialVersionUID = 7085057398406518811L; + + @Override + public int compare(final GroupTO r1, final GroupTO r2) { + if (r1.getKey() < r2.getKey()) { + return -1; + } + if (r1.getKey() == r2.getKey()) { + return 0; + } + + return 1; + } + } + + private static class FakeRootGroupTO extends GroupTO { + + private static final long serialVersionUID = 4839183625773925488L; + + public FakeRootGroupTO() { + super(); + + setKey(0); + setName(""); + setParent(-1); + } + + @Override + public String getDisplayName() { + return ""; + } + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/commons/HttpResourceStream.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/commons/HttpResourceStream.java b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/HttpResourceStream.java new file mode 100644 index 0000000..feeba85 --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/HttpResourceStream.java @@ -0,0 +1,101 @@ +/* + * 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.commons; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import org.apache.commons.lang3.StringUtils; +import org.apache.wicket.util.lang.Bytes; +import org.apache.wicket.util.resource.AbstractResourceStream; +import org.apache.wicket.util.resource.IFixedLocationResourceStream; +import org.apache.wicket.util.resource.ResourceStreamNotFoundException; + +public class HttpResourceStream extends AbstractResourceStream implements IFixedLocationResourceStream { + + private static final long serialVersionUID = 5811207817876330189L; + + private transient InputStream inputStream; + + private String contentType; + + private String location; + + private String filename; + + public HttpResourceStream(final Response response) { + super(); + + Object entity = response.getEntity(); + if (response.getStatusInfo().getStatusCode() == Response.Status.OK.getStatusCode() + && (entity instanceof InputStream)) { + + this.inputStream = (InputStream) entity; + this.contentType = response.getHeaderString(HttpHeaders.CONTENT_TYPE); + this.location = response.getLocation() == null ? null : response.getLocation().toASCIIString(); + String contentDisposition = response.getHeaderString(HttpHeaders.CONTENT_DISPOSITION); + if (StringUtils.isNotBlank(contentDisposition)) { + String[] splitted = contentDisposition.split("="); + if (splitted != null && splitted.length > 1) { + this.filename = splitted[1].trim(); + } + } + } + } + + @Override + public InputStream getInputStream() + throws ResourceStreamNotFoundException { + + return inputStream == null + ? new ByteArrayInputStream(new byte[0]) + : inputStream; + } + + @Override + public Bytes length() { + return inputStream == null + ? Bytes.bytes(0) + : null; + } + + @Override + public void close() throws IOException { + // No need for explict closing + } + + @Override + public String locationAsString() { + return location; + } + + @Override + public String getContentType() { + return contentType == null + ? MediaType.APPLICATION_OCTET_STREAM + : contentType; + } + + public String getFilename() { + return filename; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/commons/JexlHelpUtils.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/commons/JexlHelpUtils.java b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/JexlHelpUtils.java new file mode 100644 index 0000000..b29d180 --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/JexlHelpUtils.java @@ -0,0 +1,61 @@ +/* + * 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.commons; + +import org.apache.wicket.ajax.AjaxRequestTarget; +import org.apache.wicket.ajax.markup.html.AjaxLink; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.link.ExternalLink; + +public final class JexlHelpUtils { + + private static final String JEXL_SYNTAX_URL = "http://commons.apache.org/jexl/reference/syntax.html"; + + private JexlHelpUtils() { + // private constructor for static utility class + } + + public static WebMarkupContainer getJexlHelpWebContainer(final String wicketId) { + final WebMarkupContainer jexlHelp = new WebMarkupContainer(wicketId); + jexlHelp.setVisible(false); + jexlHelp.setOutputMarkupPlaceholderTag(true); + jexlHelp.setOutputMarkupId(true); + jexlHelp.add(new ExternalLink("jexlLink", JEXL_SYNTAX_URL)); + return jexlHelp; + } + + public static AjaxLink<Void> getAjaxLink(final WebMarkupContainer wmc, final String wicketId) { + AjaxLink<Void> questionMarkJexlHelp = new AjaxLink<Void>(wicketId) { + + private static final long serialVersionUID = -1838017408000591382L; + + private boolean toogle = false; + + @Override + public void onClick(final AjaxRequestTarget target) { + // using bitwise inversion as suggested by + // http://pmd.sourceforge.net/pmd-4.2.5/rules/controversial.html#BooleanInversion + toogle ^= true; + wmc.setVisible(toogle); + target.add(wmc); + } + }; + return questionMarkJexlHelp; + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/commons/MapChoiceRenderer.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/commons/MapChoiceRenderer.java b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/MapChoiceRenderer.java new file mode 100644 index 0000000..118db6d --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/MapChoiceRenderer.java @@ -0,0 +1,43 @@ +/* + * 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.commons; + +import java.util.Map; +import org.apache.wicket.markup.html.form.IChoiceRenderer; + +public class MapChoiceRenderer<T, K> implements IChoiceRenderer<T> { + + private static final long serialVersionUID = -7452881117778186644L; + + private final Map<T, K> map; + + public MapChoiceRenderer(final Map<T, K> map) { + this.map = map; + } + + @Override + public Object getDisplayValue(final T key) { + return map.get(key); + } + + @Override + public String getIdValue(final T key, final int index) { + return key.toString(); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/39f8a069/client/old_console/src/main/java/org/apache/syncope/client/console/commons/Mode.java ---------------------------------------------------------------------- diff --git a/client/old_console/src/main/java/org/apache/syncope/client/console/commons/Mode.java b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/Mode.java new file mode 100644 index 0000000..27dad64 --- /dev/null +++ b/client/old_console/src/main/java/org/apache/syncope/client/console/commons/Mode.java @@ -0,0 +1,27 @@ +/* + * 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.commons; + +public enum Mode { + + ADMIN, + SELF, + TEMPLATE; + +}
