├── .gitignore ├── LICENSE ├── README.md ├── admin-tools-core ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── de │ │ └── chandre │ │ └── admintool │ │ └── core │ │ ├── AbstractAdminToolLoader.java │ │ ├── AdminTool.java │ │ ├── AdminToolConfig.java │ │ ├── AdminToolCoreConfig.java │ │ ├── AdminToolImpl.java │ │ ├── AdminToolInitializer.java │ │ ├── CustomWebMvcAutoConfig.java │ │ ├── MenuEntrySearchResult.java │ │ ├── component │ │ ├── AdminComponent.java │ │ ├── AdminComponentComparator.java │ │ ├── AdminComponentImpl.java │ │ └── MenuEntry.java │ │ ├── controller │ │ ├── AbstractAdminController.java │ │ └── AdminRootController.java │ │ ├── sec │ │ ├── ATAbstractPermissionHandler.java │ │ ├── ATInitRole.java │ │ ├── ATInitRoleImpl.java │ │ ├── AdminToolCoreRoles.java │ │ └── AdminToolRoles.java │ │ ├── thymeleaf │ │ ├── OrderedClassLoaderResourceResolver.java │ │ ├── OrderedClassLoaderTemplateResolver.java │ │ ├── TemplateUrlComparator.java │ │ └── ThymeleafResolverExtension.java │ │ ├── ui │ │ ├── ATError.java │ │ ├── ATFooterInformation.java │ │ └── select2 │ │ │ ├── OptionGroupTO.java │ │ │ ├── OptionTO.java │ │ │ └── Select2GroupedTO.java │ │ └── utils │ │ ├── AdminToolIntegrityUtil.java │ │ ├── AdminToolMenuUtils.java │ │ ├── ExceptionUtils.java │ │ ├── MenuIntegrityError.java │ │ ├── ReflectUtils.java │ │ └── RegexUtil.java │ ├── resources-filtered │ └── admintool-version.properties │ └── resources │ ├── i18n │ └── admintool │ │ ├── core-messages.properties │ │ └── core-messages_en.properties │ ├── static │ └── admintool │ │ ├── css │ │ ├── adminTool.css │ │ └── awesome-bootstrap-checkbox.css │ │ └── js │ │ ├── adminTool.js │ │ ├── select2-util.js │ │ ├── validation-util.js │ │ └── validator.min.js │ └── templates │ └── admintool │ ├── content │ ├── error.html │ ├── error404.html │ ├── genericError.html │ └── start.html │ ├── deactivated.html │ ├── fragments │ └── fragements.html │ ├── includes │ ├── context.inc.html │ ├── controlSideBar.inc.html │ ├── dropdownUserMenu.inc.html │ ├── footer.inc.html │ ├── header.inc.html │ ├── integrityCheck.inc.html │ ├── js.inc.html │ ├── leftUserPanel.inc.html │ ├── logo.inc.html │ ├── menu.inc.html │ └── searchForm.inc.html │ └── layout │ └── standardLayout.html ├── admin-tools-dbbrowser ├── README.md ├── doc │ ├── screen_dbbrowser_org.png │ └── screen_dbbrowser_org2.png ├── pom.xml └── src │ └── main │ ├── java │ ├── META-INF │ │ └── additional-spring-configuration-metadata.json │ └── de │ │ └── chandre │ │ └── admintool │ │ └── db │ │ ├── AdminToolDBBrowserConfig.java │ │ ├── AdminToolDBBrowserController.java │ │ ├── AdminToolDBBrowserExampleLoader.java │ │ ├── AdminToolDBBrowserLoader.java │ │ ├── AdminToolDBBrowserRoles.java │ │ ├── AdminToolDBBrowserService.java │ │ ├── AdminToolDBBrowserServiceImpl.java │ │ ├── ConnectionVars.java │ │ ├── ExampleStatement.java │ │ ├── ExampleStatements.java │ │ ├── QueryResultTO.java │ │ ├── StatementTO.java │ │ └── Vendor.java │ └── resources │ ├── i18n │ └── admintool │ │ ├── dbbrowser-messages.properties │ │ └── dbbrowser-messages_en.properties │ ├── static │ └── admintool │ │ └── dbbrowser │ │ ├── css │ │ └── dbbrowser.css │ │ └── js │ │ └── dbbrowser.js │ └── templates │ └── admintool │ └── dbbrowser │ ├── content │ └── dbbrowser.html │ └── includes │ └── tabInclude.html ├── admin-tools-demo-core ├── pom.xml └── src │ └── main │ ├── java │ └── de │ │ └── chandre │ │ └── admintool │ │ ├── AdminToolConfiguration.java │ │ ├── Beans.java │ │ ├── DemoController.java │ │ ├── ExampleMXBean.java │ │ ├── ExampleMXBean2.java │ │ ├── QuartzConfig.java │ │ ├── jobs │ │ ├── InterruptableSampleJob.java │ │ ├── SimpleCronJob.java │ │ └── SimpleJob.java │ │ └── persistance │ │ ├── LocalDateTimeAttributeConverter.java │ │ ├── Logging.java │ │ └── TransactionConfig.java │ └── resources │ ├── i18n │ └── admintool │ │ ├── demo-messages.properties │ │ └── demo-messages_en.properties │ └── templates │ ├── admintool │ ├── content │ │ ├── dashboard.html │ │ ├── dashboard2.html │ │ ├── dashboard3.html │ │ ├── dashboard4.html │ │ └── start.html │ └── notifications │ │ └── notification.html │ ├── index.html │ └── info.html ├── admin-tools-demo-jar ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ ├── META-INF │ │ └── additional-spring-configuration-metadata.json │ └── de │ │ └── chandre │ │ └── admintool │ │ ├── Application.java │ │ └── security │ │ ├── AdminToolAuthManagerWrapper.java │ │ ├── AdminToolInMemoryUserDetailsConfigurer.java │ │ ├── AdminToolInMemoryUserDetailsService.java │ │ ├── AdminToolSecurityController.java │ │ ├── AdminToolSecurityLoader.java │ │ ├── SecurityBeans.java │ │ └── SecurityConfig.java │ └── resources │ ├── application.properties │ └── log4j2.xml ├── admin-tools-demo-war ├── pom.xml └── src │ └── main │ ├── java │ └── de │ │ └── chandre │ │ └── admintool │ │ ├── MenuFlatter.java │ │ ├── WarApplication.java │ │ └── security │ │ ├── AdminToolAuthManagerWrapper.java │ │ ├── AdminToolInMemoryUserDetailsConfigurer.java │ │ ├── AdminToolInMemoryUserDetailsService.java │ │ ├── AdminToolSecurityController.java │ │ ├── AdminToolSecurityLoader.java │ │ ├── SecurityBeans.java │ │ └── SecurityConfig.java │ └── resources │ ├── application.properties │ ├── log4j2.xml │ └── templates │ └── admintool │ └── content │ ├── myDashboard.html │ └── myDashboard2.html ├── admin-tools-filebrowser ├── README.md ├── doc │ ├── screen_filebrowser_org.png │ └── screen_fileviewer_org.png ├── pom.xml └── src │ └── main │ ├── java │ └── de │ │ └── chandre │ │ └── admintool │ │ ├── filebrowser │ │ ├── ATFileBrowserPermissions.java │ │ ├── ATFilebrowserDefaultPermissionHandler.java │ │ ├── ATFilebrowserPermissionHandler.java │ │ ├── AbstractFileBrowserService.java │ │ ├── AdminToolFileBrowserRoles.java │ │ ├── AdminToolFilebrowserConfig.java │ │ ├── AdminToolFilebrowserController.java │ │ ├── AdminToolFilebrowserLoader.java │ │ ├── AdminToolFilebrowserService.java │ │ ├── AdminToolFilebrowserServiceImpl.java │ │ ├── DownloadNotAllowedException.java │ │ ├── FileUploadResponse.java │ │ ├── GenericFilebrowserException.java │ │ ├── MimeTypes.java │ │ └── SortColumn.java │ │ └── fileviewer │ │ ├── ATFileviewerDefaultPermissionHandler.java │ │ ├── ATFileviewerPermissionHandler.java │ │ ├── AdminToolFileViewerRoles.java │ │ ├── AdminToolFileviewerConfig.java │ │ ├── AdminToolFileviewerController.java │ │ ├── AdminToolFileviewerService.java │ │ └── AdminToolFileviewerServiceImpl.java │ └── resources │ ├── i18n │ └── admintool │ │ ├── filebrowser-messages.properties │ │ └── filebrowser-messages_en.properties │ ├── static │ └── admintool │ │ └── filebrowser │ │ ├── css │ │ ├── filebrowser.css │ │ └── fileviewer.css │ │ ├── fine-uploader │ │ └── 5.15.0 │ │ │ ├── LICENSE │ │ │ ├── continue.gif │ │ │ ├── edit.gif │ │ │ ├── fine-uploader-gallery.css │ │ │ ├── fine-uploader-gallery.min.css │ │ │ ├── fine-uploader-gallery.min.css.map │ │ │ ├── fine-uploader.js │ │ │ ├── fine-uploader.js.map │ │ │ ├── fine-uploader.min.js │ │ │ ├── fine-uploader.min.js.map │ │ │ ├── loading.gif │ │ │ ├── pause.gif │ │ │ ├── placeholders │ │ │ ├── not_available-generic.png │ │ │ └── waiting-generic.png │ │ │ ├── processing.gif │ │ │ ├── retry.gif │ │ │ ├── templates │ │ │ ├── default.html │ │ │ ├── gallery.html │ │ │ └── simple-thumbnails.html │ │ │ └── trash.gif │ │ └── js │ │ ├── filebrowser.js │ │ └── fileviewer.js │ └── templates │ └── admintool │ └── filebrowser │ ├── content │ ├── filebrowser.html │ └── fileviewer.html │ └── includes │ └── fileInfo.inc.html ├── admin-tools-jminix ├── README.md ├── doc │ └── screen_jminix_org.png ├── pom.xml └── src │ └── main │ ├── java │ └── de │ │ └── chandre │ │ └── admintool │ │ ├── jminix │ │ ├── AdminToolJminixConfig.java │ │ ├── AdminToolJminixLoader.java │ │ ├── AdminToolJmxController.java │ │ ├── AdminToolJmxRoles.java │ │ ├── AdminToolJmxService.java │ │ └── AdminToolJmxServiceImpl.java │ │ └── jmx │ │ └── jstree │ │ ├── JmxExecuteTO.java │ │ ├── JmxMethodTO.java │ │ ├── JmxOperationTO.java │ │ ├── JmxQueryTO.java │ │ ├── JmxResponseTO.java │ │ ├── JsTree.java │ │ └── JsTreeState.java │ └── resources │ ├── i18n │ └── admintool │ │ ├── jmx-messages.properties │ │ └── jmx-messages_en.properties │ ├── static │ └── admintool │ │ └── jmx │ │ ├── css │ │ └── jmx.css │ │ ├── images │ │ └── vsizegrip.png │ │ └── js │ │ ├── jmx.js │ │ ├── jquery-resizable.js │ │ └── jquery-resizable.min.js │ └── templates │ └── admintool │ └── content │ └── jmx │ └── jmx.html ├── admin-tools-log4j2 ├── README.md ├── doc │ ├── screen_log4j_console_org.png │ └── screen_log4j_org.png ├── pom.xml └── src │ └── main │ ├── java │ └── de │ │ └── chandre │ │ └── admintool │ │ └── log4j2 │ │ ├── AdminLog4j2Controller.java │ │ ├── AdminToolLog4j2Config.java │ │ ├── AdminToolLog4j2Loader.java │ │ ├── AdminToolLog4j2OutputStream.java │ │ ├── AdminToolLog4j2Util.java │ │ ├── AdminToolLog4jRoles.java │ │ ├── AdminToolLog4jSessionListener.java │ │ ├── Log4j2ConsoleTO.java │ │ └── Log4j2ManageLoggerTO.java │ └── resources │ ├── i18n │ └── admintool │ │ ├── log4j2-messages.properties │ │ └── log4j2-messages_en.properties │ ├── static │ └── admintool │ │ ├── css │ │ └── log4j2.css │ │ └── js │ │ └── log4j2.js │ └── templates │ └── admintool │ └── content │ ├── log4j2.html │ └── log4j2Console.html ├── admin-tools-melody ├── README.md ├── doc │ └── screen_melody_org.png ├── pom.xml └── src │ └── main │ ├── java │ └── de │ │ └── chandre │ │ └── admintool │ │ └── melody │ │ ├── AdminToolJavaMelodyConfig.java │ │ ├── AdminToolJavaMelodyLoader.java │ │ └── AdminToolMelodyRoles.java │ └── resources │ ├── i18n │ └── admintool │ │ ├── melody-messages.properties │ │ └── melody-messages_en.properties │ ├── static │ └── admintool │ │ └── melody.css │ └── templates │ └── admintool │ └── content │ └── melody.html ├── admin-tools-properties ├── README.md ├── doc │ └── screen_propertyBrowser_org.png ├── pom.xml └── src │ └── main │ ├── java │ └── de │ │ └── chandre │ │ └── admintool │ │ └── properties │ │ ├── AdminToolPropertiesConfig.java │ │ ├── AdminToolPropertiesLoader.java │ │ ├── AdminToolPropertiesRoles.java │ │ └── AdminToolPropertiesService.java │ └── resources │ ├── i18n │ └── admintool │ │ ├── properties-messages.properties │ │ └── properties-messages_en.properties │ ├── static │ └── admintool │ │ └── js │ │ └── properties.js │ └── templates │ └── admintool │ └── properties │ ├── content │ └── properties.html │ └── fragments │ └── propFragment.html ├── admin-tools-quartz ├── README.md ├── doc │ ├── screen_quartzJobs_org.png │ └── screen_quartzMetadata_org.png ├── pom.xml └── src │ └── main │ ├── java │ └── de │ │ └── chandre │ │ └── admintool │ │ └── quartz │ │ ├── ATQuartzDefaultPermissionHandler.java │ │ ├── ATQuartzPermissionHandler.java │ │ ├── ATQuartzPermissions.java │ │ ├── AdminToolQuartzConfig.java │ │ ├── AdminToolQuartzController.java │ │ ├── AdminToolQuartzLoader.java │ │ ├── AdminToolQuartzRoles.java │ │ ├── AdminToolQuartzService.java │ │ ├── AdminToolQuartzServiceImpl.java │ │ └── JobTriggerTO.java │ └── resources │ ├── i18n │ └── admintool │ │ ├── quartz-messages.properties │ │ └── quartz-messages_en.properties │ ├── static │ └── admintool │ │ └── quartz │ │ ├── css │ │ └── quartz.css │ │ └── js │ │ ├── quartz.js │ │ ├── validator.js │ │ └── validator.min.js │ └── templates │ └── admintool │ └── quartz │ ├── content │ ├── quartzConfig.html │ └── quartzJobs.html │ ├── fragments │ └── quartzModals.html │ └── includes │ └── quartzJobs.inc.html ├── admin-tools-security ├── admin-tools-security-commons │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ ├── META-INF │ │ │ └── AT-Spring-Security-Dialect.xml │ │ └── de │ │ │ └── chandre │ │ │ └── admintool │ │ │ └── security │ │ │ └── commons │ │ │ ├── LoginController.java │ │ │ ├── TemplateUserService.java │ │ │ ├── TemplateUserServiceImpl.java │ │ │ └── auth │ │ │ ├── AdminToolAuthenticationFailureListener.java │ │ │ ├── AdminToolAuthenticationSuccessListener.java │ │ │ ├── AdminToolUserDetailsService.java │ │ │ ├── LoginAttemptService.java │ │ │ ├── LoginAttemptServiceImpl.java │ │ │ ├── UserStateType.java │ │ │ ├── UserTO.java │ │ │ └── thymeleaf │ │ │ ├── ATAuthUrlAttrProcessor.java │ │ │ └── ATSpringSecurityDialect.java │ │ └── resources │ │ ├── i18n │ │ └── admintool │ │ │ ├── security-commons-messages.properties │ │ │ └── security-commons-messages_en.properties │ │ └── templates │ │ └── admintool │ │ ├── fragments │ │ └── secFragements.html │ │ ├── includes │ │ ├── dropdownUserMenu.inc.html │ │ └── menu.inc.html │ │ ├── layout │ │ └── anonymousLayout.html │ │ └── login.html ├── admin-tools-security-dbuser │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── de │ │ │ └── chandre │ │ │ └── admintool │ │ │ └── security │ │ │ └── dbuser │ │ │ ├── ATSecDBAdminUserCreator.java │ │ │ ├── ATSecDBUtils.java │ │ │ ├── AdminToolSecDBLoader.java │ │ │ ├── AdminToolSecDBProperties.java │ │ │ ├── AdminToolSecDBRoles.java │ │ │ ├── AdminToolSecDBTemplateUtils.java │ │ │ ├── AdminToolSecDBTemplateUtilsImpl.java │ │ │ ├── Constants.java │ │ │ ├── auth │ │ │ ├── AccessRelationTO.java │ │ │ ├── AdminToolSecDBAuthenticationFailureListener.java │ │ │ ├── AdminToolSecDBAuthenticationSuccessHandler.java │ │ │ ├── AdminToolSecDBBeans.java │ │ │ ├── ExtUserTO.java │ │ │ └── PasswordTO.java │ │ │ ├── contoller │ │ │ ├── ATSecDBAbctractController.java │ │ │ ├── AdminToolSecDBClientController.java │ │ │ ├── AdminToolSecDBProfileController.java │ │ │ ├── AdminToolSecDBPublicController.java │ │ │ ├── AdminToolSecDBRoleController.java │ │ │ ├── AdminToolSecDBTransformUtil.java │ │ │ ├── AdminToolSecDBUserController.java │ │ │ └── AdminToolSecDBUserGroupController.java │ │ │ ├── domain │ │ │ ├── ATClient.java │ │ │ ├── ATRole.java │ │ │ ├── ATUser.java │ │ │ ├── ATUserGroup.java │ │ │ ├── AbstractEntity.java │ │ │ ├── AccessRelation.java │ │ │ ├── Client.java │ │ │ ├── Entity.java │ │ │ ├── Role.java │ │ │ ├── User.java │ │ │ └── UserGroup.java │ │ │ ├── repo │ │ │ ├── ClientRepository.java │ │ │ ├── RoleRepository.java │ │ │ ├── UserGroupRepository.java │ │ │ ├── UserGroupSpecifications.java │ │ │ └── UserRepository.java │ │ │ └── service │ │ │ ├── ATSecDBUserControllerAuthProxy.java │ │ │ ├── ATSecDBUserControllerAuthProxyImpl.java │ │ │ ├── AdminToolSecDBClientService.java │ │ │ ├── AdminToolSecDBClientServiceImpl.java │ │ │ ├── AdminToolSecDBRoleService.java │ │ │ ├── AdminToolSecDBRoleServiceImpl.java │ │ │ ├── AdminToolSecDBUserDetailsService.java │ │ │ ├── AdminToolSecDBUserDetailsServiceImpl.java │ │ │ ├── AdminToolSecDBUserGroupService.java │ │ │ ├── AdminToolSecDBUserGroupServiceImpl.java │ │ │ ├── DefaultPasswordLinkHashGenerator.java │ │ │ ├── PasswordLinkHashGenerator.java │ │ │ ├── comm │ │ │ ├── AdminToolSecDBCommunicator.java │ │ │ └── SendException.java │ │ │ └── validation │ │ │ ├── ATSecDBValidator.java │ │ │ ├── AbstractValidator.java │ │ │ ├── AdminToolSecDBClientValidator.java │ │ │ ├── AdminToolSecDBClientValidatorImpl.java │ │ │ ├── AdminToolSecDBRoleValidator.java │ │ │ ├── AdminToolSecDBRoleValidatorImpl.java │ │ │ ├── AdminToolSecDBUserGroupValidator.java │ │ │ ├── AdminToolSecDBUserGroupValidatorImpl.java │ │ │ ├── AdminToolSecDBUserValidator.java │ │ │ ├── AdminToolSecDBUserValidatorImpl.java │ │ │ └── AdminToolValidationInterceptor.java │ │ └── resources │ │ ├── i18n │ │ └── admintool │ │ │ ├── security-db-messages.properties │ │ │ └── security-db-messages_en.properties │ │ ├── sql │ │ ├── h2 │ │ │ └── TableInitialization_DDL.sql │ │ ├── mysql │ │ │ └── TableInitialization_DDL.sql │ │ ├── oracle │ │ │ └── TableInitialization_DDL.sql │ │ └── postgres │ │ │ └── TableInitialization_DDL.sql │ │ ├── static │ │ └── admintool │ │ │ └── security │ │ │ ├── css │ │ │ └── accessmanagement.css │ │ │ └── js │ │ │ ├── accessmanagement.js │ │ │ ├── accessrelation.js │ │ │ ├── passwordgen.js │ │ │ ├── profile.js │ │ │ ├── resetPassword.js │ │ │ ├── roles.js │ │ │ ├── usergroups.js │ │ │ └── users.js │ │ └── templates │ │ └── admintool │ │ ├── includes │ │ └── dropdownUserMenu.inc.html │ │ ├── login.html │ │ └── security │ │ └── content │ │ ├── clients.html │ │ ├── profile.html │ │ ├── resetPassword.html │ │ ├── resetPasswordRequest.html │ │ ├── roles.html │ │ ├── usergroups.html │ │ └── users.html ├── admin-tools-security-simple │ ├── README.md │ ├── doc │ │ └── screen_userview_org.png │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── de │ │ │ └── chandre │ │ │ └── admintool │ │ │ └── security │ │ │ └── simple │ │ │ └── auth │ │ │ ├── AbstractAdminToolSecurityViewController.java │ │ │ ├── AbstractAdminToolSecurityViewLoader.java │ │ │ └── AdminToolSecSimpleUserDetailsService.java │ │ └── resources │ │ ├── i18n │ │ └── admintool │ │ │ ├── security-simple-messages.properties │ │ │ └── security-simple-messages_en.properties │ │ ├── static │ │ └── admintool │ │ │ └── security │ │ │ ├── users.js │ │ │ └── validator.min.js │ │ └── templates │ │ └── admintool │ │ ├── includes │ │ └── dropdownUserMenu.inc.html │ │ └── security │ │ └── content │ │ └── users.html └── pom.xml ├── message-properties ├── admintool_de.properties └── admintool_en.properties └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | .settings 2 | .project 3 | .classpath 4 | .factorypath 5 | target/ 6 | *.log 7 | *.log.gz 8 | *.versionsBackup 9 | *.bat 10 | .springBeans 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 André Hertwig 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/AdminToolConfig.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core; 2 | 3 | /** 4 | * configuration component for admintool 5 | * @author Andre 6 | * 7 | */ 8 | public interface AdminToolConfig 9 | { 10 | public static final String WEBJARS_CDN_PREFIX = "https://cdn.jsdelivr.net/webjars/"; 11 | 12 | public static final String WEBJARS_CDN_PREFIX_BOWER = WEBJARS_CDN_PREFIX + "org.webjars.bower/"; 13 | 14 | public static final String WEBJARS_LOCAL_PREFIX = "/webjars/"; 15 | 16 | /** 17 | * should print the configuration to log 18 | */ 19 | public void printConfig(); 20 | 21 | /** 22 | * should return if component is active or deactivated 23 | * @return 24 | */ 25 | public boolean isEnabled(); 26 | } 27 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/CustomWebMvcAutoConfig.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 6 | 7 | 8 | @Configuration 9 | //@AutoConfigureAfter(DispatcherServletAutoConfiguration.class) 10 | //@ConditionalOnClass({ WebMvcAutoConfiguration.class }) 11 | public class CustomWebMvcAutoConfig extends WebMvcConfigurerAdapter 12 | { 13 | @Override 14 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 15 | if (!registry.hasMappingForPattern("/static/**")) { 16 | registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); 17 | } 18 | if (!registry.hasMappingForPattern("/webjars/**")) { 19 | registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); 20 | } 21 | 22 | super.addResourceHandlers(registry); 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/MenuEntrySearchResult.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core; 2 | 3 | import de.chandre.admintool.core.component.AdminComponent; 4 | import de.chandre.admintool.core.component.MenuEntry; 5 | 6 | /** 7 | * 8 | * @author Andre 9 | * @since 1.0.1 10 | */ 11 | public class MenuEntrySearchResult { 12 | 13 | public static final String NAME = "menuEntrySearchResult"; 14 | 15 | private AdminComponent component; 16 | private MenuEntry menuEntry; 17 | 18 | public MenuEntrySearchResult(AdminComponent component, MenuEntry menuEntry) { 19 | super(); 20 | this.component = component; 21 | this.menuEntry = menuEntry; 22 | } 23 | 24 | /** 25 | * @return the component 26 | */ 27 | public AdminComponent getComponent() { 28 | return component; 29 | } 30 | 31 | /** 32 | * @return the menuEntry 33 | */ 34 | public MenuEntry getMenuEntry() { 35 | return menuEntry; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/component/AdminComponentComparator.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.component; 2 | 3 | import java.util.Comparator; 4 | 5 | /** 6 | * default comparator or ordering components against its position or its display name 7 | * @author Andre 8 | * @since 1.0.1 9 | */ 10 | public class AdminComponentComparator implements Comparator { 11 | 12 | private static int NEG = -1; 13 | private static int POS = 1; 14 | 15 | @Override 16 | public int compare(AdminComponent o1, AdminComponent o2) { 17 | 18 | if (null == o1.getPosition() && null == o2.getPosition()) { 19 | return o1.compareTo(o2); 20 | } 21 | else if (null == o1.getPosition()) { 22 | return POS; 23 | } 24 | else if (null == o2.getPosition()) { 25 | return NEG; 26 | } 27 | else if (o1.getPosition().intValue() == o2.getPosition().intValue()) { 28 | return o1.compareTo(o2); 29 | } 30 | return o1.getPosition().compareTo(o2.getPosition()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/sec/ATAbstractPermissionHandler.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.sec; 2 | 3 | import org.springframework.security.core.Authentication; 4 | import org.springframework.security.core.context.SecurityContext; 5 | import org.springframework.security.core.context.SecurityContextHolder; 6 | 7 | /** 8 | * Abstract permission handler 9 | * (placed in core to avoid interdependencies) 10 | * @author Andre 11 | * @since 1.2.0 12 | */ 13 | public abstract class ATAbstractPermissionHandler { 14 | 15 | private Authentication getAuthentication() { 16 | 17 | SecurityContext securityContext = SecurityContextHolder.getContext(); 18 | if (securityContext == null) 19 | return null; 20 | 21 | Authentication authentication = securityContext.getAuthentication(); 22 | if (authentication == null) 23 | return null; 24 | return authentication; 25 | } 26 | 27 | protected boolean userHasRole(ATInitRole role) { 28 | Authentication auth = getAuthentication(); 29 | return auth != null 30 | ? auth.getAuthorities().stream().filter(ga -> ga.getAuthority().equals(AdminToolRoles.PREFIX + role.getName())) 31 | .findFirst().isPresent() 32 | : false; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/sec/ATInitRole.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.sec; 2 | 3 | /** 4 | * role for initialization 5 | * @author Andre 6 | * @since 1.2.0 7 | */ 8 | public interface ATInitRole { 9 | 10 | public String getName(); 11 | public String getDisplayName(); 12 | public String getDescription(); 13 | public boolean isActive(); 14 | 15 | default String getNamePrefixed() { 16 | if (null != getName() && !getName().startsWith(AdminToolRoles.PREFIX)) { 17 | return AdminToolRoles.PREFIX + getName(); 18 | } 19 | return getName(); 20 | } 21 | 22 | public static class ATInitRoleBuilder { 23 | 24 | private ATInitRoleImpl initRole; 25 | 26 | public static ATInitRoleBuilder builder() { 27 | return new ATInitRoleBuilder(); 28 | } 29 | public ATInitRoleBuilder() { 30 | initRole = new ATInitRoleImpl(); 31 | } 32 | public ATInitRoleBuilder name(String name) { 33 | this.initRole.setName(name); 34 | return this; 35 | } 36 | public ATInitRoleBuilder displayName(String displayName) { 37 | this.initRole.setDisplayName(displayName); 38 | return this; 39 | } 40 | public ATInitRoleBuilder description(String description) { 41 | this.initRole.setDescription(description); 42 | return this; 43 | } 44 | public ATInitRoleBuilder active(boolean active) { 45 | this.initRole.setActive(active); 46 | return this; 47 | } 48 | public ATInitRole build() { 49 | return initRole; 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/sec/AdminToolCoreRoles.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.sec; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | import java.util.Collections; 6 | 7 | import org.springframework.stereotype.Component; 8 | 9 | import de.chandre.admintool.core.sec.ATInitRole.ATInitRoleBuilder; 10 | import de.chandre.admintool.core.sec.AdminToolRoles; 11 | 12 | /** 13 | * 14 | * @author Andre 15 | * @since 1.2.0 16 | */ 17 | @Component 18 | public class AdminToolCoreRoles implements AdminToolRoles { 19 | 20 | public static final ATInitRole ROLE_ATCORE = ATInitRoleBuilder.builder() 21 | .name("ATCORE").displayName("AdminTool Core Role").description("This is used for everthing which has no special role").active(true).build(); 22 | 23 | @Override 24 | public Collection getRoles() { 25 | return Collections.unmodifiableList(Arrays.asList(ROLE_ATCORE)); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/sec/AdminToolRoles.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.sec; 2 | 3 | import java.util.Collection; 4 | 5 | /** 6 | * interface for roles of a admintool component 7 | * (placed in core to avoid interdependencies) 8 | * @author Andre 9 | * @since 1.2.0 10 | */ 11 | public interface AdminToolRoles { 12 | 13 | public static String PREFIX = "ROLE_"; 14 | 15 | Collection getRoles(); 16 | } 17 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/thymeleaf/OrderedClassLoaderTemplateResolver.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.thymeleaf; 2 | 3 | import java.util.Comparator; 4 | 5 | import org.thymeleaf.templateresolver.TemplateResolver; 6 | 7 | /** 8 | * Custom template resolver used to get the correct template 9 | *
10 | * If using the default constructor the {@link TemplateUrlComparator} will be used to sort 11 | * the templates within {@link OrderedClassLoaderResourceResolver} after searching them in the classpath.
12 | * If more than one template has been found, the first one by compared set will be used. 13 | * 14 | * @author Andre 15 | * @since 1.0.1 16 | */ 17 | public class OrderedClassLoaderTemplateResolver extends TemplateResolver { 18 | 19 | private final OrderedClassLoaderResourceResolver resourceResolver; 20 | 21 | /** 22 | * constructor using {@link TemplateUrlComparator} and enabled caching 23 | */ 24 | public OrderedClassLoaderTemplateResolver() { 25 | this(new TemplateUrlComparator()); 26 | } 27 | 28 | /** 29 | * constructor with custom comparator and enabled caching 30 | * @param comparator 31 | */ 32 | public OrderedClassLoaderTemplateResolver(Comparator comparator) { 33 | this(comparator, true); 34 | } 35 | 36 | /** 37 | * constructor with custom comparator and option for cache control 38 | * @param comparator 39 | * @param enableCaching to switch of caching of found templates 40 | * @see OrderedClassLoaderResourceResolver#OrderedClassLoaderResourceResolver(Comparator, boolean) 41 | * @since 1.0.4 42 | */ 43 | public OrderedClassLoaderTemplateResolver(Comparator comparator, boolean enableCaching) { 44 | super(); 45 | this.resourceResolver = new OrderedClassLoaderResourceResolver(comparator, enableCaching); 46 | super.setResourceResolver(this.resourceResolver); 47 | } 48 | 49 | /** 50 | * clears the cache of found template urls 51 | * @since 1.0.4 52 | */ 53 | public void clearCache() { 54 | this.resourceResolver.clearCache(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/thymeleaf/TemplateUrlComparator.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.thymeleaf; 2 | 3 | import java.util.Comparator; 4 | import java.util.regex.Pattern; 5 | 6 | import org.apache.commons.logging.Log; 7 | import org.apache.commons.logging.LogFactory; 8 | 9 | /** 10 | * Comparator expects the full url path of template
11 | * Templates found in core will have the lowest order 12 | * @author Andre 13 | * @since 1.0.1 14 | * 15 | */ 16 | public class TemplateUrlComparator implements Comparator { 17 | 18 | private static final Log LOGGER = LogFactory.getLog(TemplateUrlComparator.class); 19 | 20 | private static final Pattern[] CORE_LIB = new Pattern[]{ 21 | Pattern.compile(".*/admin-tools-core/.*"), 22 | Pattern.compile(".*/admin-tools-core-\\d.*") 23 | }; 24 | 25 | private static int NEG = -1; 26 | private static int POS = 1; 27 | 28 | @Override 29 | public int compare(String o1, String o2) { 30 | boolean o1FoundInCore = foundInCore(o1); 31 | boolean o2FoundInCore = foundInCore(o2); 32 | 33 | if (o1FoundInCore) { 34 | return POS; 35 | } 36 | if (o2FoundInCore) { 37 | return NEG; 38 | } 39 | return o2.compareTo(o1); 40 | } 41 | 42 | private boolean foundInCore(String url) { 43 | boolean foundInCore = false; 44 | for (Pattern libPattern : CORE_LIB) { 45 | foundInCore |= libPattern.matcher(url).matches(); 46 | } 47 | if (LOGGER.isTraceEnabled()) { 48 | LOGGER.trace(String.format("template found in core %s for %s", foundInCore, url)); 49 | } 50 | return foundInCore; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/ui/ATFooterInformation.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.ui; 2 | 3 | public interface ATFooterInformation { 4 | 5 | default String getApplicationName() { 6 | return "The Admin-UI"; 7 | }; 8 | 9 | String getAppVersionDescription(); 10 | 11 | String getAppVersion(); 12 | 13 | default String getAppBuildTimeDescritpion() { 14 | return "Build-Time"; 15 | } 16 | 17 | String getAppBuildTime(); 18 | } 19 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/ui/select2/OptionGroupTO.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.ui.select2; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class OptionGroupTO extends OptionTO { 7 | private static final long serialVersionUID = 2324648170741736932L; 8 | 9 | private String text; 10 | private List children = new ArrayList<>();; 11 | 12 | public OptionGroupTO() { 13 | super(); 14 | } 15 | public OptionGroupTO(String text) { 16 | super(); 17 | this.text = text; 18 | } 19 | 20 | public String getText() { 21 | return text; 22 | } 23 | public void setText(String text) { 24 | this.text = text; 25 | } 26 | public List getChildren() { 27 | return children; 28 | } 29 | public void setChildren(List children) { 30 | this.children = children; 31 | } 32 | public void addChild(OptionTO child) { 33 | this.children.add(child); 34 | } 35 | 36 | public boolean hasChildren() { 37 | return this.children != null && !this.children.isEmpty(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/ui/select2/OptionTO.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.ui.select2; 2 | 3 | import java.io.Serializable; 4 | 5 | public class OptionTO implements Serializable, Comparable { 6 | private static final long serialVersionUID = 6804008394662197234L; 7 | 8 | private String id; 9 | private String text; 10 | private boolean selected; 11 | private boolean disabled; 12 | 13 | public OptionTO() { 14 | super(); 15 | } 16 | 17 | public OptionTO(String id, String text) { 18 | this(id, text, false, false); 19 | } 20 | public OptionTO(String id, String text, boolean selected, boolean disabled) { 21 | super(); 22 | this.id = id; 23 | this.text = text; 24 | this.selected = selected; 25 | this.disabled = disabled; 26 | } 27 | 28 | public String getId() { 29 | return id; 30 | } 31 | public void setId(String id) { 32 | this.id = id; 33 | } 34 | public String getText() { 35 | return text; 36 | } 37 | public void setText(String text) { 38 | this.text = text; 39 | } 40 | public boolean isSelected() { 41 | return selected; 42 | } 43 | public void setSelected(boolean selected) { 44 | this.selected = selected; 45 | } 46 | public boolean isDisabled() { 47 | return disabled; 48 | } 49 | public void setDisabled(boolean disabled) { 50 | this.disabled = disabled; 51 | } 52 | 53 | @Override 54 | public String toString() { 55 | StringBuilder builder = new StringBuilder(); 56 | builder.append("OptionTO [id=").append(id).append(", text=").append(text).append(", selected=").append(selected) 57 | .append(", disabled=").append(disabled).append("]"); 58 | return builder.toString(); 59 | } 60 | 61 | @Override 62 | public int compareTo(OptionTO o) { 63 | return this.id.compareTo(o.getId()); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/ui/select2/Select2GroupedTO.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.ui.select2; 2 | 3 | import java.io.Serializable; 4 | import java.util.ArrayList; 5 | import java.util.HashSet; 6 | import java.util.List; 7 | import java.util.Set; 8 | 9 | import de.chandre.admintool.core.ui.ATError; 10 | 11 | /** 12 | * View representation for select elements for select2 13 | * @author Andre 14 | * @since 1.2.0 15 | * 16 | * @param {@link OptionTO} or {@link OptionGroupTO} 17 | */ 18 | public class Select2GroupedTO implements Serializable { 19 | private static final long serialVersionUID = 922341647233302483L; 20 | 21 | private List result = new ArrayList<>(); 22 | 23 | private Set errors; 24 | 25 | public List getResult() { 26 | return result; 27 | } 28 | 29 | public void setResult(List result) { 30 | this.result = result; 31 | } 32 | 33 | public boolean addResult(E option) { 34 | if (option instanceof OptionGroupTO) { 35 | if (OptionGroupTO.class.cast(option).hasChildren()) { 36 | return this.result.add(option); 37 | } 38 | return false; 39 | } 40 | return this.result.add(option); 41 | } 42 | 43 | public Set getErrors() { 44 | return errors; 45 | } 46 | 47 | public void setErrors(Set errors) { 48 | this.errors = errors; 49 | } 50 | 51 | public void addError(ATError error) { 52 | if (null == errors) { 53 | this.errors = new HashSet<>(); 54 | } 55 | this.errors.add(error); 56 | } 57 | 58 | @Override 59 | public String toString() { 60 | StringBuilder builder = new StringBuilder(); 61 | builder.append("Select2GroupedTO [result=").append(result).append(", errors=").append(errors).append("]"); 62 | return builder.toString(); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/utils/ExceptionUtils.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.utils; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.io.Closeable; 5 | import java.io.PrintStream; 6 | 7 | /** 8 | * 9 | * @author Andre 10 | * 11 | */ 12 | public class ExceptionUtils { 13 | 14 | private ExceptionUtils() { 15 | } 16 | 17 | /** 18 | * prints a exception into a string 19 | * @param throwable 20 | * @return 21 | */ 22 | public static String printException(final Throwable throwable) { 23 | if (null == throwable) { 24 | return null; 25 | } 26 | final ByteArrayOutputStream baos = new ByteArrayOutputStream(); 27 | final PrintStream printStream = new PrintStream(baos); 28 | throwable.printStackTrace(printStream); 29 | String exceptionStr = ""; 30 | try { 31 | exceptionStr = baos.toString("UTF-8"); 32 | } catch (Exception ex) { 33 | exceptionStr = "Unavailable"; 34 | } finally { 35 | closeStream(printStream); 36 | closeStream(baos); 37 | } 38 | return exceptionStr; 39 | } 40 | 41 | private static void closeStream(final Closeable closeable) { 42 | if (null != closeable) { 43 | try { 44 | closeable.close(); 45 | } catch (Exception ignore) { 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/java/de/chandre/admintool/core/utils/RegexUtil.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.core.utils; 2 | 3 | /** 4 | * util for regular expressions 5 | * 6 | * @author Andre 7 | * 8 | */ 9 | public class RegexUtil { 10 | 11 | private RegexUtil() 12 | { 13 | 14 | } 15 | 16 | /** 17 | * transforms a wildcard to an regex 18 | * 19 | * @see http://www.rgagnon.com/javadetails/java-0515.html 20 | * 21 | * @param wildcard 22 | * @return 23 | */ 24 | public static String wildcardToRegex(String wildcard) 25 | { 26 | StringBuffer s = new StringBuffer(wildcard.length()); 27 | s.append('^'); 28 | for (int i = 0, is = wildcard.length(); i < is; i++) 29 | { 30 | char c = wildcard.charAt(i); 31 | switch (c) 32 | { 33 | case '*': 34 | s.append(".*"); 35 | break; 36 | case '?': 37 | s.append("."); 38 | break; 39 | // escape special regexp-characters 40 | case '(': 41 | case ')': 42 | case '[': 43 | case ']': 44 | case '$': 45 | case '^': 46 | case '.': 47 | case '{': 48 | case '}': 49 | case '|': 50 | case '\\': 51 | s.append("\\"); 52 | s.append(c); 53 | break; 54 | default: 55 | s.append(c); 56 | break; 57 | } 58 | } 59 | s.append('$'); 60 | return (s.toString()); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources-filtered/admintool-version.properties: -------------------------------------------------------------------------------- 1 | version=${project.version} -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/i18n/admintool/core-messages.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.menu.headline=MAINMENU 2 | 3 | ui.admintool.core.modal.error.title=Error 4 | ui.admintool.core.modal.error.text=An Error has been occurred 5 | 6 | ui.admintool.core.modal.confirm.title=Confirm 7 | ui.admintool.core.modal.confirm.text=Do you confirm? 8 | 9 | ui.admintool.core.modal.btn.save=Save 10 | ui.admintool.core.modal.btn.add=Add 11 | ui.admintool.core.modal.btn.delete=Delete 12 | ui.admintool.core.modal.btn.close=Close 13 | ui.admintool.core.modal.btn.confirm=Confirm -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/i18n/admintool/core-messages_en.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.menu.headline=MAINMENU 2 | 3 | ui.admintool.core.modal.error.title=Error 4 | ui.admintool.core.modal.error.text=An Error has been occurred 5 | 6 | ui.admintool.core.modal.confirm.title=Confirm 7 | ui.admintool.core.modal.confirm.text=Do you confirm? 8 | 9 | ui.admintool.core.modal.btn.save=Save 10 | ui.admintool.core.modal.btn.add=Add 11 | ui.admintool.core.modal.btn.delete=Delete 12 | ui.admintool.core.modal.btn.close=Close 13 | ui.admintool.core.modal.btn.confirm=Confirm 14 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/static/admintool/css/adminTool.css: -------------------------------------------------------------------------------- 1 | 2 | #reloadPage { 3 | cursor: pointer; 4 | cursor: hand; 5 | } 6 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/static/admintool/js/validation-util.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Admintool utility class for 1000Hz validation plugin 3 | * 4 | * @author André 5 | * @Since 1.2.0 6 | */ 7 | AdminTool.ValidationUtil = function(parent) { 8 | var self = this; 9 | 10 | this.construct = function(parent) { 11 | this.parent = parent; 12 | this.options = {}; 13 | $.extend(true, this.options, parent.options); 14 | }; 15 | 16 | this.create = function(formId) { 17 | return getByID(formId).validator(); 18 | }; 19 | 20 | this.destroy = function(formId) { 21 | getByID(formId).validator('destroy'); 22 | }; 23 | 24 | this.validate = function(formId) { 25 | getByID(formId).validator('validate'); 26 | return self.hasValidationErrors(formId); 27 | }; 28 | 29 | this.hasValidationErrors = function(formId) { 30 | return getByID(formId).data('bs.validator').hasErrors(); 31 | }; 32 | 33 | this.showCustomError = function(fieldId, message, formId) { 34 | var $field = getByID(fieldId); 35 | $field.data('bs.validator.errors', [ message ]); 36 | getByID(formId).data('bs.validator').showErrors($field); 37 | }; 38 | 39 | this.reloadValidator = function(formId) { 40 | self.destroy(formId); 41 | // validator doesn't remove everything 42 | getByID(formId).find('.form-control-feedback').removeClass( 43 | 'glyphicon-remove'); 44 | self.create(formId); 45 | }; 46 | 47 | this.showFieldErrorsOnATErrorList = function(data, formId) { 48 | var globalErrors = []; 49 | for (var i = 0; i < data.length; i++) { 50 | var error = data[i]; 51 | if (error.field && error.field.length > 0) { 52 | self.showCustomError(error.field, error.message, formId); 53 | } else { 54 | globalErrors.push('
  • ' + error.message + '
  • '); 55 | } 56 | } 57 | 58 | if (globalErrors.length > 0) { 59 | self.parent.appendToErrorModal('
      ' + globalErrors.join('') + '
    '); 60 | } 61 | }; 62 | 63 | this.construct(parent); 64 | }; -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/content/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |

    7 | Error 8 |

    9 | 11 |
    12 |
    13 | 14 |

    There was an unexpected error

    15 |
    16 | 17 |

    18 | An Exception has been occurred! 19 |

    20 | 21 |
    
    22 | 			
    23 | 24 |
    25 |
    26 | 27 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/content/error404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |

    7 | 404 Page not found 8 |

    9 | 11 |
    12 |
    13 | 14 |

    The requested page was not found

    15 | 16 |
    17 |
    18 | 19 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/content/genericError.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |

    7 | There was an unexpected error 8 |

    9 | 11 |
    12 |
    13 |

    404

    14 |

    Error

    15 | Back to Home Page 16 | 17 |
    18 |
    19 | 20 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/content/start.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 | 6 |
    7 |

    8 | Page Header Optional description 9 |

    10 | 11 |
    12 | 13 | 14 |
    15 | 16 | 17 | 18 | 19 | 20 | 21 |
    22 | 23 |
    24 | 25 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/deactivated.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
    13 |
    14 | 15 |
    16 | 17 | 18 |
    19 | 20 | 21 | 22 | 23 | 32 |
    33 | 34 | 42 | 43 | 44 |
    45 | 46 | 56 | 57 |
    58 | 59 | 60 | 61 |
    62 | 63 |
    64 | 65 | 66 | 67 | 68 | 70 |
    71 |
    72 | 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/includes/context.inc.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/includes/controlSideBar.inc.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/includes/dropdownUserMenu.inc.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/includes/footer.inc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | Copyright © 2018 AdminTool. 17 | All rights reserved. (Version: ) 18 | 19 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/includes/integrityCheck.inc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 |
    6 |
    7 |

    8 | 9 | Menu Integrity Errors 10 |

    11 |
    12 |
    13 | 14 |
    15 |

    16 |

    17 | [[${integrityError.error} + '. Occured ' + ${integrityError.menuEntries.size()} + ' times.']] 18 |

      19 |
    • 21 |
    22 |

    23 |
    24 | 25 |
    26 |
    27 | 28 |
    29 | 30 | 31 | 32 |
    33 |

    Menu Integrity Check Successful

    34 |
    35 |
    36 |
    37 | 38 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/includes/js.inc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/includes/leftUserPanel.inc.html: -------------------------------------------------------------------------------- 1 |
    2 | 3 |
    -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/includes/logo.inc.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/includes/menu.inc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | -------------------------------------------------------------------------------- /admin-tools-core/src/main/resources/templates/admintool/includes/searchForm.inc.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /admin-tools-dbbrowser/doc/screen_dbbrowser_org.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-dbbrowser/doc/screen_dbbrowser_org.png -------------------------------------------------------------------------------- /admin-tools-dbbrowser/doc/screen_dbbrowser_org2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-dbbrowser/doc/screen_dbbrowser_org2.png -------------------------------------------------------------------------------- /admin-tools-dbbrowser/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | 6 | 7 | de.chandre.admin-tools 8 | admin-tools 9 | 1.2.0-SNAPSHOT 10 | ../ 11 | 12 | 13 | admin-tools-dbbrowser 14 | 15 | admin-tools database browser 16 | admin-tools database browser 17 | 18 | jar 19 | 20 | 21 | 22 | 23 | de.chandre.admin-tools 24 | admin-tools-core 25 | 26 | 27 | 28 | 29 | org.webjars.bower 30 | codemirror 31 | 5.27.4 32 | 33 | 34 | 35 | commons-codec 36 | commons-codec 37 | 1.10 38 | 39 | 40 | 41 | org.json 42 | json 43 | 44 | 45 | 46 | com.fasterxml.jackson.core 47 | jackson-core 48 | 49 | 50 | com.fasterxml.jackson.core 51 | jackson-databind 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /admin-tools-dbbrowser/src/main/java/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | {"properties": [ 2 | { 3 | "name": "admintool.dbbrowser.enabled", 4 | "type": "java.lang.Boolean", 5 | "description": "A description for 'admintool.dbbrowser.hideMenuItem'" 6 | }, 7 | { 8 | "name": "admintool.dbbrowser.clobEncodings", 9 | "type": "java.util.ArrayList", 10 | "description": "A description for 'admintool.dbbrowser.clobEncodings'" 11 | }, 12 | { 13 | "name": "admintool.dbbrowser.hideMenuItem", 14 | "type": "java.lang.Boolean", 15 | "description": "A description for 'admintool.dbbrowser.hideMenuItem'" 16 | }, 17 | { 18 | "name": "admintool.dbbrowser.dmlAllowed", 19 | "type": "java.lang.Boolean", 20 | "description": "A description for 'admintool.dbbrowser.hideMenuItem'" 21 | }, 22 | { 23 | "name": "admintool.dbbrowser.codeMirrorVersion", 24 | "type": "java.lang.String", 25 | "description": "A description for 'admintool.dbbrowser.clobEncodings'" 26 | }, 27 | { 28 | "name": "admintool.dbbrowser.codeMirrorAddLibs", 29 | "type": "java.util.ArrayList", 30 | "description": "A description for 'admintool.dbbrowser.clobEncodings'" 31 | } 32 | ]} -------------------------------------------------------------------------------- /admin-tools-dbbrowser/src/main/java/de/chandre/admintool/db/AdminToolDBBrowserRoles.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.db; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | import java.util.Collections; 6 | 7 | import org.springframework.stereotype.Component; 8 | 9 | import de.chandre.admintool.core.sec.ATInitRole; 10 | import de.chandre.admintool.core.sec.AdminToolRoles; 11 | import de.chandre.admintool.core.sec.ATInitRole.ATInitRoleBuilder; 12 | 13 | /** 14 | * 15 | * @author Andre 16 | * @since 1.2.0 17 | */ 18 | @Component 19 | public class AdminToolDBBrowserRoles implements AdminToolRoles { 20 | 21 | public static final ATInitRole ROLE_DBBROWSER = ATInitRoleBuilder.builder() 22 | .name("DBBROWSER").displayName("DatabaseBrowser Role").description("This role is for the usage of database browser").build(); 23 | 24 | @Override 25 | public Collection getRoles() { 26 | return Collections.unmodifiableList(Arrays.asList(ROLE_DBBROWSER)); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /admin-tools-dbbrowser/src/main/java/de/chandre/admintool/db/ConnectionVars.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.db; 2 | 3 | /** 4 | * internal class to hold variables to control database connection within the request
    5 | * if DML is not allowed the AutoCommit and ReadOnly configuration should set back to original values 6 | * 7 | * @author Andre 8 | * 9 | */ 10 | public class ConnectionVars 11 | { 12 | private boolean orgAutoCommitState; 13 | private boolean orgReadOnlyState; 14 | 15 | /** 16 | * @return the orgAutoCommitState 17 | */ 18 | public boolean isOrgAutoCommitState() { 19 | return orgAutoCommitState; 20 | } 21 | /** 22 | * @param orgAutoCommitState the orgAutoCommitState to set 23 | */ 24 | public void setOrgAutoCommitState(boolean orgAutoCommitState) { 25 | this.orgAutoCommitState = orgAutoCommitState; 26 | } 27 | /** 28 | * @return the orgReadOnlyState 29 | */ 30 | public boolean isOrgReadOnlyState() { 31 | return orgReadOnlyState; 32 | } 33 | /** 34 | * @param orgReadOnlyState the orgReadOnlyState to set 35 | */ 36 | public void setOrgReadOnlyState(boolean orgReadOnlyState) { 37 | this.orgReadOnlyState = orgReadOnlyState; 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /admin-tools-dbbrowser/src/main/java/de/chandre/admintool/db/ExampleStatement.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.db; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Example statements for DatabaseBrowser 7 | * @author Andre 8 | * 9 | */ 10 | public class ExampleStatement implements Serializable 11 | { 12 | private static final long serialVersionUID = 1L; 13 | 14 | private String statement; 15 | private String description; 16 | 17 | /** 18 | * Creates a new ExampleStatement 19 | */ 20 | public ExampleStatement() { 21 | } 22 | 23 | /** 24 | * Creates a new ExampleStatement instance using fields 25 | * 26 | * @param statement 27 | * @param description 28 | */ 29 | public ExampleStatement(String statement, String description) { 30 | super(); 31 | this.statement = statement; 32 | this.description = description; 33 | } 34 | 35 | 36 | 37 | /** 38 | * @return the statement 39 | */ 40 | public String getStatement() { 41 | return statement; 42 | } 43 | 44 | /** 45 | * the sql statement 46 | * @param statement the statement to set 47 | */ 48 | public void setStatement(String statement) { 49 | this.statement = statement; 50 | } 51 | 52 | /** 53 | * @return the description 54 | */ 55 | public String getDescription() { 56 | return description; 57 | } 58 | 59 | /** 60 | * a description what the statement is for, or what it should return 61 | * @param description the description to set 62 | */ 63 | public void setDescription(String description) { 64 | this.description = description; 65 | } 66 | 67 | 68 | @Override 69 | public String toString() { 70 | StringBuilder builder = new StringBuilder(); 71 | builder.append("ExampleStatement [statement=").append(statement).append(", description=").append(description) 72 | .append("]"); 73 | return builder.toString(); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /admin-tools-dbbrowser/src/main/java/de/chandre/admintool/db/ExampleStatements.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.db; 2 | 3 | import java.io.Serializable; 4 | import java.util.ArrayList; 5 | import java.util.LinkedHashMap; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import javax.xml.bind.annotation.XmlAccessType; 10 | import javax.xml.bind.annotation.XmlAccessorType; 11 | import javax.xml.bind.annotation.XmlRootElement; 12 | 13 | /** 14 | * 15 | * @author Andre 16 | * 17 | */ 18 | @XmlRootElement 19 | @XmlAccessorType(XmlAccessType.PROPERTY) 20 | public class ExampleStatements implements Serializable 21 | { 22 | private static final long serialVersionUID = 1L; 23 | 24 | private String datasourceName; 25 | private Map> clusters = new LinkedHashMap<>(); 26 | 27 | /** 28 | * @return the datasourceName 29 | */ 30 | public String getDatasourceName() { 31 | return datasourceName; 32 | } 33 | 34 | /** 35 | * @param datasourceName the datasourceName to set 36 | */ 37 | public void setDatasourceName(String datasourceName) { 38 | this.datasourceName = datasourceName; 39 | } 40 | 41 | public Map> getClusters() { 42 | return clusters; 43 | } 44 | 45 | public void addClusters(String clusterName, List examples) { 46 | this.clusters.put(clusterName, examples); 47 | } 48 | 49 | public void addExample(String clusterName, ExampleStatement examples) { 50 | if (null == this.clusters.get(clusterName)) { 51 | this.clusters.put(clusterName, new ArrayList<>()); 52 | } 53 | this.clusters.get(clusterName).add(examples); 54 | } 55 | 56 | public void setClusters(Map> clusters) { 57 | this.clusters = clusters; 58 | } 59 | 60 | /* (non-Javadoc) 61 | * @see java.lang.Object#toString() 62 | */ 63 | @Override 64 | public String toString() { 65 | StringBuilder builder = new StringBuilder(); 66 | builder.append("ExampleStatements [datasourceName=").append(datasourceName).append(", clusters=") 67 | .append(clusters).append("]"); 68 | return builder.toString(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /admin-tools-dbbrowser/src/main/java/de/chandre/admintool/db/Vendor.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.db; 2 | 3 | public enum Vendor { 4 | MYSQL, H2, DB2, HSQL, ORACLE, MSSQL, INFORMIX, POSTGRE, SYBASE 5 | } 6 | -------------------------------------------------------------------------------- /admin-tools-dbbrowser/src/main/resources/i18n/admintool/dbbrowser-messages.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.dbbrowser.displayName=DB Browser -------------------------------------------------------------------------------- /admin-tools-dbbrowser/src/main/resources/i18n/admintool/dbbrowser-messages_en.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.dbbrowser.displayName=DB Browser -------------------------------------------------------------------------------- /admin-tools-dbbrowser/src/main/resources/static/admintool/dbbrowser/css/dbbrowser.css: -------------------------------------------------------------------------------- 1 | .CodeMirror { 2 | border: 1px solid #eee; 3 | height: auto; 4 | /* Code Mirror Settings */ 5 | font-family: monospace; 6 | position: relative; 7 | overflow: hidden; 8 | } 9 | 10 | .CodeMirror-focused { 11 | /* Bootstrap Settings */ 12 | border-color: #66afe9; 13 | outline: 0; 14 | box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6); 15 | transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; 16 | } 17 | 18 | option.emptyOption { 19 | color: #a2a2a2; 20 | font-style: italic; 21 | } 22 | 23 | span.dbInfo { 24 | margin-left: 20px; 25 | font-size: 12px; 26 | color: #a2a2a2; 27 | } 28 | #addTab { 29 | cursor: pointer; 30 | } 31 | i.fa-trash { 32 | cursor: pointer; 33 | } 34 | 35 | document { 36 | overflow: scroll; 37 | } -------------------------------------------------------------------------------- /admin-tools-dbbrowser/src/main/resources/templates/admintool/dbbrowser/content/dbbrowser.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |

    7 | Database Browser 8 |

    9 | 10 |
    11 | 12 |
    13 | 14 | 31 | 32 | 33 |
    34 |
    35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/java/de/chandre/admintool/DemoController.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.stereotype.Controller; 5 | import org.springframework.ui.ModelMap; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | 8 | import de.chandre.admintool.core.AdminTool; 9 | 10 | /** 11 | * Demo controller 12 | * @author Andre 13 | * 14 | */ 15 | @Controller 16 | public class DemoController { 17 | 18 | @Autowired 19 | private AdminTool adminTool; 20 | 21 | @RequestMapping({"","/"}) 22 | public String hello() { 23 | return "index"; 24 | } 25 | 26 | @RequestMapping({"/info"}) 27 | public String admintoolInfo(ModelMap model) { 28 | model.put("adminToolInfo", adminTool.toString()); 29 | return "info"; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/java/de/chandre/admintool/ExampleMXBean.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool; 2 | 3 | import java.time.LocalDate; 4 | import java.time.LocalDateTime; 5 | import java.util.Date; 6 | 7 | import org.springframework.stereotype.Component; 8 | 9 | import de.chandre.admintool.core.AdminToolConfig; 10 | 11 | @Component 12 | public class ExampleMXBean implements AdminToolConfig { 13 | 14 | private Double myDouble = Double.valueOf(123.456d); 15 | private double myPrimitiveDouble = 654.321d; 16 | 17 | public Date getDate() { 18 | return new Date(); 19 | } 20 | 21 | public LocalDate getLocalDate() { 22 | return LocalDate.now(); 23 | } 24 | 25 | public LocalDateTime getLocalDateTime() { 26 | return LocalDateTime.now(); 27 | } 28 | 29 | public Double getDouble() { 30 | return myDouble; 31 | } 32 | 33 | public void setDouble(Double doubleValue) { 34 | this.myDouble = doubleValue; 35 | } 36 | 37 | public double getPrimitiveDouble() { 38 | return this.myPrimitiveDouble; 39 | } 40 | 41 | public void setPrimitiveDouble(double doubleValue) { 42 | this.myPrimitiveDouble = doubleValue; 43 | } 44 | 45 | @Override 46 | public void printConfig() { 47 | 48 | } 49 | 50 | @Override 51 | public boolean isEnabled() { 52 | return true; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/java/de/chandre/admintool/jobs/InterruptableSampleJob.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.jobs; 2 | 3 | import org.apache.logging.log4j.LogManager; 4 | import org.apache.logging.log4j.Logger; 5 | import org.quartz.InterruptableJob; 6 | import org.quartz.Job; 7 | import org.quartz.JobExecutionContext; 8 | import org.quartz.UnableToInterruptJobException; 9 | 10 | /** 11 | * simple example of Quartz job 12 | * @author Andre 13 | * 14 | */ 15 | public class InterruptableSampleJob implements Job, InterruptableJob 16 | { 17 | private static final Logger LOGGER = LogManager.getFormatterLogger(InterruptableSampleJob.class); 18 | 19 | private Thread thread; 20 | 21 | @Override 22 | public void execute(JobExecutionContext jobExecutionContext) { 23 | LOGGER.info("start executing job: %s", jobExecutionContext.getJobDetail().getKey().getName()); 24 | thread = new Thread(new Runnable() { 25 | @Override 26 | public void run() { 27 | try { 28 | Thread.sleep(120000L); 29 | } catch (InterruptedException e) { 30 | // TODO Auto-generated catch block 31 | e.printStackTrace(); 32 | } 33 | } 34 | }); 35 | thread.run(); 36 | LOGGER.info("finished executing job: %s", jobExecutionContext.getJobDetail().getKey().getName()); 37 | } 38 | 39 | @Override 40 | public void interrupt() throws UnableToInterruptJobException { 41 | if (null != thread) { 42 | LOGGER.info("interrupting job"); 43 | thread.interrupt(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/java/de/chandre/admintool/jobs/SimpleCronJob.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.jobs; 2 | 3 | import org.apache.logging.log4j.LogManager; 4 | import org.apache.logging.log4j.Logger; 5 | import org.quartz.Job; 6 | import org.quartz.JobExecutionContext; 7 | 8 | /** 9 | * simple example of Quartz job 10 | * @author Andre 11 | * 12 | */ 13 | public class SimpleCronJob implements Job 14 | { 15 | private static final Logger LOGGER = LogManager.getFormatterLogger(SimpleCronJob.class); 16 | 17 | @Override 18 | public void execute(JobExecutionContext jobExecutionContext) { 19 | LOGGER.info("executing cron job: %s", jobExecutionContext.getJobDetail().getKey().getName()); 20 | try { 21 | Thread.sleep(30000L); 22 | } catch (InterruptedException e) { 23 | LOGGER.error(e.getMessage(), e); 24 | } 25 | LOGGER.info("finished executing cron job: %s", jobExecutionContext.getJobDetail().getKey().getName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/java/de/chandre/admintool/jobs/SimpleJob.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.jobs; 2 | 3 | import org.apache.logging.log4j.LogManager; 4 | import org.apache.logging.log4j.Logger; 5 | import org.quartz.DisallowConcurrentExecution; 6 | import org.quartz.Job; 7 | import org.quartz.JobExecutionContext; 8 | 9 | /** 10 | * simple example of Quartz job 11 | * @author Andre 12 | * 13 | */ 14 | @DisallowConcurrentExecution 15 | public class SimpleJob implements Job 16 | { 17 | private static final Logger LOGGER = LogManager.getFormatterLogger(SimpleJob.class); 18 | 19 | @Override 20 | public void execute(JobExecutionContext jobExecutionContext) { 21 | LOGGER.info("start executing job: %s", jobExecutionContext.getJobDetail().getKey().getName()); 22 | try { 23 | Thread.sleep(20000L); 24 | } catch (InterruptedException e) { 25 | LOGGER.error(e.getMessage(), e); 26 | } 27 | LOGGER.info("
    I'm div
    "); 28 | LOGGER.warn("Warning with umlauts äöü &"); 29 | LOGGER.info("I'm a XML"); 30 | LOGGER.info("finished executing job: %s", jobExecutionContext.getJobDetail().getKey().getName()); 31 | 32 | StackTraceElement[] trace = Thread.currentThread().getStackTrace(); 33 | if (null != trace) { 34 | StringBuilder traceStr = new StringBuilder("Example Trace"); 35 | for (StackTraceElement stackTraceElement : trace) { 36 | traceStr.append("\n").append(stackTraceElement.toString()); 37 | } 38 | LOGGER.error(traceStr); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/java/de/chandre/admintool/persistance/LocalDateTimeAttributeConverter.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.persistance; 2 | 3 | import java.sql.Timestamp; 4 | import java.time.LocalDateTime; 5 | 6 | import javax.persistence.AttributeConverter; 7 | import javax.persistence.Converter; 8 | 9 | @Converter(autoApply = true) 10 | public class LocalDateTimeAttributeConverter implements AttributeConverter { 11 | 12 | @Override 13 | public Timestamp convertToDatabaseColumn(LocalDateTime locDateTime) { 14 | return (locDateTime == null ? null : Timestamp.valueOf(locDateTime)); 15 | } 16 | 17 | @Override 18 | public LocalDateTime convertToEntityAttribute(Timestamp sqlTimestamp) { 19 | return (sqlTimestamp == null ? null : sqlTimestamp.toLocalDateTime()); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/java/de/chandre/admintool/persistance/TransactionConfig.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.persistance; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.orm.jpa.JpaTransactionManager; 6 | import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; 7 | import org.springframework.transaction.PlatformTransactionManager; 8 | import org.springframework.transaction.annotation.EnableTransactionManagement; 9 | 10 | @Configuration 11 | @EnableTransactionManagement 12 | public class TransactionConfig 13 | { 14 | @Bean 15 | public PlatformTransactionManager transactionManager(LocalContainerEntityManagerFactoryBean entityManagerFactory) { 16 | JpaTransactionManager transactionManager = new JpaTransactionManager(); 17 | transactionManager.setEntityManagerFactory(entityManagerFactory.getObject()); 18 | return transactionManager; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/resources/i18n/admintool/demo-messages.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.demo.displayName=Demo-App-Component 2 | ui.admintool.core.demo.dashboard.displayName=Dashboard 3 | ui.admintool.core.demo.dashboard2.displayName=Dashboard 2 4 | ui.admintool.core.demo.subMulti.displayName=SubMulti 5 | ui.admintool.core.demo.subMulti.dashboard3.displayName=Dashboard 3 6 | ui.admintool.core.demo.subMulti.dashboard4.displayName=Dashboard 4 7 | ui.admintool.core.demo.dashboard5.displayName=Dashboard 5 -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/resources/i18n/admintool/demo-messages_en.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.demo.displayName=Demo-App-Component 2 | ui.admintool.core.demo.dashboard.displayName=Dashboard 3 | ui.admintool.core.demo.dashboard2.displayName=Dashboard 2 4 | ui.admintool.core.demo.subMulti.displayName=SubMulti 5 | ui.admintool.core.demo.subMulti.dashboard3.displayName=Dashboard 3 6 | ui.admintool.core.demo.subMulti.dashboard4.displayName=Dashboard 4 7 | ui.admintool.core.demo.dashboard5.displayName=Dashboard 5 -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/resources/templates/admintool/content/dashboard.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |

    7 | Demo Dashboard Part 1 8 |

    9 | 11 |
    12 | 13 | 14 |
    15 | 16 | AdminLTE 18 | 19 |
    20 | 21 |
    22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/resources/templates/admintool/content/dashboard2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |

    7 | Demo Dashboard Part 2 8 |

    9 | 11 |
    12 | 13 | 14 |
    15 | 16 | AdminLTE 18 | 19 |
    20 | 21 |
    22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/resources/templates/admintool/content/dashboard3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |

    7 | Demo Dashboard Part 3 8 |

    9 | 11 |
    12 | 13 | 14 |
    15 | 16 | AdminLTE 18 | 19 |
    20 | 21 |
    22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/resources/templates/admintool/content/dashboard4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 | 6 |
    7 |

    8 | Demo Dashboard Part 4 9 |

    10 | 12 |
    13 | 14 | 15 |
    16 | 17 | AdminLTE 19 | 20 |
    21 | 22 |
    23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/resources/templates/admintool/notifications/notification.html: -------------------------------------------------------------------------------- 1 | 2 | 33 | 34 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | AdminTool 12 | 13 | 17 | 18 | 19 | 20 |
    21 |

    Hello Universe

    22 | Go to AdminTool 23 |
    24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /admin-tools-demo-core/src/main/resources/templates/info.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | AdminTool 12 | 13 | 17 | 18 | 19 | 20 |
    21 |

    Hello Universe

    22 | Go to AdminTool 23 | 24 |
    
    25 | 		
    26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /admin-tools-demo-jar/README.md: -------------------------------------------------------------------------------- 1 | # The Demo-Project 2 | > A Simple Spring-Boot project to show the tools 3 | 4 | ## Introduced with 5 | * admin-tools-core:1.0.0 6 | 7 | ## Usage 8 | 9 | 1. Download the project 10 | 2. execute a `mvn clean install` or import to your IDE 11 | 3. run the demo JAR or start within your IDE 12 | 4. add a system parameter for log file folder: -Dapp.logdir=<absolute-path-to-logfilefolder> 13 | 5. go to localhost:8090/ or localhost:8090/admintool 14 | 15 | You can change the application configuration (like port etc.) in /src/main/resources/application.properties 16 | 17 | Some URLs are secured 18 | * `/monitoring`: operator/operator or admin/admin (also within the adminTool) 19 | * `/jmx/`: operator/operator or admin/admin (also within the adminTool) 20 | * `/admintool/dbbrowser`: admin/admin (within the adminTool) 21 | -------------------------------------------------------------------------------- /admin-tools-demo-jar/src/main/java/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | {"properties": [ 2 | { 3 | "name": "admintool.core.useCDN", 4 | "type": "java.lang.Boolean", 5 | "description": "A description for 'admintool.core.useCDN'" 6 | }, 7 | { 8 | "name": "jminix.urlMappings", 9 | "type": "java.lang.String", 10 | "description": "A description for 'jminix.urlMappings'" 11 | } 12 | ]} -------------------------------------------------------------------------------- /admin-tools-demo-jar/src/main/java/de/chandre/admintool/Application.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.apache.logging.log4j.LogManager; 6 | import org.apache.logging.log4j.Logger; 7 | import org.springframework.boot.SpringApplication; 8 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; 10 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 11 | import org.springframework.boot.web.servlet.ServletComponentScan; 12 | import org.springframework.context.ApplicationContext; 13 | import org.springframework.context.annotation.ComponentScan; 14 | import org.springframework.context.annotation.EnableMBeanExport; 15 | 16 | /** 17 | * The Spring Boot starter class 18 | * @author adhr 19 | * 20 | */ 21 | @SpringBootApplication 22 | @EnableAutoConfiguration 23 | @EnableConfigurationProperties 24 | @ServletComponentScan(basePackages={"de.chandre.admintool"}) 25 | @EnableMBeanExport 26 | //required in own application to get admintool scanned 27 | @ComponentScan(basePackages={"de.chandre.admintool"}) 28 | public class Application 29 | { 30 | private static final Logger LOGGER = LogManager.getFormatterLogger(Application.class); 31 | 32 | public static void main(String[] args) 33 | { 34 | LOGGER.info("starting admin tool boot app"); 35 | ApplicationContext ctx = SpringApplication.run(Application.class, args); 36 | 37 | if (LOGGER.isDebugEnabled()) { 38 | String[] beanNames = ctx.getBeanDefinitionNames(); 39 | Arrays.sort(beanNames); 40 | for (String beanName : beanNames) { 41 | LOGGER.trace(beanName); 42 | } 43 | } 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /admin-tools-demo-jar/src/main/java/de/chandre/admintool/security/AdminToolAuthManagerWrapper.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security; 2 | 3 | import org.springframework.security.authentication.AuthenticationManager; 4 | import org.springframework.security.core.Authentication; 5 | import org.springframework.security.core.AuthenticationException; 6 | import org.springframework.security.web.authentication.WebAuthenticationDetails; 7 | 8 | public class AdminToolAuthManagerWrapper implements AuthenticationManager { 9 | 10 | private AuthenticationManager original; 11 | public AdminToolAuthManagerWrapper(AuthenticationManager original) { 12 | this.original = original; 13 | } 14 | 15 | @Override 16 | public Authentication authenticate(Authentication authentication) throws AuthenticationException { 17 | WebAuthenticationDetails auth = (WebAuthenticationDetails) authentication.getDetails(); 18 | //just for debugging and playing around 19 | return this.original.authenticate(authentication); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /admin-tools-demo-jar/src/main/java/de/chandre/admintool/security/AdminToolInMemoryUserDetailsConfigurer.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security; 2 | 3 | import org.springframework.security.config.annotation.authentication.ProviderManagerBuilder; 4 | import org.springframework.security.config.annotation.authentication.configurers.provisioning.InMemoryUserDetailsManagerConfigurer; 5 | import org.springframework.security.config.annotation.authentication.configurers.provisioning.UserDetailsManagerConfigurer; 6 | 7 | public class AdminToolInMemoryUserDetailsConfigurer> 8 | extends UserDetailsManagerConfigurer> { 9 | 10 | public AdminToolInMemoryUserDetailsConfigurer(AdminToolInMemoryUserDetailsService userDetailsService) { 11 | super(userDetailsService); 12 | } 13 | 14 | @Override 15 | public AdminToolInMemoryUserDetailsService getUserDetailsService() { 16 | return (AdminToolInMemoryUserDetailsService) super.getUserDetailsService(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /admin-tools-demo-jar/src/main/java/de/chandre/admintool/security/AdminToolSecurityLoader.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security; 2 | 3 | import javax.annotation.PostConstruct; 4 | 5 | import org.springframework.stereotype.Component; 6 | 7 | import de.chandre.admintool.security.simple.auth.AbstractAdminToolSecurityViewLoader; 8 | 9 | @Component 10 | public class AdminToolSecurityLoader extends AbstractAdminToolSecurityViewLoader { 11 | 12 | @PostConstruct 13 | public void init() { 14 | super.addUsersMenu(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /admin-tools-demo-jar/src/main/java/de/chandre/admintool/security/SecurityBeans.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | import de.chandre.admintool.security.commons.auth.AdminToolAuthenticationFailureListener; 7 | import de.chandre.admintool.security.commons.auth.AdminToolAuthenticationSuccessListener; 8 | import de.chandre.admintool.security.commons.auth.LoginAttemptService; 9 | import de.chandre.admintool.security.commons.auth.LoginAttemptServiceImpl; 10 | 11 | @Configuration 12 | public class SecurityBeans { 13 | 14 | @Bean 15 | public LoginAttemptService loginAttemptService() { 16 | return new LoginAttemptServiceImpl(2); 17 | } 18 | 19 | @Bean 20 | public AdminToolInMemoryUserDetailsService userDetailsService(LoginAttemptService loginAttemptService) { 21 | AdminToolInMemoryUserDetailsService uds = new AdminToolInMemoryUserDetailsService(); 22 | uds.setInfoMessage("Because this application is using in-memory authentication, all changes are obsolete after restart."); 23 | uds.setLoginAttemptService(loginAttemptService); 24 | return uds; 25 | } 26 | 27 | @Bean 28 | public AdminToolAuthenticationFailureListener adminToolAuthenticationFailureListener(LoginAttemptService loginAttemptService) { 29 | return new AdminToolAuthenticationFailureListener(loginAttemptService); 30 | } 31 | 32 | @Bean 33 | public AdminToolAuthenticationSuccessListener adminToolAuthenticationSuccessListener(LoginAttemptService loginAttemptService) { 34 | return new AdminToolAuthenticationSuccessListener(loginAttemptService); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /admin-tools-demo-war/src/main/java/de/chandre/admintool/WarApplication.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool; 2 | 3 | import java.util.Arrays; 4 | 5 | import org.apache.logging.log4j.LogManager; 6 | import org.apache.logging.log4j.Logger; 7 | import org.springframework.boot.SpringApplication; 8 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; 10 | import org.springframework.boot.builder.SpringApplicationBuilder; 11 | import org.springframework.boot.web.servlet.ServletComponentScan; 12 | import org.springframework.boot.web.support.SpringBootServletInitializer; 13 | import org.springframework.context.ApplicationContext; 14 | import org.springframework.context.annotation.ComponentScan; 15 | import org.springframework.context.annotation.EnableMBeanExport; 16 | 17 | /** 18 | * The Spring Boot starter class 19 | * @author adhr 20 | * 21 | */ 22 | @SpringBootApplication 23 | @EnableAutoConfiguration 24 | @ServletComponentScan(basePackages={"de.chandre.admintool"}) 25 | @EnableMBeanExport 26 | //required in own application to get admintool scanned 27 | @ComponentScan(basePackages={"de.chandre.admintool"}) 28 | public class WarApplication extends SpringBootServletInitializer 29 | { 30 | private static final Logger LOGGER = LogManager.getFormatterLogger(WarApplication.class); 31 | 32 | @Override 33 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 34 | return application.sources(WarApplication.class); 35 | } 36 | 37 | public static void main(String[] args) 38 | { 39 | LOGGER.info("starting admin tool boot app"); 40 | ApplicationContext ctx = SpringApplication.run(WarApplication.class, args); 41 | 42 | if (LOGGER.isDebugEnabled()) { 43 | String[] beanNames = ctx.getBeanDefinitionNames(); 44 | Arrays.sort(beanNames); 45 | for (String beanName : beanNames) { 46 | LOGGER.trace(beanName); 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /admin-tools-demo-war/src/main/java/de/chandre/admintool/security/AdminToolAuthManagerWrapper.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security; 2 | 3 | import org.springframework.security.authentication.AuthenticationManager; 4 | import org.springframework.security.core.Authentication; 5 | import org.springframework.security.core.AuthenticationException; 6 | import org.springframework.security.web.authentication.WebAuthenticationDetails; 7 | 8 | public class AdminToolAuthManagerWrapper implements AuthenticationManager { 9 | 10 | private AuthenticationManager original; 11 | public AdminToolAuthManagerWrapper(AuthenticationManager original) { 12 | this.original = original; 13 | } 14 | 15 | @Override 16 | public Authentication authenticate(Authentication authentication) throws AuthenticationException { 17 | WebAuthenticationDetails auth = (WebAuthenticationDetails) authentication.getDetails(); 18 | //just for debugging and playing around 19 | return this.original.authenticate(authentication); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /admin-tools-demo-war/src/main/java/de/chandre/admintool/security/AdminToolInMemoryUserDetailsConfigurer.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security; 2 | 3 | import org.springframework.security.config.annotation.authentication.ProviderManagerBuilder; 4 | import org.springframework.security.config.annotation.authentication.configurers.provisioning.InMemoryUserDetailsManagerConfigurer; 5 | import org.springframework.security.config.annotation.authentication.configurers.provisioning.UserDetailsManagerConfigurer; 6 | 7 | public class AdminToolInMemoryUserDetailsConfigurer> 8 | extends UserDetailsManagerConfigurer> { 9 | 10 | public AdminToolInMemoryUserDetailsConfigurer(AdminToolInMemoryUserDetailsService userDetailsService) { 11 | super(userDetailsService); 12 | } 13 | 14 | @Override 15 | public AdminToolInMemoryUserDetailsService getUserDetailsService() { 16 | return (AdminToolInMemoryUserDetailsService) super.getUserDetailsService(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /admin-tools-demo-war/src/main/java/de/chandre/admintool/security/AdminToolSecurityLoader.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security; 2 | 3 | import javax.annotation.PostConstruct; 4 | 5 | import org.springframework.stereotype.Component; 6 | 7 | import de.chandre.admintool.security.simple.auth.AbstractAdminToolSecurityViewLoader; 8 | 9 | @Component 10 | public class AdminToolSecurityLoader extends AbstractAdminToolSecurityViewLoader { 11 | 12 | @PostConstruct 13 | public void init() { 14 | super.addUsersMenu(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /admin-tools-demo-war/src/main/java/de/chandre/admintool/security/SecurityBeans.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | import de.chandre.admintool.security.commons.auth.AdminToolAuthenticationFailureListener; 7 | import de.chandre.admintool.security.commons.auth.AdminToolAuthenticationSuccessListener; 8 | import de.chandre.admintool.security.commons.auth.LoginAttemptService; 9 | import de.chandre.admintool.security.commons.auth.LoginAttemptServiceImpl; 10 | 11 | @Configuration 12 | public class SecurityBeans { 13 | 14 | @Bean 15 | public LoginAttemptService loginAttemptService() { 16 | return new LoginAttemptServiceImpl(2); 17 | } 18 | 19 | @Bean 20 | public AdminToolInMemoryUserDetailsService userDetailsService(LoginAttemptService loginAttemptService) { 21 | AdminToolInMemoryUserDetailsService uds = new AdminToolInMemoryUserDetailsService(); 22 | uds.setInfoMessage("Because this application is using in-memory authentication, all changes are obsolete after restart."); 23 | uds.setLoginAttemptService(loginAttemptService); 24 | return uds; 25 | } 26 | 27 | @Bean 28 | public AdminToolAuthenticationFailureListener adminToolAuthenticationFailureListener(LoginAttemptService loginAttemptService) { 29 | return new AdminToolAuthenticationFailureListener(loginAttemptService); 30 | } 31 | 32 | @Bean 33 | public AdminToolAuthenticationSuccessListener adminToolAuthenticationSuccessListener(LoginAttemptService loginAttemptService) { 34 | return new AdminToolAuthenticationSuccessListener(loginAttemptService); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /admin-tools-demo-war/src/main/resources/templates/admintool/content/myDashboard.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |

    7 | Demo MyDashboard Part 1 8 |

    9 | 11 |
    12 | 13 | 14 |
    15 | 16 | AdminLTE 18 | 19 |
    20 | 21 |
    22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /admin-tools-demo-war/src/main/resources/templates/admintool/content/myDashboard2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |

    7 | Demo MyDashboard Part 2 8 |

    9 | 11 |
    12 | 13 | 14 |
    15 | 16 | AdminLTE 18 | 19 |
    20 | 21 |
    22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /admin-tools-filebrowser/doc/screen_filebrowser_org.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-filebrowser/doc/screen_filebrowser_org.png -------------------------------------------------------------------------------- /admin-tools-filebrowser/doc/screen_fileviewer_org.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-filebrowser/doc/screen_fileviewer_org.png -------------------------------------------------------------------------------- /admin-tools-filebrowser/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | 6 | 7 | de.chandre.admin-tools 8 | admin-tools 9 | 1.2.0-SNAPSHOT 10 | ../ 11 | 12 | 13 | admin-tools-filebrowser 14 | 15 | admin-tools file browser 16 | admin-tools file browser 17 | 18 | jar 19 | 20 | 21 | 22 | 23 | de.chandre.admin-tools 24 | admin-tools-core 25 | 26 | 27 | 28 | 29 | commons-io 30 | commons-io 31 | 2.5 32 | 33 | 34 | 35 | commons-codec 36 | commons-codec 37 | 1.10 38 | 39 | 40 | 41 | org.webjars.bower 42 | codemirror 43 | 5.27.4 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/java/de/chandre/admintool/filebrowser/ATFileBrowserPermissions.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.filebrowser; 2 | 3 | import java.io.File; 4 | 5 | /** 6 | * 7 | * @author Andre 8 | * @since 1.2.0 9 | */ 10 | public interface ATFileBrowserPermissions { 11 | 12 | boolean isCreateFolderAllowed(String currentDir); 13 | 14 | boolean isUploadFileAllowed(String currentDir); 15 | 16 | boolean isDeleteFileAllowed(File currentFile); 17 | 18 | boolean isDeleteFolderAllowed(File currentDir); 19 | 20 | boolean isDownloadAllowed(File currentDir); 21 | 22 | boolean isDownloadCompressedAllowed(File currentDir); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/java/de/chandre/admintool/filebrowser/ATFilebrowserDefaultPermissionHandler.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.filebrowser; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | 8 | import de.chandre.admintool.core.sec.ATAbstractPermissionHandler; 9 | 10 | /** 11 | * 12 | * @author Andre 13 | * @since 1.2.0 14 | */ 15 | public class ATFilebrowserDefaultPermissionHandler extends ATAbstractPermissionHandler implements ATFilebrowserPermissionHandler { 16 | 17 | @Autowired 18 | private AdminToolFilebrowserConfig config; 19 | 20 | 21 | @Override 22 | public boolean isAllowed(File path, boolean write, AdminToolFilebrowserService delegate) throws IOException { 23 | return delegate.isAllowed(path, write, config.isReadOnly()); 24 | } 25 | 26 | @Override 27 | public boolean isCreateFolderAllowed(String currentDir) { 28 | return config.isCreateFolderAllowed() && userHasRole(AdminToolFileBrowserRoles.ROLE_FILEBROWSER_CREATEFOLDER); 29 | } 30 | 31 | @Override 32 | public boolean isUploadFileAllowed(String currentDir) { 33 | return config.isUploadAllowed() && userHasRole(AdminToolFileBrowserRoles.ROLE_FILEBROWSER_UPLOAD); 34 | } 35 | 36 | @Override 37 | public boolean isDeleteFileAllowed(File currentFile) { 38 | return config.isDeleteFileAllowed() && userHasRole(AdminToolFileBrowserRoles.ROLE_FILEBROWSER_DELETEFILE); 39 | } 40 | 41 | @Override 42 | public boolean isDeleteFolderAllowed(File currentDir) { 43 | return config.isDeleteFolderAllowed() && userHasRole(AdminToolFileBrowserRoles.ROLE_FILEBROWSER_DELETEFOLDER); 44 | } 45 | 46 | @Override 47 | public boolean isDownloadAllowed(File currentDir) { 48 | return config.isDownloadAllowed() && userHasRole(AdminToolFileBrowserRoles.ROLE_FILEBROWSER_DOWNLOAD); 49 | } 50 | 51 | @Override 52 | public boolean isDownloadCompressedAllowed(File currentDir) { 53 | return config.isDownloadCompressedAllowed() && userHasRole(AdminToolFileBrowserRoles.ROLE_FILEBROWSER_DOWNLOADZIP); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/java/de/chandre/admintool/filebrowser/ATFilebrowserPermissionHandler.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.filebrowser; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | /** 7 | * 8 | * @author Andre 9 | * @since 1.2.0 10 | */ 11 | public interface ATFilebrowserPermissionHandler extends ATFileBrowserPermissions{ 12 | 13 | boolean isAllowed(File path, boolean write, AdminToolFilebrowserService delegate) throws IOException; 14 | } 15 | -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/java/de/chandre/admintool/filebrowser/DownloadNotAllowedException.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.filebrowser; 2 | 3 | public class DownloadNotAllowedException extends Exception { 4 | 5 | private static final long serialVersionUID = 1L; 6 | 7 | public DownloadNotAllowedException() { 8 | super(); 9 | } 10 | 11 | public DownloadNotAllowedException(String message) { 12 | super(message); 13 | } 14 | 15 | public DownloadNotAllowedException(Throwable trowable) { 16 | super(trowable); 17 | } 18 | 19 | public DownloadNotAllowedException(String message, Throwable trowable) { 20 | super(message, trowable); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/java/de/chandre/admintool/filebrowser/GenericFilebrowserException.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.filebrowser; 2 | 3 | public class GenericFilebrowserException extends Exception { 4 | 5 | private static final long serialVersionUID = 1L; 6 | 7 | public GenericFilebrowserException() { 8 | super(); 9 | } 10 | 11 | public GenericFilebrowserException(String message) { 12 | super(message); 13 | } 14 | 15 | public GenericFilebrowserException(Throwable trowable) { 16 | super(trowable); 17 | } 18 | 19 | public GenericFilebrowserException(String message, Throwable trowable) { 20 | super(message, trowable); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/java/de/chandre/admintool/filebrowser/SortColumn.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.filebrowser; 2 | 3 | /** 4 | * 5 | * @author Andre 6 | * 7 | */ 8 | public enum SortColumn { 9 | 10 | NAME(1), 11 | SIZE(2), 12 | TYPE(3), 13 | DATE(4); 14 | 15 | private int index; 16 | private SortColumn(int index) { 17 | this.index = index; 18 | } 19 | 20 | public static SortColumn fromIndex(String indexStr) { 21 | int index = -1; 22 | try { 23 | index = Integer.parseInt(indexStr); 24 | } catch (Exception ignore) {} 25 | for (SortColumn sortCol : values()) { 26 | if (sortCol.index == index) { 27 | return sortCol; 28 | } 29 | } 30 | return null; 31 | } 32 | 33 | public static SortColumn fromIndex(int index) { 34 | for (SortColumn sortCol : values()) { 35 | if (sortCol.index == index) { 36 | return sortCol; 37 | } 38 | } 39 | return null; 40 | } 41 | 42 | /** 43 | * @return the index 44 | */ 45 | public int getIndex() { 46 | return index; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/java/de/chandre/admintool/fileviewer/ATFileviewerDefaultPermissionHandler.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.fileviewer; 2 | 3 | import java.io.File; 4 | 5 | import de.chandre.admintool.core.sec.ATAbstractPermissionHandler; 6 | import de.chandre.admintool.filebrowser.GenericFilebrowserException; 7 | 8 | /** 9 | * 10 | * @author André 11 | * @since 1.2.0 12 | * 13 | */ 14 | public class ATFileviewerDefaultPermissionHandler extends ATAbstractPermissionHandler implements ATFileviewerPermissionHandler { 15 | 16 | @Override 17 | public boolean isAllowed(File path, boolean write, AdminToolFileviewerService delegate) throws GenericFilebrowserException { 18 | delegate.isFileAllowed(path, write); 19 | return true; 20 | } 21 | 22 | @Override 23 | public boolean isChangeable(File file, AdminToolFileviewerService delegate) { 24 | return delegate.isExtensionAllowedAndWriteable(file) && userHasRole(AdminToolFileViewerRoles.ROLE_FILEVIEWER_CHANGE); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/java/de/chandre/admintool/fileviewer/ATFileviewerPermissionHandler.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.fileviewer; 2 | 3 | import java.io.File; 4 | 5 | import de.chandre.admintool.filebrowser.GenericFilebrowserException; 6 | 7 | /** 8 | * 9 | * @author André 10 | * @since 1.2.0 11 | * 12 | */ 13 | public interface ATFileviewerPermissionHandler { 14 | 15 | boolean isAllowed(File path, boolean write, AdminToolFileviewerService delegate) throws GenericFilebrowserException; 16 | 17 | /** 18 | * CAUTION: do NOT call delegate.isChangeable. This will lead to circular calls and will end in Stack-Overflow-Exception 19 | * @param file 20 | * @param delegate 21 | * @return 22 | */ 23 | boolean isChangeable(File file, AdminToolFileviewerService delegate); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/java/de/chandre/admintool/fileviewer/AdminToolFileViewerRoles.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.fileviewer; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | import java.util.Collections; 6 | 7 | import org.springframework.stereotype.Component; 8 | 9 | import de.chandre.admintool.core.sec.ATInitRole; 10 | import de.chandre.admintool.core.sec.AdminToolRoles; 11 | import de.chandre.admintool.core.sec.ATInitRole.ATInitRoleBuilder; 12 | 13 | /** 14 | * 15 | * @author Andre 16 | * @since 1.2.0 17 | */ 18 | @Component 19 | public class AdminToolFileViewerRoles implements AdminToolRoles { 20 | 21 | public static final ATInitRole ROLE_FILEVIEWER = ATInitRoleBuilder.builder() 22 | .name("FILEVIEWER").displayName("FileViewer Role").description("This role is for the usage of file viewer").build(); 23 | 24 | public static final ATInitRole ROLE_FILEVIEWER_CHANGE = ATInitRoleBuilder.builder() 25 | .name("FILEVIEWER_CHANGE").displayName("FileViewer Change").description("Allows change file functionality").build(); 26 | 27 | @Override 28 | public Collection getRoles() { 29 | return Collections.unmodifiableList(Arrays.asList(ROLE_FILEVIEWER, ROLE_FILEVIEWER_CHANGE)); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/css/filebrowser.css: -------------------------------------------------------------------------------- 1 | #fileListForm td, #fileListForm td a { 2 | font-size: 12px; 3 | } 4 | #fileListForm td { 5 | padding: 4px 8px; 6 | } 7 | #fileListForm td.normal { 8 | padding: 8px 8px; 9 | font-size: 14px; 10 | } 11 | #fileListForm td a.btn, #fileListForm td button.btn { 12 | margin-right: 1px; 13 | } 14 | 15 | .not-readable { 16 | 17 | } 18 | 19 | .not-writeable { 20 | 21 | } 22 | 23 | .file-hidden { 24 | font-style: italic; 25 | } 26 | 27 | .modal-middle-header{ 28 | padding: 0px 15px; 29 | } -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/css/fileviewer.css: -------------------------------------------------------------------------------- 1 | .CodeMirror { 2 | border: 1px solid #eee; 3 | height: auto; 4 | } 5 | div.CodeMirror span.CodeMirror-matchingbracket { 6 | color: red; 7 | font-weight: bold; 8 | } 9 | #permissions { 10 | width: 98%; 11 | margin: 0 auto; 12 | } -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2010-2012, Andrew Valums 4 | Copyright (c) 2012-2013, Andrew Valums and Raymond S. Nicholus, III 5 | Copyright (c) 2013-present, Widen Enterprises, Inc. 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all 15 | copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 | SOFTWARE. 24 | -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/continue.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/continue.gif -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/edit.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/edit.gif -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/loading.gif -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/pause.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/pause.gif -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/placeholders/not_available-generic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/placeholders/not_available-generic.png -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/placeholders/waiting-generic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/placeholders/waiting-generic.png -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/processing.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/processing.gif -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/retry.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/retry.gif -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/trash.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/fine-uploader/5.15.0/trash.gif -------------------------------------------------------------------------------- /admin-tools-filebrowser/src/main/resources/static/admintool/filebrowser/js/filebrowser.js: -------------------------------------------------------------------------------- 1 | var allFilesSelected = false; 2 | var allDirsSelected = false; 3 | 4 | $( document ).ready(function() { 5 | 6 | $('#selectFiles').on('click', function() { 7 | $('input.file').each(function() { 8 | $(this).prop( "checked", !allFilesSelected ) 9 | }); 10 | allFilesSelected = !allFilesSelected; 11 | }); 12 | 13 | $('#selectDirs').on('click', function() { 14 | $('input.dir').each(function() { 15 | $(this).prop( "checked", !allDirsSelected ) 16 | }); 17 | allDirsSelected = !allDirsSelected; 18 | }); 19 | 20 | $('#createDir').on('click', function() { 21 | 22 | getByID("createFolderModal").modal(); 23 | }); 24 | 25 | $('#uploadFile').on('click', function() { 26 | 27 | var csrf = {}; 28 | csrf[getCSRFHeader()] = getCSRFToken(); 29 | var uploader = null; 30 | uploader = new qq.FineUploader({ 31 | element: $("#fine-uploader")[0], 32 | request: { 33 | endpoint: getWebContext() + '/admintool/filebrowser/upload', 34 | customHeaders: csrf, 35 | params: { 36 | "currentDir" : $("#currentDir").text() 37 | } 38 | } 39 | }); 40 | var uploadModal = getByID("uploadModal"); 41 | uploadModal.modal(); 42 | uploadModal.on('hidden.bs.modal', function () { 43 | location.reload(); 44 | }); 45 | }); 46 | 47 | $('.delete').each(function() { 48 | var btn = $(this); 49 | btn.on('click', function() { 50 | var clickedBtn = $(this); 51 | $("#resourceToDeleteShown").text(decodeURIComponent(decodeURI(clickedBtn.data("resource")))); 52 | $("#resourceToDelete").val(clickedBtn.data("resource")); 53 | getByID("deleteConfirmModal").modal(); 54 | }); 55 | }); 56 | 57 | $('.infoBtn').each(function() { 58 | var btn = $(this); 59 | btn.on('click', function() { 60 | var link = $(this); 61 | 62 | sendRequest("/admintool/filebrowser/info?file=" + link.data('path'), "GET", "text", function(data) { 63 | var div = getByID('infoModals'); 64 | div.html(data); 65 | div.modal(); 66 | }); 67 | 68 | }); 69 | }); 70 | 71 | 72 | }); -------------------------------------------------------------------------------- /admin-tools-jminix/doc/screen_jminix_org.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-jminix/doc/screen_jminix_org.png -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/java/de/chandre/admintool/jminix/AdminToolJmxRoles.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.jminix; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | import java.util.Collections; 6 | 7 | import org.springframework.stereotype.Component; 8 | 9 | import de.chandre.admintool.core.sec.ATInitRole; 10 | import de.chandre.admintool.core.sec.AdminToolRoles; 11 | import de.chandre.admintool.core.sec.ATInitRole.ATInitRoleBuilder; 12 | 13 | /** 14 | * 15 | * @author Andre 16 | * @since 1.2.0 17 | */ 18 | @Component 19 | public class AdminToolJmxRoles implements AdminToolRoles { 20 | 21 | public static final ATInitRole ROLE_JMX = ATInitRoleBuilder.builder() 22 | .name("JMX").displayName("JMX Role").description("This role is for the usage of JMX browser").build(); 23 | 24 | @Override 25 | public Collection getRoles() { 26 | return Collections.unmodifiableList(Arrays.asList(ROLE_JMX)); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/java/de/chandre/admintool/jminix/AdminToolJmxService.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.jminix; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | import javax.management.MBeanAttributeInfo; 7 | import javax.management.MBeanOperationInfo; 8 | 9 | import de.chandre.admintool.jmx.jstree.JmxExecuteTO; 10 | import de.chandre.admintool.jmx.jstree.JmxQueryTO; 11 | import de.chandre.admintool.jmx.jstree.JmxResponseTO; 12 | import de.chandre.admintool.jmx.jstree.JsTree; 13 | 14 | public interface AdminToolJmxService { 15 | 16 | Map getServerMappings(); 17 | 18 | List getDomains(String serverMappingKey); 19 | 20 | List getMBeans(String serverMappingKey, String domain); 21 | 22 | List getAttributes(String serverMappingKey, String domain, String mbean); 23 | 24 | JmxResponseTO getAttributes(JmxQueryTO queryTo); 25 | 26 | List getOperations(String serverMappingKey, String domain, String mbean); 27 | 28 | List buildTree(); 29 | 30 | JmxResponseTO getOpperation(JmxQueryTO queryTo); 31 | 32 | JmxResponseTO getExecuteOperation(JmxExecuteTO queryTo) throws Exception; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/java/de/chandre/admintool/jmx/jstree/JmxExecuteTO.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.jmx.jstree; 2 | 3 | import java.util.List; 4 | 5 | public class JmxExecuteTO extends JmxQueryTO { 6 | private static final long serialVersionUID = -8678306366043106315L; 7 | 8 | private List parameters; 9 | 10 | public List getParameters() { 11 | return parameters; 12 | } 13 | 14 | public void setParameters(List parameters) { 15 | this.parameters = parameters; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | StringBuilder builder = new StringBuilder(); 21 | builder.append("JmxExecuteTO [parameters=").append(parameters).append(", toString()=").append(super.toString()) 22 | .append("]"); 23 | return builder.toString(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/java/de/chandre/admintool/jmx/jstree/JmxOperationTO.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.jmx.jstree; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * response object for jmx operation 8 | * @author André Hertwig 9 | * @since 1.1.6 10 | */ 11 | public class JmxOperationTO extends JmxMethodTO { 12 | private static final long serialVersionUID = 8721380149439116761L; 13 | 14 | private List parameters; 15 | 16 | public List getParameters() { 17 | return parameters; 18 | } 19 | 20 | public void setParameters(List parameters) { 21 | this.parameters = parameters; 22 | } 23 | 24 | public void addParameter(JmxMethodTO parameter) { 25 | if(null == this.parameters) { 26 | this.parameters = new ArrayList<>(); 27 | } 28 | this.parameters.add(parameter); 29 | } 30 | 31 | @Override 32 | public String toString() { 33 | StringBuilder builder = new StringBuilder(); 34 | builder.append("JmxOperationTO [parameters=").append(parameters).append(", toString()=") 35 | .append(super.toString()).append("]"); 36 | return builder.toString(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/java/de/chandre/admintool/jmx/jstree/JmxQueryTO.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.jmx.jstree; 2 | 3 | import java.io.Serializable; 4 | 5 | public class JmxQueryTO implements Serializable { 6 | private static final long serialVersionUID = -4564570953322072825L; 7 | 8 | private String server; 9 | private String domain; 10 | private String mbean; 11 | private String type; 12 | private String name; 13 | 14 | private String value; 15 | 16 | public String getServer() { 17 | return server; 18 | } 19 | 20 | public void setServer(String server) { 21 | this.server = server; 22 | } 23 | 24 | public String getDomain() { 25 | return domain; 26 | } 27 | 28 | public void setDomain(String domain) { 29 | this.domain = domain; 30 | } 31 | 32 | public String getMbean() { 33 | return mbean; 34 | } 35 | 36 | public void setMbean(String mbean) { 37 | this.mbean = mbean; 38 | } 39 | 40 | public String getType() { 41 | return type; 42 | } 43 | 44 | public void setType(String type) { 45 | this.type = type; 46 | } 47 | 48 | public String getName() { 49 | return name; 50 | } 51 | 52 | public void setName(String name) { 53 | this.name = name; 54 | } 55 | 56 | public String getValue() { 57 | return value; 58 | } 59 | 60 | public void setValue(String value) { 61 | this.value = value; 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | StringBuilder builder = new StringBuilder(); 67 | builder.append("JmxQueryTO [server=").append(server).append(", domain=").append(domain).append(", mbean=") 68 | .append(mbean).append(", type=").append(type).append(", name=").append(name).append(", value=") 69 | .append(value).append("]"); 70 | return builder.toString(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/java/de/chandre/admintool/jmx/jstree/JmxResponseTO.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.jmx.jstree; 2 | 3 | import java.io.Serializable; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | public class JmxResponseTO implements Serializable { 8 | private static final long serialVersionUID = -6747620476709046420L; 9 | 10 | private List methods = new ArrayList<>(); 11 | private Boolean success; 12 | private Object returnValue; 13 | 14 | public List getMethods() { 15 | return methods; 16 | } 17 | 18 | public void setMethods(List methods) { 19 | this.methods = methods; 20 | } 21 | 22 | public void addMethod(JmxMethodTO method) { 23 | this.methods.add(method); 24 | } 25 | 26 | public Boolean getSuccess() { 27 | return success; 28 | } 29 | 30 | public void setSuccess(Boolean success) { 31 | this.success = success; 32 | } 33 | 34 | public Object getReturnValue() { 35 | return returnValue; 36 | } 37 | 38 | public void setReturnValue(Object returnValue) { 39 | this.returnValue = returnValue; 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | StringBuilder builder = new StringBuilder(); 45 | builder.append("JmxResponseTO [methods=").append(methods).append(", success=").append(success) 46 | .append(", returnValue=").append(returnValue).append("]"); 47 | return builder.toString(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/java/de/chandre/admintool/jmx/jstree/JsTree.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.jmx.jstree; 2 | 3 | import java.io.Serializable; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | public class JsTree implements Serializable { 8 | private static final long serialVersionUID = -3008103623566946897L; 9 | 10 | private String id; 11 | private String text; 12 | private String icon; 13 | private JsTreeState state; 14 | private List children = new ArrayList<>(); 15 | private String type; 16 | 17 | public JsTree() { 18 | } 19 | public JsTree( String id, String text, String type) { 20 | this.id = id; 21 | this.text = text; 22 | this.type = type; 23 | } 24 | 25 | public String getId() { 26 | return id; 27 | } 28 | 29 | public void setId(String id) { 30 | this.id = id; 31 | } 32 | 33 | public String getText() { 34 | return text; 35 | } 36 | 37 | public void setText(String text) { 38 | this.text = text; 39 | } 40 | 41 | public String getIcon() { 42 | return icon; 43 | } 44 | 45 | public void setIcon(String icon) { 46 | this.icon = icon; 47 | } 48 | 49 | public JsTreeState getState() { 50 | return state; 51 | } 52 | 53 | public void setState(JsTreeState state) { 54 | this.state = state; 55 | } 56 | 57 | public List getChildren() { 58 | return children; 59 | } 60 | 61 | public void setChildren(List children) { 62 | this.children = children; 63 | } 64 | 65 | public void addChildren(JsTree child) { 66 | this.children.add(child); 67 | } 68 | public String getType() { 69 | return type; 70 | } 71 | public void setType(String type) { 72 | this.type = type; 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/java/de/chandre/admintool/jmx/jstree/JsTreeState.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.jmx.jstree; 2 | 3 | import java.io.Serializable; 4 | 5 | public class JsTreeState implements Serializable { 6 | private static final long serialVersionUID = 2211821322624575308L; 7 | 8 | // is the node open 9 | private boolean opened; 10 | // is the node disabled 11 | private boolean disabled; 12 | // is the node selected 13 | private boolean selected; 14 | 15 | public JsTreeState() { 16 | } 17 | 18 | public JsTreeState(boolean opened, boolean disabled, boolean selected) { 19 | super(); 20 | this.opened = opened; 21 | this.disabled = disabled; 22 | this.selected = selected; 23 | } 24 | 25 | public boolean isOpened() { 26 | return opened; 27 | } 28 | public void setOpened(boolean opened) { 29 | this.opened = opened; 30 | } 31 | public boolean isDisabled() { 32 | return disabled; 33 | } 34 | public void setDisabled(boolean disabled) { 35 | this.disabled = disabled; 36 | } 37 | public boolean isSelected() { 38 | return selected; 39 | } 40 | public void setSelected(boolean selected) { 41 | this.selected = selected; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/resources/i18n/admintool/jmx-messages.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.jmx.displayName=JMX -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/resources/i18n/admintool/jmx-messages_en.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.jmx.displayName=JMX -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/resources/static/admintool/jmx/css/jmx.css: -------------------------------------------------------------------------------- 1 | .scrollable { 2 | overflow-x: scroll; 3 | } 4 | 5 | .vertical-split { 6 | padding: 2px 0px; 7 | } 8 | 9 | .page-container { 10 | margin: 20px; 11 | } 12 | 13 | .panel-container { 14 | display: flex; 15 | flex-direction: row; 16 | border: 1px solid silver; 17 | overflow: hidden; 18 | 19 | /* avoid browser level touch actions */ 20 | xtouch-action: none; 21 | } 22 | 23 | .panel-left { 24 | flex: 0 0 auto; 25 | /* only manually resize */ 26 | padding: 10px; 27 | /*width: 300px;*/ 28 | width: 50%; 29 | min-height: 200px; 30 | min-width: 150px; 31 | white-space: nowrap; 32 | background: #838383; 33 | color: white; 34 | } 35 | 36 | .splitter { 37 | flex: 0 0 auto; 38 | width: 18px; 39 | background: url(/static/admintool/jmx/images/vsizegrip.png) center center no-repeat #535353; 40 | min-height: 200px; 41 | cursor: col-resize; 42 | z-index: 1000; 43 | } 44 | 45 | .panel-right { 46 | flex: 1 1 auto; 47 | /* resizable */ 48 | padding: 10px; 49 | width: 100%; 50 | min-height: 200px; 51 | min-width: 200px; 52 | background: #eee; 53 | z-index: 500; 54 | } 55 | 56 | .panel-right pre { 57 | margin: 1px 5px; 58 | padding: 4px 5px; 59 | } -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/resources/static/admintool/jmx/images/vsizegrip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-jminix/src/main/resources/static/admintool/jmx/images/vsizegrip.png -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/resources/static/admintool/jmx/js/jquery-resizable.min.js: -------------------------------------------------------------------------------- 1 | !function(e,n){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&"object"==typeof module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e,n){function t(n,t){return n&&">"===n.trim()[0]?(n=n.trim().replace(/^>\s*/,""),t.find(n)):n?e(n):t}e.fn.resizable||(e.fn.resizable=function(n){var o={handleSelector:null,resizeWidth:!0,resizeHeight:!0,resizeWidthFrom:"right",resizeHeightFrom:"bottom",onDragStart:null,onDragEnd:null,onDrag:null,touchActionNone:!0};return"object"==typeof n&&(o=e.extend(o,n)),this.each(function(){function n(e){e.stopPropagation(),e.preventDefault()}function i(t){t.preventDefault&&t.preventDefault(),s=c(t),s.width=parseInt(d.width(),10),s.height=parseInt(d.height(),10),a=d.css("transition"),d.css("transition","none"),o.onDragStart&&o.onDragStart(t,d,o)===!1||(o.dragFunc=r,e(document).bind("mousemove.rsz",o.dragFunc),e(document).bind("mouseup.rsz",u),(window.Touch||navigator.maxTouchPoints)&&(e(document).bind("touchmove.rsz",o.dragFunc),e(document).bind("touchend.rsz",u)),e(document).bind("selectstart.rsz",n))}function r(e){var n,t,i=c(e);n="left"===o.resizeWidthFrom?s.width-i.x+s.x:s.width+i.x-s.x,t="top"===o.resizeHeightFrom?s.height-i.y+s.y:s.height+i.y-s.y,o.onDrag&&o.onDrag(e,d,n,t,o)===!1||(o.resizeHeight&&d.height(t),o.resizeWidth&&d.width(n))}function u(t){return t.stopPropagation(),t.preventDefault(),e(document).unbind("mousemove.rsz",o.dragFunc),e(document).unbind("mouseup.rsz",u),(window.Touch||navigator.maxTouchPoints)&&(e(document).unbind("touchmove.rsz",o.dragFunc),e(document).unbind("touchend.rsz",u)),e(document).unbind("selectstart.rsz",n),d.css("transition",a),o.onDragEnd&&o.onDragEnd(t,d,o),!1}function c(e){var n={x:0,y:0,width:0,height:0};if("number"==typeof e.clientX)n.x=e.clientX,n.y=e.clientY;else{if(!e.originalEvent.touches)return null;n.x=e.originalEvent.touches[0].clientX,n.y=e.originalEvent.touches[0].clientY}return n}var s,a,d=e(this),h=t(o.handleSelector,d);o.touchActionNone&&h.css("touch-action","none"),d.addClass("resizable"),h.bind("mousedown.rsz touchstart.rsz",i)})})}); 2 | //# sourceMappingURL=jquery-resizable.min.js.map 3 | -------------------------------------------------------------------------------- /admin-tools-jminix/src/main/resources/templates/admintool/content/jmx/jmx.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |

    7 | JMX Console Configuration 8 |

    9 | 10 |
    11 |
    12 | 13 |
    14 |
    15 | 16 |
    17 |
    18 |
    19 | 20 |
    21 | 22 |
    23 |
    24 |
    25 | 26 |
    27 |
    28 | 29 |
    30 |
    31 |
    32 | 33 |
    34 |
    35 | 36 | 37 |
    38 | 39 | 42 |
    43 |
    44 | 45 | -------------------------------------------------------------------------------- /admin-tools-log4j2/README.md: -------------------------------------------------------------------------------- 1 | # The Log4j2 Management Plugin 2 | > Shows all loggers with possibility to change the level 3 | 4 | Since 1.1.6.4 it's possible to add new Logger with available appenders 5 | 6 | ![Preview image](doc/screen_log4j_org.png?raw=true "AdminTool Log4jLoggers UI") 7 | 8 | Since 1.1.1 a web console is available 9 | ![Preview image](doc/screen_log4j_console_org.png?raw=true "AdminTool Log4jConsole UI") 10 | 11 | ## Introduced with 12 | * admin-tools-core:1.0.0 13 | 14 | ## Usage 15 | 16 | ```xml 17 | 18 | de.chandre.admin-tools 19 | admin-tools-core 20 | 1.1.7.3 21 | 22 | 23 | de.chandre.admin-tools 24 | admin-tools-log4j2 25 | 1.1.7.3 26 | 27 | ``` 28 | 29 | ## Configurations 30 | 31 | Following the default values are shown. 32 | ```ini 33 | 34 | #since 1.0.3 35 | # to deactivate the admin component 36 | adminTool.log4j2.enabled=true 37 | 38 | #since 1.0.1 39 | # for own implementation or requires admin-tools-core-security 40 | #semi-colon separated list of Spring Security roles like ROLE_ANONYMOUS;ROLE_ADMIN 41 | admintool.log4j2.securityRoles= 42 | 43 | #since 1.0.1 44 | # integer value. used by default comparator to order components 45 | admintool.log4j2.componentPosition= 46 | 47 | ``` -------------------------------------------------------------------------------- /admin-tools-log4j2/doc/screen_log4j_console_org.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-log4j2/doc/screen_log4j_console_org.png -------------------------------------------------------------------------------- /admin-tools-log4j2/doc/screen_log4j_org.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-log4j2/doc/screen_log4j_org.png -------------------------------------------------------------------------------- /admin-tools-log4j2/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | 6 | 7 | de.chandre.admin-tools 8 | admin-tools 9 | 1.2.0-SNAPSHOT 10 | ../ 11 | 12 | 13 | admin-tools-log4j2 14 | 15 | admin-tools log4j view 16 | admin-tools log4j view 17 | 18 | jar 19 | 20 | 21 | [2.8.2,) 22 | 23 | 24 | 25 | 26 | 27 | de.chandre.admin-tools 28 | admin-tools-core 29 | 30 | 31 | 32 | 33 | 34 | org.apache.logging.log4j 35 | log4j-api 36 | ${log4j.version} 37 | 38 | 39 | org.apache.logging.log4j 40 | log4j-core 41 | ${log4j.version} 42 | 43 | 44 | org.apache.logging.log4j 45 | log4j-web 46 | ${log4j.version} 47 | true 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | org.apache.maven.plugins 56 | maven-source-plugin 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /admin-tools-log4j2/src/main/java/de/chandre/admintool/log4j2/AdminToolLog4j2Config.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.log4j2; 2 | 3 | import java.util.HashSet; 4 | import java.util.Set; 5 | 6 | import org.apache.commons.logging.Log; 7 | import org.apache.commons.logging.LogFactory; 8 | import org.springframework.beans.factory.annotation.Value; 9 | import org.springframework.stereotype.Component; 10 | 11 | import de.chandre.admintool.core.AdminToolConfig; 12 | 13 | /** 14 | * @author Andre 15 | */ 16 | @Component("adminToolLog4j2Config") 17 | public class AdminToolLog4j2Config implements AdminToolConfig 18 | { 19 | private static final Log LOGGER = LogFactory.getLog(AdminToolLog4j2Config.class); 20 | 21 | @Value("${adminTool.log4j2.enabled:true}") 22 | private boolean enabled; 23 | 24 | @Value("#{'${admintool.log4j2.securityRoles:}'.split(';')}") 25 | private Set securityRoles = new HashSet<>(); 26 | 27 | @Value("${admintool.log4j2.componentPosition:}") 28 | private Integer componentPosition; 29 | 30 | public boolean isEnabled() { 31 | return enabled; 32 | } 33 | 34 | public void setEnabled(boolean enabled) { 35 | this.enabled = enabled; 36 | } 37 | 38 | public void setSecurityRoles(Set securityRoles) { 39 | this.securityRoles = securityRoles; 40 | } 41 | 42 | /** 43 | * @return the securityRoles 44 | */ 45 | public Set getSecurityRoles() { 46 | return securityRoles; 47 | } 48 | 49 | /** 50 | * @return the componentPosition 51 | */ 52 | public Integer getComponentPosition() { 53 | return componentPosition; 54 | } 55 | 56 | /** 57 | * @param componentPosition the componentPosition to set 58 | */ 59 | public void setComponentPosition(Integer componentPosition) { 60 | this.componentPosition = componentPosition; 61 | } 62 | 63 | 64 | @Override 65 | public void printConfig() { 66 | LOGGER.info(toString()); 67 | } 68 | 69 | @Override 70 | public String toString() { 71 | StringBuilder builder = new StringBuilder(); 72 | builder.append("AdminToolLog4j2Config [enabled=").append(enabled).append(", securityRoles=") 73 | .append(securityRoles).append(", componentPosition=").append(componentPosition).append("]"); 74 | return builder.toString(); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /admin-tools-log4j2/src/main/java/de/chandre/admintool/log4j2/AdminToolLog4jRoles.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.log4j2; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | import java.util.Collections; 6 | 7 | import org.springframework.stereotype.Component; 8 | 9 | import de.chandre.admintool.core.sec.ATInitRole; 10 | import de.chandre.admintool.core.sec.AdminToolRoles; 11 | import de.chandre.admintool.core.sec.ATInitRole.ATInitRoleBuilder; 12 | 13 | /** 14 | * 15 | * @author Andre 16 | * @since 1.2.0 17 | */ 18 | @Component 19 | public class AdminToolLog4jRoles implements AdminToolRoles { 20 | 21 | public static final ATInitRole ROLE_LOG4J = ATInitRoleBuilder.builder() 22 | .name("LOG4J").displayName("Log4j Role").description("This role is for the usage of Log4jView").build(); 23 | 24 | public static final ATInitRole ROLE_LOG4J_LOGGERS = ATInitRoleBuilder.builder() 25 | .name("LOG4J_LOGGERS").displayName("Log4j Loggers").description("This role is for the usage of Log4j loggers view and usage").build(); 26 | public static final ATInitRole ROLE_LOG4J_CONSOLE = ATInitRoleBuilder.builder() 27 | .name("LOG4J_CONSOLE").displayName("Log4j Console").description("This role is for the usage of Log4j console view and usage").build(); 28 | 29 | @Override 30 | public Collection getRoles() { 31 | return Collections.unmodifiableList(Arrays.asList(ROLE_LOG4J, ROLE_LOG4J_LOGGERS, ROLE_LOG4J_CONSOLE)); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /admin-tools-log4j2/src/main/java/de/chandre/admintool/log4j2/AdminToolLog4jSessionListener.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.log4j2; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.annotation.PostConstruct; 6 | import javax.servlet.annotation.WebListener; 7 | import javax.servlet.http.HttpSessionEvent; 8 | import javax.servlet.http.HttpSessionListener; 9 | 10 | import org.apache.commons.logging.Log; 11 | import org.apache.commons.logging.LogFactory; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Component; 14 | 15 | /** 16 | * Session listener to remove unused outputstream appender to free resources 17 | * you may have to configure @ServletComponentScan 18 | * @author André 19 | * 20 | */ 21 | @WebListener 22 | @Component 23 | public class AdminToolLog4jSessionListener implements HttpSessionListener { 24 | 25 | private static final Log LOGGER = LogFactory.getLog(AdminToolLog4jSessionListener.class); 26 | 27 | public AdminToolLog4jSessionListener() { 28 | LOGGER.debug("Session listener to remove useless outputstreams has been initialiezed"); 29 | } 30 | 31 | @Autowired 32 | private AdminToolLog4j2Util log4jUtil; 33 | 34 | @Override 35 | public void sessionCreated(HttpSessionEvent sessionEvent) {} 36 | 37 | @PostConstruct 38 | private void log() { 39 | LOGGER.info("AdminToolLog4j2Util has been autowired: " + (null != log4jUtil)); 40 | } 41 | 42 | @Override 43 | public void sessionDestroyed(HttpSessionEvent sessionEvent) { 44 | String appenderName = (String) sessionEvent.getSession().getAttribute(AdminToolLog4j2Util.SESSION_APPENDER_NAME); 45 | try { 46 | if (null != log4jUtil) { 47 | log4jUtil.closeOutputStreamAppender(appenderName); 48 | } 49 | } catch (IOException e) { 50 | LOGGER.error(e.getMessage(), e); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /admin-tools-log4j2/src/main/resources/i18n/admintool/log4j2-messages.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.log4j.displayName=Log4j2 Config 2 | ui.admintool.core.log4j.loggers.displayName=Log4j2 Loggers 3 | ui.admintool.core.log4j.console.displayName=Log4j2 Console 4 | 5 | ui.admintool.core.log4j.loggers.parent.subHeadline=Parent Loggers 6 | ui.admintool.core.log4j.loggers.parent.btn.remove=Remove Custom Parent Loggers 7 | 8 | ui.admintool.core.log4j.loggers.all.subHeadline=All Loggers 9 | ui.admintool.core.log4j.loggers.all.btn.remove=Remove Custom Loggers 10 | 11 | ui.admintool.core.log4j.loggers.tableHead.name=Name 12 | ui.admintool.core.log4j.loggers.tableHead.level=Level 13 | ui.admintool.core.log4j.loggers.tableHead.action=Change Level 14 | 15 | ui.admintool.core.log4j.console.input.headline=Log4j Console Configuration 16 | ui.admintool.core.log4j.console.input.name=Logger Name 17 | ui.admintool.core.log4j.console.input.pattern=Logger Pattern 18 | ui.admintool.core.log4j.console.input.level=Logger Level 19 | ui.admintool.core.log4j.console.input.recursive=Recursive 20 | ui.admintool.core.log4j.console.input.override=Override log level 21 | ui.admintool.core.log4j.console.input.encoding=Logger Encoding 22 | ui.admintool.core.log4j.console.input.loggers=Logger Names 23 | 24 | ui.admintool.core.log4j.console.out.headline=Log4j Console Output 25 | ui.admintool.core.log4j.console.out.input.scroll=Scroll to bottom 26 | 27 | ui.admintool.core.log4j.console.btn.start=Start Console 28 | ui.admintool.core.log4j.console.btn.stop=Stop Console 29 | ui.admintool.core.log4j.console.btn.clear=Clear Console -------------------------------------------------------------------------------- /admin-tools-log4j2/src/main/resources/i18n/admintool/log4j2-messages_en.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.log4j.displayName=Log4j2 Config 2 | ui.admintool.core.log4j.loggers.displayName=Log4j2 Loggers 3 | ui.admintool.core.log4j.console.displayName=Log4j2 Console 4 | 5 | ui.admintool.core.log4j.loggers.parent.subHeadline=Parent Loggers 6 | ui.admintool.core.log4j.loggers.parent.btn.remove=Remove Custom Parent Loggers 7 | 8 | ui.admintool.core.log4j.loggers.all.subHeadline=All Loggers 9 | ui.admintool.core.log4j.loggers.all.btn.remove=Remove Custom Loggers 10 | 11 | ui.admintool.core.log4j.loggers.tableHead.name=Name 12 | ui.admintool.core.log4j.loggers.tableHead.level=Level 13 | ui.admintool.core.log4j.loggers.tableHead.action=Change Level 14 | 15 | ui.admintool.core.log4j.console.input.headline=Log4j Console Configuration 16 | ui.admintool.core.log4j.console.input.name=Logger Name 17 | ui.admintool.core.log4j.console.input.pattern=Logger Pattern 18 | ui.admintool.core.log4j.console.input.level=Logger Level 19 | ui.admintool.core.log4j.console.input.recursive=Recursive 20 | ui.admintool.core.log4j.console.input.override=Override log level 21 | ui.admintool.core.log4j.console.input.encoding=Logger Encoding 22 | ui.admintool.core.log4j.console.input.loggers=Logger Names 23 | 24 | ui.admintool.core.log4j.console.out.headline=Log4j Console Output 25 | ui.admintool.core.log4j.console.out.input.scroll=Scroll to bottom 26 | 27 | ui.admintool.core.log4j.console.btn.start=Start Console 28 | ui.admintool.core.log4j.console.btn.stop=Stop Console 29 | ui.admintool.core.log4j.console.btn.clear=Clear Console -------------------------------------------------------------------------------- /admin-tools-log4j2/src/main/resources/static/admintool/css/log4j2.css: -------------------------------------------------------------------------------- 1 | .topButton { 2 | margin: 0 0 0 2px; 3 | } 4 | 5 | .label { 6 | margin: 0 2px 0 0; 7 | } 8 | 9 | .label-muted { 10 | background-color:#777 !important; 11 | } 12 | 13 | .changeLogger { 14 | color: #fff; 15 | cursor: pointer; 16 | cursor: hand; 17 | } 18 | 19 | .logname { 20 | white-space: normal; 21 | overflow-wrap: break-word; 22 | word-wrap: break-word; 23 | /*word-break: break-word;*/ 24 | word-break: break-all; 25 | -ms-hyphens: auto; 26 | -moz-hyphens: auto; 27 | -webkit-hyphens: auto; 28 | hyphens: auto; 29 | } 30 | td.loglevel { 31 | width: 58px; 32 | min-width: 58px; 33 | } 34 | td.logaction { 35 | width: 340px; 36 | min-width: 340px; 37 | } 38 | span.logline { 39 | display: block; 40 | white-space: nowrap; 41 | width: 100%; 42 | } 43 | 44 | div#lineNumbers { 45 | width: 3%; 46 | float: left; 47 | text-align: right; 48 | } 49 | div#consoleContent { 50 | overflow-x: scroll; 51 | height: 100%; 52 | width: 96%; 53 | float: right; 54 | } 55 | 56 | @media (max-width: 991px) { 57 | div#lineNumbers { 58 | width: 6%; 59 | } 60 | div#consoleContent { 61 | width: 93%; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /admin-tools-melody/README.md: -------------------------------------------------------------------------------- 1 | # The JavaMelody integration Plugin 2 | > Shows JavaMelody within a IFrame 3 | 4 | ![Preview image](doc/screen_melody_org.png?raw=true "AdminTool JavaMelody UI") 5 | 6 | ## Introduced with 7 | * admin-tools-core:1.0.0 8 | 9 | ## Requirements, Dependencies 10 | If spring security is enabled following should be set: 11 | 12 | ```java 13 | 14 | http 15 | .headers().frameOptions().sameOrigin(); 16 | 17 | ``` 18 | 19 | ## Usage 20 | 21 | ```xml 22 | 23 | de.chandre.admin-tools 24 | admin-tools-core 25 | 1.1.7.3 26 | 27 | 28 | de.chandre.admin-tools 29 | admin-tools-melody 30 | 1.1.7.3 31 | 32 | ``` 33 | 34 | ## Configurations 35 | 36 | Following the default values are shown. 37 | ```ini 38 | 39 | #since 1.0.3 40 | # to deactivate the admin component 41 | adminTool.melody.enabled=true 42 | 43 | # relative path to javaMelody 44 | adminTool.melody.path=/monitoring 45 | 46 | #since 1.0.1 47 | # for own implementation or requires admin-tools-core-security 48 | #semi-colon separated list of Spring Security roles like ROLE_ANONYMOUS;ROLE_ADMIN 49 | admintool.melody.securityRoles= 50 | 51 | #since 1.0.1 52 | # integer value. used by default comparator to order components 53 | admintool.melody.componentPosition= 54 | 55 | ``` -------------------------------------------------------------------------------- /admin-tools-melody/doc/screen_melody_org.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-melody/doc/screen_melody_org.png -------------------------------------------------------------------------------- /admin-tools-melody/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | 6 | 7 | de.chandre.admin-tools 8 | admin-tools 9 | 1.2.0-SNAPSHOT 10 | ../ 11 | 12 | 13 | admin-tools-melody 14 | 15 | admin-tools javamelody integrator 16 | admin-tools javamelody integrator 17 | 18 | jar 19 | 20 | 21 | 22 | 23 | de.chandre.admin-tools 24 | admin-tools-core 25 | 26 | 27 | 28 | 29 | 30 | net.bull.javamelody 31 | javamelody-core 32 | [1.58,) 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | org.apache.maven.plugins 41 | maven-source-plugin 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /admin-tools-melody/src/main/java/de/chandre/admintool/melody/AdminToolJavaMelodyLoader.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.melody; 2 | 3 | import javax.annotation.PostConstruct; 4 | 5 | import org.apache.commons.logging.Log; 6 | import org.apache.commons.logging.LogFactory; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | import de.chandre.admintool.core.AbstractAdminToolLoader; 11 | import de.chandre.admintool.core.AdminTool; 12 | import de.chandre.admintool.core.component.AdminComponent; 13 | import de.chandre.admintool.core.component.AdminComponentImpl; 14 | import de.chandre.admintool.core.component.MenuEntry; 15 | 16 | /** 17 | * @author Andre 18 | */ 19 | @Component 20 | public class AdminToolJavaMelodyLoader extends AbstractAdminToolLoader 21 | { 22 | private static final Log LOGGER = LogFactory.getLog(AdminToolJavaMelodyLoader.class); 23 | 24 | @Autowired 25 | private AdminTool adminTool; 26 | 27 | @Autowired 28 | private AdminToolJavaMelodyConfig config; 29 | 30 | @PostConstruct 31 | public void configureAdminTool() 32 | { 33 | if(!coreConfig.isEnabled() || !config.isEnabled()) { 34 | LOGGER.info("admin tool's javaMelody view integration is deactivated"); 35 | return; 36 | } 37 | LOGGER.info("adding JavaMelody view to admin tool"); 38 | LOGGER.debug(toString()); 39 | 40 | AdminComponent component = new AdminComponentImpl(); 41 | component.setPosition(config.getComponentPosition()); 42 | component.getSecurityRoles().addAll(config.getSecurityRoles()); 43 | component.setDisplayName("JavaMelody"); 44 | component.addAdditionalCSS("/static/admintool/melody.css", true); 45 | 46 | MenuEntry mainMenu = new MenuEntry(); 47 | mainMenu.setDisplayName("JavaMelody"); 48 | mainMenu.setName("javamelody"); 49 | mainMenu.setTarget("content/melody"); 50 | mainMenu.addVariable("melodyPath", config.getMelodyPath()); 51 | mainMenu.setResouceMessageKey(AdminTool.RESOURCE_MESSAGE_KEY_PREFIX + "javamelody.displayName"); 52 | component.setMainMenu(mainMenu); 53 | 54 | adminTool.addComponent(component); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /admin-tools-melody/src/main/java/de/chandre/admintool/melody/AdminToolMelodyRoles.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.melody; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | import java.util.Collections; 6 | 7 | import org.springframework.stereotype.Component; 8 | 9 | import de.chandre.admintool.core.sec.ATInitRole; 10 | import de.chandre.admintool.core.sec.AdminToolRoles; 11 | import de.chandre.admintool.core.sec.ATInitRole.ATInitRoleBuilder; 12 | 13 | /** 14 | * 15 | * @author Andre 16 | * @since 1.2.0 17 | */ 18 | @Component 19 | public class AdminToolMelodyRoles implements AdminToolRoles { 20 | 21 | public static final ATInitRole ROLE_MELODY = ATInitRoleBuilder.builder() 22 | .name("MELODY").displayName("JavaMelody Role").description("This role is for the usage of JavaMelody view").build(); 23 | 24 | @Override 25 | public Collection getRoles() { 26 | return Collections.unmodifiableList(Arrays.asList(ROLE_MELODY)); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /admin-tools-melody/src/main/resources/i18n/admintool/melody-messages.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.javamelody.displayName=JavaMelody -------------------------------------------------------------------------------- /admin-tools-melody/src/main/resources/i18n/admintool/melody-messages_en.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.javamelody.displayName=JavaMelody -------------------------------------------------------------------------------- /admin-tools-melody/src/main/resources/static/admintool/melody.css: -------------------------------------------------------------------------------- 1 | .fluidMedia { 2 | position: relative; 3 | padding-bottom: 56.25%; /* proportion value to aspect ratio 16:9 (9 / 16 = 0.5625 or 56.25%) */ 4 | padding-top: 30px; 5 | height: 0; 6 | overflow: hidden; 7 | } 8 | 9 | .fluidMedia iframe { 10 | position: absolute; 11 | top: 0; 12 | left: 0; 13 | width: 100%; 14 | height: 100%; 15 | } -------------------------------------------------------------------------------- /admin-tools-melody/src/main/resources/templates/admintool/content/melody.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |

    7 | Java Melody Monitoring 8 |

    9 | 11 |
    12 |
    13 |
    14 | 15 |
    16 |
    17 |
    18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /admin-tools-properties/doc/screen_propertyBrowser_org.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-properties/doc/screen_propertyBrowser_org.png -------------------------------------------------------------------------------- /admin-tools-properties/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | 6 | 7 | de.chandre.admin-tools 8 | admin-tools 9 | 1.2.0-SNAPSHOT 10 | ../ 11 | 12 | 13 | admin-tools-properties 14 | 15 | admin-tools properties visualizer 16 | admin-tools properties visualizer 17 | 18 | jar 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | de.chandre.admin-tools 27 | admin-tools-core 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | org.apache.maven.plugins 36 | maven-source-plugin 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /admin-tools-properties/src/main/java/de/chandre/admintool/properties/AdminToolPropertiesLoader.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.properties; 2 | 3 | import javax.annotation.PostConstruct; 4 | 5 | import org.apache.commons.logging.Log; 6 | import org.apache.commons.logging.LogFactory; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | 10 | import de.chandre.admintool.core.AbstractAdminToolLoader; 11 | import de.chandre.admintool.core.AdminTool; 12 | import de.chandre.admintool.core.component.AdminComponent; 13 | import de.chandre.admintool.core.component.AdminComponentImpl; 14 | import de.chandre.admintool.core.component.MenuEntry; 15 | 16 | /** 17 | * @author Andre 18 | */ 19 | @Component 20 | public class AdminToolPropertiesLoader extends AbstractAdminToolLoader 21 | { 22 | private static final Log LOGGER = LogFactory.getLog(AdminToolPropertiesLoader.class); 23 | 24 | @Autowired 25 | private AdminTool adminTool; 26 | 27 | @Autowired 28 | private AdminToolPropertiesConfig config; 29 | 30 | @PostConstruct 31 | public void configureAdminTool() 32 | { 33 | if(!coreConfig.isEnabled() || !config.isEnabled()) { 34 | LOGGER.info("admin tool's properties visualizer is deactivated"); 35 | return; 36 | } 37 | 38 | LOGGER.info("adding properties visualizer to admin tool"); 39 | 40 | AdminComponent component = new AdminComponentImpl(); 41 | component.setPosition(config.getComponentPosition()); 42 | component.getSecurityRoles().addAll(config.getSecurityRoles()); 43 | component.setDisplayName("Properties"); 44 | component.addAdditionalJS("/static/admintool/js/properties.js", true); 45 | 46 | MenuEntry mainMenu = new MenuEntry(); 47 | mainMenu.setDisplayName("Properties"); 48 | mainMenu.setName("properties"); 49 | mainMenu.setTarget("properties/content/properties"); 50 | mainMenu.setResouceMessageKey(AdminTool.RESOURCE_MESSAGE_KEY_PREFIX + "properties.displayName"); 51 | component.setMainMenu(mainMenu); 52 | 53 | adminTool.addComponent(component); 54 | } 55 | 56 | 57 | } 58 | -------------------------------------------------------------------------------- /admin-tools-properties/src/main/java/de/chandre/admintool/properties/AdminToolPropertiesRoles.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.properties; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collection; 5 | import java.util.Collections; 6 | 7 | import org.springframework.stereotype.Component; 8 | 9 | import de.chandre.admintool.core.sec.ATInitRole; 10 | import de.chandre.admintool.core.sec.AdminToolRoles; 11 | import de.chandre.admintool.core.sec.ATInitRole.ATInitRoleBuilder; 12 | 13 | /** 14 | * 15 | * @author Andre 16 | * @since 1.2.0 17 | */ 18 | @Component 19 | public class AdminToolPropertiesRoles implements AdminToolRoles { 20 | 21 | public static final ATInitRole ROLE_PROPS = ATInitRoleBuilder.builder() 22 | .name("PROPS").displayName("Properties Role").description("This role is for the usage of properties view").build(); 23 | 24 | @Override 25 | public Collection getRoles() { 26 | return Collections.unmodifiableList(Arrays.asList(ROLE_PROPS)); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /admin-tools-properties/src/main/resources/i18n/admintool/properties-messages.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.properties.displayName=Properties -------------------------------------------------------------------------------- /admin-tools-properties/src/main/resources/i18n/admintool/properties-messages_en.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.properties.displayName=Properties -------------------------------------------------------------------------------- /admin-tools-properties/src/main/resources/static/admintool/js/properties.js: -------------------------------------------------------------------------------- 1 | $( document ).ready(function() { 2 | if($('.propsTable').length > 0) { 3 | $('.propsTable').DataTable(); 4 | } 5 | }); -------------------------------------------------------------------------------- /admin-tools-properties/src/main/resources/templates/admintool/properties/fragments/propFragment.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
    6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
    #KeyValue
    22 |
    23 |
    24 | 25 | 26 | -------------------------------------------------------------------------------- /admin-tools-quartz/doc/screen_quartzJobs_org.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-quartz/doc/screen_quartzJobs_org.png -------------------------------------------------------------------------------- /admin-tools-quartz/doc/screen_quartzMetadata_org.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-quartz/doc/screen_quartzMetadata_org.png -------------------------------------------------------------------------------- /admin-tools-quartz/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | 6 | 7 | de.chandre.admin-tools 8 | admin-tools 9 | 1.2.0-SNAPSHOT 10 | ../ 11 | 12 | 13 | admin-tools-quartz 14 | 15 | admin-tools quartz view 16 | admin-tools quartz view 17 | 18 | jar 19 | 20 | 21 | [2.2.2,) 22 | 23 | 24 | 25 | 26 | 27 | de.chandre.admin-tools 28 | admin-tools-core 29 | 30 | 31 | 32 | 33 | org.quartz-scheduler 34 | quartz 35 | ${quartz.version} 36 | 37 | 38 | 39 | 40 | commons-modeler 41 | commons-modeler 42 | 2.0.1 43 | 44 | 45 | 46 | org.springframework 47 | spring-tx 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | org.apache.maven.plugins 56 | maven-source-plugin 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /admin-tools-quartz/src/main/java/de/chandre/admintool/quartz/ATQuartzPermissionHandler.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.quartz; 2 | 3 | /** 4 | * 5 | * @author André 6 | * @since 1.1.7 7 | * 8 | */ 9 | public interface ATQuartzPermissionHandler extends ATQuartzPermissions { 10 | 11 | 12 | } 13 | -------------------------------------------------------------------------------- /admin-tools-quartz/src/main/java/de/chandre/admintool/quartz/ATQuartzPermissions.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.quartz; 2 | 3 | /** 4 | * interface for permission methods to delegate from service to permission handler 5 | * 6 | * @author Andre 7 | * @since 1.2.0 8 | */ 9 | public interface ATQuartzPermissions { 10 | 11 | /** 12 | * delegate method for permission handler and/or config value 13 | * @return 14 | */ 15 | boolean isChangeJobInfoAllowed(); 16 | 17 | /** 18 | * delegate method for permission handler and/or config value 19 | * @return 20 | */ 21 | boolean isExecuteJobAllowed(); 22 | 23 | /** 24 | * delegate method for permission handler and/or config value 25 | * @return 26 | */ 27 | boolean isInterruptJobAllowed(); 28 | 29 | /** 30 | * delegate method for permission handler and/or config value 31 | * @return 32 | */ 33 | boolean isAddTriggerAllowed(); 34 | 35 | /** 36 | * delegate method for permission handler and/or config value 37 | * @return 38 | */ 39 | boolean isChangetTriggerStateAllowed(); 40 | 41 | /** 42 | * delegate method for permission handler and/or config value 43 | * @return 44 | */ 45 | boolean isInterruptTriggerAllowed(); 46 | 47 | /** 48 | * delegate method for permission handler and/or config value 49 | * @return 50 | */ 51 | boolean isChangeTriggerAllowed(); 52 | 53 | /** 54 | * delegate method for permission handler and/or config value 55 | * @return 56 | */ 57 | boolean isRemoveTriggerAllowed(); 58 | 59 | /** 60 | * delegate method for permission handler and/or config value 61 | * @return 62 | */ 63 | boolean isStopSchedulerAllowed(); 64 | } 65 | -------------------------------------------------------------------------------- /admin-tools-quartz/src/main/resources/static/admintool/quartz/css/quartz.css: -------------------------------------------------------------------------------- 1 | .inner h4 { 2 | font-weight: bold; 3 | } 4 | .small-box .icon { 5 | font-size: 75px; 6 | } 7 | .small-box:hover .icon { 8 | font-size: 85px; 9 | } 10 | .small-box:hover { 11 | color: #333; 12 | } 13 | .small-box code { 14 | font-size: 12px; 15 | } 16 | a.small-box-footer-custom { 17 | background: rgba(0, 0, 0, 0.1) none repeat scroll 0 0; 18 | color: rgba(255, 255, 255, 0.8); 19 | width: auto; 20 | padding: 3px 0; 21 | text-align: center; 22 | display: block; 23 | } 24 | 25 | .row-header { 26 | background: rgba(0, 0, 0, 0.1) none repeat scroll 0 0; 27 | color: rgba(255, 255, 255, 0.8); 28 | text-align: center; 29 | } 30 | 31 | /*http://colorschemedesigner.com/csd-3.5/#0v31TsCw0w0w0 */ 32 | .bg-light-orange { 33 | background-color: #ffa354 !important; 34 | } 35 | 36 | /* 37 | .btn-warning { 38 | border-color: #a65109; 39 | background-color: #ff841b; 40 | } 41 | 42 | .btn-warning:hover { 43 | border-color: #a65109; 44 | background-color: #bf7a3f; 45 | } 46 | 47 | .btn-success { 48 | border-color: #07820f; 49 | background-color: #15c921; 50 | } 51 | 52 | .btn-success:hover { 53 | border-color: #07820f; 54 | background-color: #329638; 55 | } 56 | */ 57 | 58 | .row { 59 | margin: 0; 60 | } 61 | h5 { 62 | font-size: 16px; 63 | font-weight: bold; 64 | } 65 | td.center-middle { 66 | vertical-align: middle !important; 67 | text-align: center; 68 | width: 60px; 69 | } 70 | .action { 71 | display: inline-block; 72 | } 73 | 74 | .trigger-header { 75 | font-style: italic; 76 | text-align: center; 77 | } 78 | .paused { 79 | background: rgba(238, 162, 54, 0.1) none repeat scroll 0 0; 80 | } -------------------------------------------------------------------------------- /admin-tools-quartz/src/main/resources/templates/admintool/quartz/content/quartzJobs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 |
    6 |

    7 | Quartz Jobs 8 |

    9 | 10 |
    11 | 12 | 13 |
    14 | 15 |
    16 | 17 |
    18 |

    19 | 20 | 21 |

    22 |
    23 | 24 | 25 | 26 |
    27 |
    28 |
    29 |
    30 |
    31 |
    32 | 35 |
    36 | 37 | 38 |
    39 |
    40 | 41 |
    42 |
    43 | 44 |
    45 |
    46 | 47 |
    48 |
    49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-commons/src/main/java/META-INF/AT-Spring-Security-Dialect.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 27 | 28 | 31 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-commons/src/main/java/de/chandre/admintool/security/commons/TemplateUserService.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.commons; 2 | 3 | import org.springframework.security.core.Authentication; 4 | import java.io.Serializable; 5 | 6 | /** 7 | * service used in templates to get some user information 8 | * @author Andre 9 | * @since 1.0.1 10 | */ 11 | public interface TemplateUserService { 12 | 13 | /** 14 | * returns the authentication object 15 | * @return 16 | */ 17 | Authentication getAuthentication(); 18 | 19 | /** 20 | * should return the user name 21 | * @return 22 | */ 23 | String getUserName(); 24 | 25 | /** 26 | * returns user details object 27 | * @return 28 | */ 29 | Object getUserDetails(); 30 | 31 | /** 32 | * retunrs the principal. normally the user object. 33 | * 34 | * @return 35 | */ 36 | Object getUserPrincipal(); 37 | 38 | /** 39 | * 40 | * @see #getUserPrincipal() 41 | * @param userClass 42 | * @return the casted object 43 | */ 44 | U getUserPrincipal(Class userClass); 45 | 46 | /** 47 | * returns if user is not logged in 48 | * @return 49 | */ 50 | boolean isAnonymous(); 51 | 52 | 53 | } 54 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-commons/src/main/java/de/chandre/admintool/security/commons/auth/AdminToolAuthenticationFailureListener.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.commons.auth; 2 | 3 | import org.springframework.context.ApplicationListener; 4 | import org.springframework.security.authentication.event.AuthenticationFailureBadCredentialsEvent; 5 | import org.springframework.security.web.authentication.WebAuthenticationDetails; 6 | 7 | /** 8 | * listener to listen on bad credentials 9 | * @author Andre 10 | * @since 1.1.5 11 | */ 12 | public class AdminToolAuthenticationFailureListener implements ApplicationListener { 13 | 14 | private LoginAttemptService loginAttemptService; 15 | 16 | public AdminToolAuthenticationFailureListener(LoginAttemptService loginAttemptService) { 17 | this.loginAttemptService = loginAttemptService; 18 | } 19 | 20 | public void onApplicationEvent(AuthenticationFailureBadCredentialsEvent event) { 21 | if (loginAttemptService.isUseUserName()) { 22 | loginAttemptService.loginFailed(event.getAuthentication().getName()); 23 | } 24 | if (loginAttemptService.isUseRemoteAddress()) { 25 | WebAuthenticationDetails auth = (WebAuthenticationDetails) event.getAuthentication().getDetails(); 26 | loginAttemptService.loginFailed(auth.getRemoteAddress()); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-commons/src/main/java/de/chandre/admintool/security/commons/auth/AdminToolAuthenticationSuccessListener.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.commons.auth; 2 | 3 | import org.springframework.context.ApplicationListener; 4 | import org.springframework.security.authentication.event.AuthenticationSuccessEvent; 5 | import org.springframework.security.web.authentication.WebAuthenticationDetails; 6 | 7 | /** 8 | * listener to listen on good credentials 9 | * @author Andre 10 | * @since 1.1.5 11 | */ 12 | public class AdminToolAuthenticationSuccessListener implements ApplicationListener { 13 | 14 | private LoginAttemptService loginAttemptService; 15 | 16 | public AdminToolAuthenticationSuccessListener(LoginAttemptService loginAttemptService) { 17 | this.loginAttemptService = loginAttemptService; 18 | } 19 | 20 | @Override 21 | public void onApplicationEvent(AuthenticationSuccessEvent event) { 22 | if (loginAttemptService.isUseUserName()) { 23 | loginAttemptService.invalidate(event.getAuthentication().getName()); 24 | } 25 | if (loginAttemptService.isUseRemoteAddress()) { 26 | WebAuthenticationDetails auth = (WebAuthenticationDetails) event.getAuthentication().getDetails(); 27 | loginAttemptService.invalidate(auth.getRemoteAddress()); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-commons/src/main/java/de/chandre/admintool/security/commons/auth/AdminToolUserDetailsService.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.commons.auth; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.security.core.userdetails.UserDetails; 6 | import org.springframework.security.core.userdetails.UserDetailsService; 7 | 8 | /** 9 | * Interface for admintool UserDetailsService 10 | * @author Andre 11 | * @since 1.1.5 12 | */ 13 | public interface AdminToolUserDetailsService extends UserDetailsService { 14 | 15 | /** 16 | * 17 | * @return 18 | */ 19 | String getInfoMessage(); 20 | 21 | /** 22 | * 23 | * @param infoMessage 24 | */ 25 | void setInfoMessage(String infoMessage); 26 | 27 | /** 28 | * should return the user details 29 | * @return 30 | */ 31 | Collection getUsers(); 32 | 33 | /** 34 | * change the user name 35 | * @param currentUsername 36 | * @param newUserName 37 | */ 38 | void setUserName(String currentUsername, String newUserName); 39 | 40 | /** 41 | * change the lock state of user 42 | * @param username 43 | * @param locked set true to lock user 44 | */ 45 | void setUserLocked(String username, boolean locked); 46 | 47 | /** 48 | * change the expired state of user 49 | * @param username 50 | * @param expired set true to expire user 51 | */ 52 | void setUserExpired(String username, boolean expired); 53 | 54 | /** 55 | * change the enabled state of user 56 | * @param username 57 | * @param enabled set true to enabled user 58 | */ 59 | void setUserEnabled(String username, boolean enabled); 60 | 61 | /** 62 | * change the credentialsExpired state of user 63 | * @param username 64 | * @param credentialsExpired set true to set credentialsExpired 65 | */ 66 | void setUserCredentialsExpired(String username, boolean credentialsExpired); 67 | 68 | } 69 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-commons/src/main/java/de/chandre/admintool/security/commons/auth/LoginAttemptService.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.commons.auth; 2 | 3 | /** 4 | * Interface for the login attempt service 5 | * 6 | * @author Andre 7 | * @since 1.1.5 8 | */ 9 | public interface LoginAttemptService { 10 | 11 | /** 12 | * resets the user attempts 13 | * @param userName 14 | */ 15 | void invalidate(String userName); 16 | 17 | /** 18 | * increments the user attempts 19 | * @param userName 20 | */ 21 | void loginFailed(String userName); 22 | 23 | /** 24 | * checks if user is blocked 25 | * 26 | * @param userName 27 | * @return 28 | */ 29 | boolean isBlocked(String userName); 30 | 31 | /** 32 | * for external control, if user name should be used 33 | * @return 34 | */ 35 | boolean isUseUserName(); 36 | 37 | /** 38 | * for external control, if remote address should be used 39 | * @return 40 | */ 41 | boolean isUseRemoteAddress(); 42 | 43 | /** 44 | * clears all attempts 45 | */ 46 | void clearAttempts(); 47 | 48 | /** 49 | * configured amount of maximum failed attempts before locking 50 | * @return 51 | */ 52 | int getMaximumAttempts(); 53 | } 54 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-commons/src/main/java/de/chandre/admintool/security/commons/auth/UserStateType.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.commons.auth; 2 | 3 | import java.util.Locale; 4 | 5 | /** 6 | * spring security states of user shown in user view 7 | * 8 | * @author Andre 9 | * @since 1.1.5 10 | */ 11 | public enum UserStateType { 12 | 13 | /** 14 | * if account is enabled 15 | */ 16 | ENABLE("enable"), 17 | /** 18 | * if account is expired 19 | */ 20 | EXPIRE("expire"), 21 | /** 22 | * if account is locked 23 | */ 24 | LOCK("lock"), 25 | /** 26 | * if account has expired credentials 27 | */ 28 | EXIPRE_CREDENTIALS("expcred"); 29 | 30 | private String type; 31 | private UserStateType(String type) { 32 | this.type = type; 33 | } 34 | 35 | public static UserStateType fromType(String type) { 36 | if (null != type) { 37 | for (UserStateType userStateType : values()) { 38 | if (userStateType.type.equals(type.toLowerCase(Locale.ENGLISH))) { 39 | return userStateType; 40 | } 41 | } 42 | } 43 | throw new IllegalArgumentException("unknown user state type: " + type); 44 | } 45 | 46 | public String getType() { 47 | return type; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-commons/src/main/resources/i18n/admintool/security-commons-messages.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.security.userMenu.signIn=Sign in 2 | ui.admintool.core.security.userMenu.signOut=Sign out 3 | ui.admintool.core.security.login.error.headline=Error 4 | ui.admintool.core.security.login.error.message=User name and/or password incorrect -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-commons/src/main/resources/i18n/admintool/security-commons-messages_en.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.security.userMenu.signIn=Sign in 2 | ui.admintool.core.security.userMenu.signOut=Sign out 3 | ui.admintool.core.security.login.error.headline=Error 4 | ui.admintool.core.security.login.error.message=User name and/or password incorrect -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-commons/src/main/resources/templates/admintool/includes/dropdownUserMenu.inc.html: -------------------------------------------------------------------------------- 1 | 2 | 26 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-commons/src/main/resources/templates/admintool/includes/menu.inc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-commons/src/main/resources/templates/admintool/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 | 6 | 41 | 42 |
    43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/ATSecDBUtils.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser; 2 | 3 | import java.time.ZonedDateTime; 4 | 5 | import de.chandre.admintool.security.dbuser.domain.User; 6 | 7 | /** 8 | * some static utils 9 | * 10 | * @author Andre 11 | * 12 | */ 13 | public class ATSecDBUtils { 14 | 15 | private ATSecDBUtils() { 16 | } 17 | 18 | /** 19 | * returns the current time of users time zone 20 | * @param user 21 | * @return 22 | */ 23 | public static ZonedDateTime getNowZoned(User user) { 24 | ZonedDateTime time = null; 25 | if (null != user.getTimeZone()) { 26 | try { 27 | time = ZonedDateTime.now(user.getTimeZoneAsTimeZone().toZoneId()); 28 | } catch (Exception e) { 29 | 30 | } 31 | } 32 | if(null == time) { 33 | time = ZonedDateTime.now(); 34 | } 35 | return time; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/AdminToolSecDBTemplateUtils.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser; 2 | 3 | import java.util.Locale; 4 | import java.util.Set; 5 | 6 | /** 7 | * 8 | * @author André 9 | * @since 1.2.0 10 | * 11 | */ 12 | public interface AdminToolSecDBTemplateUtils { 13 | 14 | String[] getAvailableTimeZones(); 15 | 16 | Set getAvailableLocales(); 17 | 18 | String getDefaultTimeZone(); 19 | 20 | boolean isDirectPasswordChangeAllowed(); 21 | 22 | boolean isDirectPasswordChangeInProfileAllowed(); 23 | 24 | boolean isCommunicatorImplemented(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/AdminToolSecDBTemplateUtilsImpl.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser; 2 | 3 | import java.util.Locale; 4 | import java.util.Set; 5 | import java.util.TimeZone; 6 | import java.util.stream.Collectors; 7 | 8 | import org.apache.commons.lang3.LocaleUtils; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Component; 11 | 12 | import de.chandre.admintool.security.dbuser.service.comm.AdminToolSecDBCommunicator; 13 | 14 | /** 15 | * 16 | * @author André 17 | * @since 1.2.0 18 | * 19 | */ 20 | @Component("adminToolSecDBTemplateUtils") 21 | public class AdminToolSecDBTemplateUtilsImpl implements AdminToolSecDBTemplateUtils { 22 | 23 | @Autowired 24 | private AdminToolSecDBProperties properties; 25 | 26 | @Autowired(required=false) 27 | private AdminToolSecDBCommunicator communicator; 28 | 29 | @Override 30 | public String[] getAvailableTimeZones() { 31 | return TimeZone.getAvailableIDs(); 32 | } 33 | 34 | @Override 35 | public String getDefaultTimeZone() { 36 | return TimeZone.getDefault().getID(); 37 | } 38 | 39 | @Override 40 | public Set getAvailableLocales() { 41 | return properties.getUsers().getAvailableLocales().stream().map(LocaleUtils::toLocale).collect(Collectors.toSet()); 42 | } 43 | 44 | @Override 45 | public boolean isDirectPasswordChangeAllowed() { 46 | return properties.getUsers().isDirectPasswordChangeAllowed(); 47 | } 48 | 49 | @Override 50 | public boolean isDirectPasswordChangeInProfileAllowed() { 51 | return properties.getUsers().isDirectPasswordChangeInProfileAllowed(); 52 | } 53 | 54 | @Override 55 | public boolean isCommunicatorImplemented() { 56 | return communicator != null; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/Constants.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser; 2 | 3 | /** 4 | * 5 | * @author André 6 | * @since 1.2.0 7 | */ 8 | public interface Constants { 9 | 10 | String MSG_KEY_PREFIX = "security.db."; 11 | 12 | String CONTENT_TPL_PATH = "/security/content/"; 13 | 14 | /** 15 | * Constants for initiator of communication 16 | * 17 | * @author André 18 | * @since 1.1.7 19 | * 20 | */ 21 | public enum CommunicationProcess { 22 | /** 23 | * user has been created (by process or user) 24 | */ 25 | CREATE_USER, 26 | /** 27 | * reset password request was created by an admin user 28 | */ 29 | RESET_PASSWORD_REQUEST_ADMIN, 30 | /** 31 | * reset password request was created by user 32 | */ 33 | RESET_PASSWORD_REQUEST_SELF; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/auth/AccessRelationTO.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.auth; 2 | 3 | import java.io.Serializable; 4 | import java.util.Set; 5 | 6 | /** 7 | * 8 | * @author André 9 | * @since 1.2.0 10 | * 11 | */ 12 | public class AccessRelationTO implements Serializable { 13 | private static final long serialVersionUID = -5482199588386327064L; 14 | 15 | private String name; 16 | private String displayName; 17 | private String description; 18 | private boolean active; 19 | 20 | private Set relationNames; 21 | 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | public void setName(String name) { 27 | this.name = name; 28 | } 29 | 30 | public String getDisplayName() { 31 | return displayName; 32 | } 33 | 34 | public void setDisplayName(String displayName) { 35 | this.displayName = displayName; 36 | } 37 | 38 | public String getDescription() { 39 | return description; 40 | } 41 | 42 | public void setDescription(String description) { 43 | this.description = description; 44 | } 45 | 46 | public boolean isActive() { 47 | return active; 48 | } 49 | 50 | public void setActive(boolean active) { 51 | this.active = active; 52 | } 53 | 54 | public Set getRelationNames() { 55 | return relationNames; 56 | } 57 | 58 | public void setRelationNames(Set relationNames) { 59 | this.relationNames = relationNames; 60 | } 61 | 62 | @Override 63 | public String toString() { 64 | StringBuilder builder = new StringBuilder(); 65 | builder.append("AccessRelationTO [name=").append(name).append(", displayName=").append(displayName) 66 | .append(", description=").append(description).append(", active=").append(active) 67 | .append(", relationNames=").append(relationNames).append("]"); 68 | return builder.toString(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/auth/AdminToolSecDBAuthenticationFailureListener.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.auth; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.security.authentication.event.AuthenticationFailureBadCredentialsEvent; 5 | 6 | import de.chandre.admintool.security.commons.auth.AdminToolAuthenticationFailureListener; 7 | import de.chandre.admintool.security.commons.auth.LoginAttemptService; 8 | import de.chandre.admintool.security.dbuser.service.AdminToolSecDBUserDetailsService; 9 | 10 | /** 11 | * 12 | * @author André 13 | * @since 1.2.0 14 | * 15 | */ 16 | public class AdminToolSecDBAuthenticationFailureListener extends AdminToolAuthenticationFailureListener { 17 | 18 | @Autowired 19 | private AdminToolSecDBUserDetailsService userDetailsService; 20 | 21 | public AdminToolSecDBAuthenticationFailureListener(LoginAttemptService loginAttemptService) { 22 | super(loginAttemptService); 23 | } 24 | 25 | @Override 26 | public void onApplicationEvent(AuthenticationFailureBadCredentialsEvent event) { 27 | userDetailsService.loginFailed(event.getAuthentication().getName()); 28 | super.onApplicationEvent(event); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/auth/PasswordTO.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.auth; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 7 | * @author André 8 | * @since 1.2.0 9 | * 10 | */ 11 | public class PasswordTO implements Serializable { 12 | private static final long serialVersionUID = 7282206856603860917L; 13 | 14 | private String currentPassword; 15 | private String newPassword; 16 | private String passwordConfirm; 17 | 18 | public String getCurrentPassword() { 19 | return currentPassword; 20 | } 21 | public void setCurrentPassword(String currentPassword) { 22 | this.currentPassword = currentPassword; 23 | } 24 | public String getNewPassword() { 25 | return newPassword; 26 | } 27 | public void setNewPassword(String newPassword) { 28 | this.newPassword = newPassword; 29 | } 30 | public String getPasswordConfirm() { 31 | return passwordConfirm; 32 | } 33 | public void setPasswordConfirm(String passwordConfirm) { 34 | this.passwordConfirm = passwordConfirm; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/contoller/AdminToolSecDBTransformUtil.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.contoller; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.springframework.stereotype.Service; 7 | import org.springframework.util.CollectionUtils; 8 | 9 | import de.chandre.admintool.core.ui.select2.OptionGroupTO; 10 | import de.chandre.admintool.core.ui.select2.OptionTO; 11 | import de.chandre.admintool.core.ui.select2.Select2GroupedTO; 12 | import de.chandre.admintool.security.dbuser.domain.AccessRelation; 13 | 14 | /** 15 | * 16 | * @author André 17 | * @since 1.2.0 18 | * 19 | */ 20 | @Service 21 | public class AdminToolSecDBTransformUtil { 22 | 23 | 24 | public Select2GroupedTO transformAccessRelationToSelect2(List accessRelation) { 25 | Select2GroupedTO response = new Select2GroupedTO<>(); 26 | OptionGroupTO optionActive = new OptionGroupTO("Active Groups"); 27 | OptionGroupTO optionInactive = new OptionGroupTO("Inactive Groups"); 28 | accessRelation.stream().forEach(accessRel -> { 29 | OptionTO option = new OptionTO(accessRel.getName(), accessRel.getDisplayName()); 30 | if(accessRel.isActive()) { 31 | optionActive.addChild(option); 32 | } else { 33 | optionInactive.addChild(option); 34 | } 35 | }); 36 | 37 | if (!CollectionUtils.isEmpty(optionActive.getChildren())) { 38 | Collections.sort(optionActive.getChildren()); 39 | } 40 | if (!CollectionUtils.isEmpty(optionInactive.getChildren())) { 41 | Collections.sort(optionInactive.getChildren()); 42 | } 43 | 44 | if (optionActive.hasChildren() && optionInactive.hasChildren()) { 45 | response.addResult(optionActive); 46 | response.addResult(optionInactive); 47 | } else { 48 | response.setResult(optionActive.getChildren()); 49 | response.getResult().addAll(optionInactive.getChildren()); 50 | } 51 | return response; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/domain/AccessRelation.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.domain; 2 | 3 | /** 4 | * 5 | * @author André 6 | * @since 1.1.7 7 | * 8 | */ 9 | public interface AccessRelation extends Entity { 10 | boolean isActive(); 11 | 12 | String getDescription(); 13 | 14 | String getDisplayName(); 15 | 16 | String getName(); 17 | } 18 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/domain/Client.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.domain; 2 | 3 | public interface Client extends AccessRelation { 4 | 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/domain/Entity.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.domain; 2 | 3 | import java.time.ZonedDateTime; 4 | 5 | import org.springframework.data.domain.Persistable; 6 | 7 | /** 8 | * interface for all entities 9 | * 10 | * @author André 11 | * @since 1.1.7 12 | * 13 | */ 14 | public interface Entity extends Persistable { 15 | 16 | Integer getVersion(); 17 | 18 | ZonedDateTime getCreated(); 19 | 20 | String getCreatedBy(); 21 | 22 | ZonedDateTime getModified(); 23 | 24 | String getModifiedBy(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/domain/Role.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.domain; 2 | 3 | import java.util.Set; 4 | 5 | import org.springframework.security.core.GrantedAuthority; 6 | 7 | public interface Role extends GrantedAuthority, AccessRelation { 8 | 9 | Set getUserGroups(); 10 | } 11 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/domain/User.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.domain; 2 | 3 | import java.time.ZonedDateTime; 4 | import java.util.Locale; 5 | import java.util.Set; 6 | import java.util.TimeZone; 7 | 8 | import org.springframework.security.core.userdetails.UserDetails; 9 | 10 | public interface User extends UserDetails, Entity { 11 | 12 | boolean isAccountLocked(); 13 | 14 | boolean isAccountExpired(); 15 | 16 | boolean isCredentialsExpired(); 17 | 18 | boolean isNotEnabled(); 19 | 20 | Set getUserGroups(); 21 | 22 | Set getClients(); 23 | 24 | Set getActiveClients(); 25 | 26 | ZonedDateTime getLastLogin(); 27 | 28 | ZonedDateTime getLastLoginAttempt(); 29 | 30 | int getLoginAttempts(); 31 | 32 | ZonedDateTime getPasswordLinkCreated(); 33 | 34 | String getPasswordLinkHash(); 35 | 36 | String getPhone(); 37 | 38 | String getEmail(); 39 | 40 | String getLastName(); 41 | 42 | String getFirstName(); 43 | 44 | ZonedDateTime getCredentialsExpiredSince(); 45 | 46 | ZonedDateTime getAccountLockedSince(); 47 | 48 | ZonedDateTime getAccountExpiredSince(); 49 | 50 | String getLocale(); 51 | 52 | Locale getLocaleAsLocale(); 53 | 54 | String getTimeZone(); 55 | 56 | TimeZone getTimeZoneAsTimeZone(); 57 | 58 | } 59 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/domain/UserGroup.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.domain; 2 | 3 | import java.util.Set; 4 | import java.util.stream.Stream; 5 | 6 | public interface UserGroup extends AccessRelation { 7 | 8 | Set getUsers(); 9 | 10 | Stream getActiveRoles(); 11 | 12 | Set getRoles(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/repo/ClientRepository.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.repo; 2 | 3 | import java.util.List; 4 | import java.util.Set; 5 | 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | import org.springframework.data.jpa.repository.Query; 8 | import org.springframework.stereotype.Repository; 9 | 10 | import de.chandre.admintool.security.dbuser.domain.ATClient; 11 | 12 | /** 13 | * 14 | * @author André 15 | * @since 1.1.7 16 | */ 17 | @Repository 18 | public interface ClientRepository extends JpaRepository { 19 | 20 | ATClient findByName(String name); 21 | 22 | @Query("SELECT c.name FROM ATClient c") 23 | List findAllClientNames(); 24 | 25 | List findByNameIn(Set clientNames); 26 | 27 | void deleteByName(String name); 28 | } 29 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/repo/RoleRepository.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.repo; 2 | 3 | import java.util.List; 4 | import java.util.Set; 5 | 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | import org.springframework.data.jpa.repository.Query; 8 | import org.springframework.stereotype.Repository; 9 | 10 | import de.chandre.admintool.security.dbuser.domain.ATRole; 11 | 12 | /** 13 | * 14 | * @author André 15 | * @since 1.1.7 16 | */ 17 | @Repository 18 | public interface RoleRepository extends JpaRepository { 19 | 20 | ATRole findByName(String name); 21 | 22 | @Query("SELECT r.name FROM ATRole r") 23 | List findAllRoleNames(); 24 | 25 | List findByNameIn(Set ids); 26 | 27 | List findByIdIn(Set ids); 28 | 29 | void deleteByName(String name); 30 | } 31 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/repo/UserGroupRepository.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.repo; 2 | 3 | import java.util.Collection; 4 | import java.util.List; 5 | import java.util.Set; 6 | 7 | import org.springframework.data.jpa.repository.JpaRepository; 8 | import org.springframework.data.jpa.repository.Query; 9 | import org.springframework.stereotype.Repository; 10 | 11 | import de.chandre.admintool.security.dbuser.domain.ATRole; 12 | import de.chandre.admintool.security.dbuser.domain.ATUserGroup; 13 | 14 | /** 15 | * 16 | * @author André 17 | * @since 1.2.0 18 | */ 19 | @Repository 20 | public interface UserGroupRepository extends JpaRepository { 21 | 22 | ATUserGroup findByName(String name); 23 | 24 | @Query("SELECT ug.name FROM ATUserGroup ug") 25 | List findAllATUserGroupNames(); 26 | 27 | List findByNameIn(Collection names); 28 | 29 | List findByIdIn(Set ids); 30 | 31 | void deleteByName(String name); 32 | 33 | int countUserGroupsByRolesIn(List asList); 34 | 35 | List findByRolesIn(List asList); 36 | } 37 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/repo/UserGroupSpecifications.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.repo; 2 | 3 | import java.util.Set; 4 | 5 | import org.springframework.data.jpa.domain.Specification; 6 | 7 | import de.chandre.admintool.security.dbuser.domain.ATUserGroup; 8 | 9 | /** 10 | * 11 | * @author André 12 | * @since 1.1.7 13 | */ 14 | public class UserGroupSpecifications { 15 | 16 | 17 | } 18 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/repo/UserRepository.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.repo; 2 | 3 | import java.util.Collection; 4 | import java.util.List; 5 | 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | import org.springframework.stereotype.Repository; 8 | 9 | import de.chandre.admintool.security.dbuser.domain.ATUser; 10 | import de.chandre.admintool.security.dbuser.domain.ATUserGroup; 11 | 12 | /** 13 | * 14 | * @author André 15 | * @since 1.2.0 16 | */ 17 | @Repository 18 | public interface UserRepository extends JpaRepository { 19 | 20 | ATUser findByUsername(String username); 21 | 22 | ATUser findByPasswordLinkHash(String passwordLinkHash); 23 | 24 | void deleteByUsername(String username); 25 | 26 | int countUsersByUserGroupsIn(Collection userGroups); 27 | 28 | List findByUserGroupsIn(Collection userGroups); 29 | } 30 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/AdminToolSecDBClientService.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.service; 2 | 3 | import java.util.List; 4 | import java.util.Set; 5 | 6 | import de.chandre.admintool.core.ui.ATError; 7 | import de.chandre.admintool.security.dbuser.auth.AccessRelationTO; 8 | import de.chandre.admintool.security.dbuser.domain.ATClient; 9 | 10 | /** 11 | * 12 | * @author André 13 | * @since 1.2.0 14 | */ 15 | public interface AdminToolSecDBClientService { 16 | 17 | List getAllClients(); 18 | 19 | ATClient getClient(String name); 20 | 21 | ATClient changeState(String name); 22 | 23 | Set updateClient(AccessRelationTO accessRelationTO); 24 | 25 | ATClient saveClient(ATClient client); 26 | 27 | Set addClient(AccessRelationTO accessRelationTO); 28 | 29 | void removeByName(String name); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/AdminToolSecDBRoleService.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.service; 2 | 3 | import java.util.List; 4 | import java.util.Set; 5 | 6 | import de.chandre.admintool.core.sec.ATInitRole; 7 | import de.chandre.admintool.core.ui.ATError; 8 | import de.chandre.admintool.security.dbuser.auth.AccessRelationTO; 9 | import de.chandre.admintool.security.dbuser.domain.ATRole; 10 | 11 | /** 12 | * 13 | * @author André 14 | * @since 1.2.0 15 | */ 16 | public interface AdminToolSecDBRoleService { 17 | 18 | List getAllRoles(); 19 | 20 | ATRole changeState(String name); 21 | 22 | List getAllRoleNames(); 23 | 24 | ATRole getRole(String name); 25 | 26 | ATRole saveRole(ATRole role); 27 | 28 | Set updateRole(AccessRelationTO accessRelationTO); 29 | 30 | Set addRolesIfNotExists(Set roles); 31 | 32 | int getAssignedUserGroupCount(ATRole role); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/AdminToolSecDBUserGroupService.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.service; 2 | 3 | import java.util.List; 4 | import java.util.Set; 5 | 6 | import de.chandre.admintool.core.ui.ATError; 7 | import de.chandre.admintool.security.dbuser.auth.AccessRelationTO; 8 | import de.chandre.admintool.security.dbuser.domain.ATUserGroup; 9 | 10 | /** 11 | * 12 | * @author André 13 | * @since 1.2.0 14 | */ 15 | public interface AdminToolSecDBUserGroupService { 16 | 17 | List getAllUserGroups(); 18 | 19 | ATUserGroup changeState(String name); 20 | 21 | ATUserGroup getUserGroup(String name); 22 | 23 | ATUserGroup saveUserGroup(ATUserGroup userGroup); 24 | 25 | Set updateUserGroup(AccessRelationTO accessRelationTO); 26 | 27 | Set addUserGroup(AccessRelationTO accessRelationTO); 28 | 29 | void removeByName(String name); 30 | 31 | int getAssignedUserCount(ATUserGroup userGroup); 32 | 33 | List getUserGroupsByRoleName(String roleName); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/DefaultPasswordLinkHashGenerator.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.service; 2 | 3 | import java.util.UUID; 4 | 5 | /** 6 | * uses the UUID to generate a unique non-reproducible string 7 | * @author André 8 | * @since 1.2.0 9 | * 10 | */ 11 | public class DefaultPasswordLinkHashGenerator implements PasswordLinkHashGenerator { 12 | 13 | @Override 14 | public String generatePasswordLinkHash() { 15 | return UUID.randomUUID().toString(); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/PasswordLinkHashGenerator.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.service; 2 | 3 | /** 4 | * 5 | * @author André 6 | * @since 1.2.0 7 | * 8 | */ 9 | public interface PasswordLinkHashGenerator { 10 | 11 | /** 12 | * should return a unique string (hash or UUID) to identify a user when password reset request has been executed 13 | * @return a String 14 | */ 15 | String generatePasswordLinkHash(); 16 | } 17 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/comm/AdminToolSecDBCommunicator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package de.chandre.admintool.security.dbuser.service.comm; 5 | 6 | import de.chandre.admintool.security.dbuser.Constants.CommunicationProcess; 7 | 8 | /** 9 | * @author André 10 | * @since 1.2.0 11 | * 12 | */ 13 | public interface AdminToolSecDBCommunicator { 14 | 15 | /** 16 | * should send a notice to the user that password has been reset and he/she must visit a special site to set a new one 17 | * or may ask somebody to reset it. 18 | * @param username 19 | * @param email 20 | * @param phone 21 | * @param passwordLinkHash 22 | * @throws SendException 23 | */ 24 | void sendResetPasswordNotice(CommunicationProcess process, String username, String email, String phone, String passwordLinkHash) throws SendException; 25 | } 26 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/comm/SendException.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.service.comm; 2 | 3 | /** 4 | * Exception to be sent when sending the information fails 5 | * 6 | * @author André 7 | * @since 1.2.0 8 | * 9 | */ 10 | public class SendException extends Exception { 11 | private static final long serialVersionUID = 6773428392816080970L; 12 | 13 | public SendException() { 14 | super(); 15 | } 16 | 17 | public SendException(String message) { 18 | super(message); 19 | } 20 | 21 | public SendException(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | public SendException(String message, Throwable cause) { 26 | super(message, cause); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/validation/ATSecDBValidator.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.service.validation; 2 | 3 | import java.util.Set; 4 | 5 | import de.chandre.admintool.core.ui.ATError; 6 | import de.chandre.admintool.security.dbuser.AdminToolSecDBProperties.Validations; 7 | 8 | /** 9 | * interface for validator, implemented by {@link AbstractValidator} 10 | * 11 | * @author André 12 | * @since 1.2.0 13 | * 14 | */ 15 | public interface ATSecDBValidator { 16 | 17 | void validate(String value, Validations validations, String fieldName, Set errors); 18 | 19 | String getMessageWithSuffix(String suffix, Object[] args, String defaultMessage); 20 | 21 | String getMessage(String code, Object[] args, String defaultMessage); 22 | } 23 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/validation/AdminToolSecDBClientValidator.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.service.validation; 2 | 3 | import java.util.Set; 4 | 5 | import de.chandre.admintool.core.ui.ATError; 6 | import de.chandre.admintool.security.dbuser.domain.Client; 7 | 8 | /** 9 | * 10 | * @author André 11 | * @since 1.1.7 12 | */ 13 | public interface AdminToolSecDBClientValidator extends ATSecDBValidator { 14 | 15 | Set validate(Client client); 16 | } 17 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/validation/AdminToolSecDBRoleValidator.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.service.validation; 2 | 3 | import java.util.Set; 4 | 5 | import de.chandre.admintool.core.ui.ATError; 6 | import de.chandre.admintool.security.dbuser.domain.Role; 7 | 8 | /** 9 | * 10 | * @author André 11 | * @since 1.1.7 12 | */ 13 | public interface AdminToolSecDBRoleValidator extends ATSecDBValidator { 14 | 15 | Set validate(Role role); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/validation/AdminToolSecDBUserGroupValidator.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.service.validation; 2 | 3 | import java.util.Set; 4 | 5 | import de.chandre.admintool.core.ui.ATError; 6 | import de.chandre.admintool.security.dbuser.domain.UserGroup; 7 | 8 | /** 9 | * 10 | * @author André 11 | * @since 1.1.7 12 | */ 13 | public interface AdminToolSecDBUserGroupValidator extends ATSecDBValidator { 14 | 15 | Set validate(UserGroup userGroup); 16 | } 17 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/validation/AdminToolSecDBUserValidator.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.service.validation; 2 | 3 | import java.util.Set; 4 | 5 | import de.chandre.admintool.core.ui.ATError; 6 | import de.chandre.admintool.security.dbuser.domain.User; 7 | 8 | /** 9 | * 10 | * @author André 11 | * @since 1.1.7 12 | */ 13 | public interface AdminToolSecDBUserValidator extends ATSecDBValidator { 14 | 15 | /** 16 | * user validation against configured rules 17 | * 18 | * @param user 19 | * @param validatePassword 20 | * @return 21 | */ 22 | Set validate(User user, boolean validatePassword); 23 | 24 | /** 25 | * validates the user and current password against AuthenticationManager and the new passwords against its validation rules 26 | * 27 | * @param userName 28 | * @param currentPassword 29 | * @param newPassword 30 | * @param confirmPassword 31 | * @return 32 | */ 33 | Set validatePasswordChange(String userName, String currentPassword, String newPassword, 34 | String confirmPassword); 35 | 36 | /** 37 | * just validates the passwords against its validation rules 38 | * 39 | * @param username 40 | * @param newPassword 41 | * @param confirmPassword 42 | * @return 43 | */ 44 | Set validatePasswordReset(String username, String newPassword, String confirmPassword); 45 | } 46 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/validation/AdminToolValidationInterceptor.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.dbuser.service.validation; 2 | 3 | import java.util.Set; 4 | 5 | import de.chandre.admintool.core.ui.ATError; 6 | import de.chandre.admintool.security.dbuser.domain.AbstractEntity; 7 | import de.chandre.admintool.security.dbuser.domain.Entity; 8 | 9 | /** 10 | * interface custom validation interceptors 11 | * 12 | * @author André 13 | * @since 1.2.0 14 | * 15 | * @param The entity to validate will be an implementation of {@link AbstractEntity} 16 | */ 17 | public interface AdminToolValidationInterceptor { 18 | 19 | /** 20 | * the lower the precedence the earlier the interceptor is getting called (after standard validations) 21 | * @return 22 | */ 23 | int getPrecedence(); 24 | 25 | /** 26 | * custom implementation of validation method.
    27 | * if validation should fail, just add a entry to set of errors 28 | * 29 | * @param object the object to validate 30 | * @param errors not empty! could already contain errors 31 | * @param delegator the calling service. will provide some convenience methods 32 | */ 33 | void validate(O object, Set errors, AbstractValidator delegator); 34 | } 35 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/resources/static/admintool/security/css/accessmanagement.css: -------------------------------------------------------------------------------- 1 | input#userPassword, input#currentPassword, input#newPassword, input#password { 2 | font-family: monospace; 3 | } 4 | 5 | .spacer5right { 6 | margin-right: 5px; 7 | } 8 | 9 | .spacer2left { 10 | margin-left: 2px; 11 | } -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/resources/static/admintool/security/js/passwordgen.js: -------------------------------------------------------------------------------- 1 | AdminTool.PasswordGenerator = function(parent) { 2 | var self = this; 3 | 4 | this.construct = function(parent) { 5 | this.parent = parent; 6 | this.options = {}; 7 | $.extend(true, this.options, parent.options); 8 | }; 9 | 10 | this.generatePass = function (plength) { 11 | 12 | if (!plength && self.options.hasOwnProperty('passwordLength')) { 13 | plength = self.options.passwordLength; 14 | } 15 | if (!plength) { 16 | plength = 12; 17 | } 18 | 19 | var keylistalpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMOPQRSTUVWXYZ"; 20 | var keylistint="1234567890"; 21 | var keylistspec="!@#_$.-"; 22 | var temp=''; 23 | var len = plength/2; 24 | var len = len - 1; 25 | var lenspec = plength-len-len; 26 | 27 | for (i=0;i 0; i--) { 43 | j = Math.floor(Math.random() * (i + 1)); 44 | x = a[i]; 45 | a[i] = a[j]; 46 | a[j] = x; 47 | } 48 | return a; 49 | }; 50 | 51 | this.construct(parent); 52 | }; -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/resources/static/admintool/security/js/resetPassword.js: -------------------------------------------------------------------------------- 1 | 2 | AdminTool.ResetPassword = function(el, options) { 3 | if (el) { 4 | this.init(el, options) 5 | } 6 | } 7 | AdminTool.ResetPassword.prototype = new AdminTool.AccessManagement(); 8 | 9 | $.extend(AdminTool.ResetPassword.prototype, { 10 | 11 | name : 'resetPassword', 12 | 13 | postInit: function() { 14 | 15 | this.options = $.extend( this.options, { 16 | passwordLength : 14 17 | }); 18 | 19 | this.validationUtil = new AdminTool.ValidationUtil(this); 20 | this.formId = '#profileDataForm'; 21 | this.validationUtil.create(this.formId); 22 | 23 | this.passwordGen = new AdminTool.PasswordGenerator(this); 24 | 25 | this.initButtons(); 26 | }, 27 | 28 | initButtons : function() { 29 | var genPwdButton = getByID('generatePassword'); 30 | genPwdButton.off(); 31 | genPwdButton.on('click', $.proxy(this.generatePassword, this, 'password')); 32 | genPwdButton.parent().show(); 33 | 34 | var showPwdButton = getByID('showPassword'); 35 | showPwdButton.off(); 36 | showPwdButton.on('click', $.proxy(this.switchPasswordVisibility, this, 'password')); 37 | showPwdButton.parent().show(); 38 | } 39 | 40 | }); 41 | 42 | $.pluginMaker(AdminTool.ResetPassword); 43 | 44 | 45 | $( document ).ready(function() { 46 | if ($("#resetPassword").length > 0) { 47 | $("#resetPassword").resetPassword(); 48 | } 49 | }); 50 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-dbuser/src/main/resources/templates/admintool/includes/dropdownUserMenu.inc.html: -------------------------------------------------------------------------------- 1 | 2 | 32 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-simple/doc/screen_userview_org.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andrehertwig/admintool/5763c6a913244a7aab2f7564694fd6d756802116/admin-tools-security/admin-tools-security-simple/doc/screen_userview_org.png -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-simple/src/main/java/de/chandre/admintool/security/simple/auth/AdminToolSecSimpleUserDetailsService.java: -------------------------------------------------------------------------------- 1 | package de.chandre.admintool.security.simple.auth; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.security.core.GrantedAuthority; 6 | 7 | import de.chandre.admintool.security.commons.auth.AdminToolUserDetailsService; 8 | 9 | /** 10 | * Interface for admintool UserDetailsService 11 | * @author Andre 12 | * @since 1.1.5 13 | */ 14 | public interface AdminToolSecSimpleUserDetailsService extends AdminToolUserDetailsService { 15 | 16 | /** 17 | * add roles to a user 18 | * @param username 19 | * @param authorities 20 | */ 21 | void addUserRoles(String username, Collection authorities); 22 | 23 | /** 24 | * remove roles from user 25 | * @param username 26 | * @param authorities 27 | */ 28 | void removeUserRoles(String username, Collection authorities); 29 | 30 | /** 31 | * override all roles 32 | * @param username 33 | * @param authorities 34 | */ 35 | void setUserRoles(String username, Collection authorities); 36 | } 37 | -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-simple/src/main/resources/i18n/admintool/security-simple-messages.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.security.users.displayName=Users 2 | ui.admintool.core.security.users.headline=All Users 3 | ui.admintool.core.security.users.subHeadline=Users 4 | ui.admintool.core.security.users.tableHead.name=Name 5 | ui.admintool.core.security.users.tableHead.enabled=Enabled 6 | ui.admintool.core.security.users.tableHead.expired=Expired 7 | ui.admintool.core.security.users.tableHead.locked=Locked 8 | ui.admintool.core.security.users.tableHead.credExp=CredentialsExpired 9 | ui.admintool.core.security.users.tableHead.roles=Roles 10 | 11 | ui.admintool.core.security.users.modal.head=Edit User 12 | ui.admintool.core.security.users.modal.name=Name 13 | ui.admintool.core.security.users.modal.password=Password -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-simple/src/main/resources/i18n/admintool/security-simple-messages_en.properties: -------------------------------------------------------------------------------- 1 | ui.admintool.core.security.users.displayName=Users 2 | ui.admintool.core.security.users.headline=All Users 3 | ui.admintool.core.security.users.subHeadline=Users 4 | ui.admintool.core.security.users.tableHead.name=Name 5 | ui.admintool.core.security.users.tableHead.enabled=Enabled 6 | ui.admintool.core.security.users.tableHead.expired=Expired 7 | ui.admintool.core.security.users.tableHead.locked=Locked 8 | ui.admintool.core.security.users.tableHead.credExp=CredentialsExpired 9 | ui.admintool.core.security.users.tableHead.roles=Roles 10 | 11 | ui.admintool.core.security.users.modal.head=Edit User 12 | ui.admintool.core.security.users.modal.name=Name 13 | ui.admintool.core.security.users.modal.password=Password -------------------------------------------------------------------------------- /admin-tools-security/admin-tools-security-simple/src/main/resources/templates/admintool/includes/dropdownUserMenu.inc.html: -------------------------------------------------------------------------------- 1 | 2 | 28 | -------------------------------------------------------------------------------- /admin-tools-security/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 4.0.0 5 | 6 | 7 | de.chandre.admin-tools 8 | admin-tools 9 | 1.2.0-SNAPSHOT 10 | ../ 11 | 12 | 13 | de.chandre.admin-tools.security 14 | admin-tools-security 15 | 16 | admin-tools security parent 17 | admin-tools security parent 18 | 19 | pom 20 | 21 | 22 | admin-tools-security-commons 23 | admin-tools-security-simple 24 | admin-tools-security-dbuser 25 | 26 | 27 | 28 | 29 | 30 | de.chandre.admin-tools.security 31 | admin-tools-security-commons 32 | ${project.version} 33 | 34 | 35 | 36 | 37 | 38 | --------------------------------------------------------------------------------