From a61c98775fad25e2e4636206231d64c9dcae604a Mon Sep 17 00:00:00 2001 From: Gil Portenseigne Date: Thu, 27 Sep 2018 16:01:35 +0000 Subject: [PATCH] Implemented : Impersonation of userLogin feature (OFBIZ-10515) Introduce a new feature that allow the impersonation of a login by an authorized user. Add the documentation with all the details in security-impersonation.adoc. Big thanks to Leila, Nicolas and Jacques for your contribution to this implementation. Big thanks to Mathieu, Jacques, Pierre and Taher for your remarks and reviews that improved this contribution quality. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1842110 13f79535-47bb-0310-9956-ffa450edef68 --- .../party/profileblocks/UserLogin.ftl | 3 + .../template/party/profileblocks/Visits.ftl | 6 + .../party/widget/partymgr/PartyMenus.xml | 8 +- .../party/widget/partymgr/PartyVisitForms.xml | 12 +- docs/asciidoc/developer-manual.adoc | 2 +- framework/common/config/CommonUiLabels.xml | 27 +++ .../common/config/SecurityextUiLabels.xml | 30 ++- .../data/CommonSecurityGroupDemoData.xml | 5 + .../data/CommonSecurityPermissionSeedData.xml | 7 +- framework/common/data/CommonTypeData.xml | 1 + framework/common/servicedef/services.xml | 12 + .../ofbiz/common/login/LoginServices.java | 123 ++++++++++ .../webcommon/WEB-INF/common-controller.xml | 14 ++ framework/common/widget/CommonScreens.xml | 12 + framework/security/config/security.properties | 5 + .../security/data/SecurityGroupDemoData.xml | 3 +- framework/security/entitydef/entitymodel.xml | 23 ++ .../_include/security-impersonation.adoc | 127 ++++++++++ .../security/src/doc/asciidoc/security.adoc | 23 ++ .../apache/ofbiz/security/SecurityUtil.java | 122 ++++++++++ .../ofbiz/webapp/control/LoginWorker.java | 222 ++++++++++++++++++ themes/bluelight/template/Header.ftl | 1 + .../template/ImpersonateBanner.ftl | 11 + themes/common-theme/template/Impersonated.ftl | 33 +++ .../webapp/common/css/impersonate.css | 180 ++++++++++++++ .../webapp/images/img/impersonate-ico.png | Bin 0 -> 3823 bytes themes/common-theme/widget/CommonScreens.xml | 39 ++- themes/common-theme/widget/Theme.xml | 1 + themes/flatgrey/template/Header.ftl | 1 + .../template/includes/TopAppBar.ftl | 1 + themes/tomahawk/template/Header.ftl | 1 + 31 files changed, 1046 insertions(+), 9 deletions(-) create mode 100644 framework/security/src/doc/asciidoc/_include/security-impersonation.adoc create mode 100644 framework/security/src/doc/asciidoc/security.adoc create mode 100644 framework/security/src/main/java/org/apache/ofbiz/security/SecurityUtil.java create mode 100644 themes/common-theme/template/ImpersonateBanner.ftl create mode 100644 themes/common-theme/template/Impersonated.ftl create mode 100644 themes/common-theme/webapp/common/css/impersonate.css create mode 100644 themes/common-theme/webapp/images/img/impersonate-ico.png diff --git a/applications/party/template/party/profileblocks/UserLogin.ftl b/applications/party/template/party/profileblocks/UserLogin.ftl index bee922f209..b1a197916b 100644 --- a/applications/party/template/party/profileblocks/UserLogin.ftl +++ b/applications/party/template/party/profileblocks/UserLogin.ftl @@ -53,6 +53,9 @@ under the License. <#if security.hasEntityPermission("SECURITY", "_VIEW", session)> ${uiLabelMap.SecurityGroups} + <#if security.hasEntityPermission("IMPERSONATE", "_ADMIN", session)> + ${uiLabelMap.CommonImpersonate} + diff --git a/applications/party/template/party/profileblocks/Visits.ftl b/applications/party/template/party/profileblocks/Visits.ftl index 3f2486bc03..54f49fb5f8 100644 --- a/applications/party/template/party/profileblocks/Visits.ftl +++ b/applications/party/template/party/profileblocks/Visits.ftl @@ -31,6 +31,7 @@ under the License. ${uiLabelMap.PartyVisitId} ${uiLabelMap.PartyUserLogin} + ${uiLabelMap.CommonImpersonateUserLogin} ${uiLabelMap.PartyNewUser} ${uiLabelMap.PartyWebApp} ${uiLabelMap.PartyClientIP} @@ -39,11 +40,16 @@ under the License. <#list visits as visitObj> <#if (visitObj_index > 4)><#break> + <#assign userLoginHistory = EntityQuery.use(delegator).from("UserLoginHistory").where('visitId',visitObj.visitId!).queryFirst()!> + <#if userLoginHistory??> + <#assign impersonateUserLoginId = userLoginHistory.originUserLoginId!> + ${visitObj.visitId!} ${visitObj.userLoginId!} + ${impersonateUserLoginId!} ${visitObj.userCreated!} ${visitObj.webappName!} ${visitObj.clientIpAddress!} diff --git a/applications/party/widget/partymgr/PartyMenus.xml b/applications/party/widget/partymgr/PartyMenus.xml index 603a13ec14..c45ca6b77b 100644 --- a/applications/party/widget/partymgr/PartyMenus.xml +++ b/applications/party/widget/partymgr/PartyMenus.xml @@ -772,5 +772,11 @@ - + + + + + + + diff --git a/applications/party/widget/partymgr/PartyVisitForms.xml b/applications/party/widget/partymgr/PartyVisitForms.xml index c4120db184..a6f9d234fc 100644 --- a/applications/party/widget/partymgr/PartyVisitForms.xml +++ b/applications/party/widget/partymgr/PartyVisitForms.xml @@ -41,7 +41,6 @@ under the License. odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar"> - @@ -51,7 +50,15 @@ under the License. - + + + + + + + + + @@ -64,6 +71,7 @@ under the License. + diff --git a/docs/asciidoc/developer-manual.adoc b/docs/asciidoc/developer-manual.adoc index 4e1231baa5..07c16d4b6b 100644 --- a/docs/asciidoc/developer-manual.adoc +++ b/docs/asciidoc/developer-manual.adoc @@ -269,6 +269,6 @@ displays search results. == Deployment -== Security +include::../../framework/security/src/doc/asciidoc/security.adoc[leveloffset=+1] == Appendices diff --git a/framework/common/config/CommonUiLabels.xml b/framework/common/config/CommonUiLabels.xml index 45ef7cd00a..581634d5ce 100644 --- a/framework/common/config/CommonUiLabels.xml +++ b/framework/common/config/CommonUiLabels.xml @@ -5517,6 +5517,22 @@ 图片 圖片 + + Impersonate + Incarner + + + User impersonated + Utilisateur incarné + + + Impersonation in process + Incarnation en cours + + + Stop impersonation + Arrêter l'incarnation + Import 导入 @@ -8231,6 +8247,13 @@ 机构图标 機構商標 + + Herkunft Benutzeranmeldung ID + Origin User Login ID + Código de usuario de origen + Identifiant de connexion d'origine + Codice utente di origine + أخرى Jiný(á) @@ -14885,6 +14908,10 @@ 编辑数据源类型 編輯資料源類型 + + Impersonated + Substitué + قائمة مصادر المعلومات Seznam datových zdrojů diff --git a/framework/common/config/SecurityextUiLabels.xml b/framework/common/config/SecurityextUiLabels.xml index de8e9850cd..d69ae2bc86 100644 --- a/framework/common/config/SecurityextUiLabels.xml +++ b/framework/common/config/SecurityextUiLabels.xml @@ -107,6 +107,26 @@ 登录时发生下列错误:${errorMessage} 登入時發生錯誤: ${errorMessage}. + + You can't impersonate yourself ... What are you trying to do ? + Vous ne pouvez pas vous incarner vous même ... Qu'essayez-vous donc de faire ? + + + You cannot impersonate a login with more permission than you have : ${missingPermissions} + Vous ne pouvez pas incarner un utilisateur avec un niveau de permission supérieur au vôtre : ${missingPermissions} + + + You cannot impersonate a login with ADMIN permission + Vous ne pouvez pas incarner un utilisateur avec un niveau de permission ADMIN + + + Impersonation feature is disabled, please check security configuration + La fonctionnalité d'incarnation est désactivée, merci de vérifier la configuration sécurité + + + Impersonation of your user is in process by ${originUserLoginId} + Incarnation de votre utilisateur en cours par ${originUserLoginId} + Ein neues Passwort wurde erzeugt und Ihnen per E-Mail zugeschickt. Überprüfen Sie bitte Ihren E-Mail-Eingang. A new password has been created and sent to you. Please check your Email. @@ -245,6 +265,14 @@ 配置出错;请与客户服务联系。 設定有問題: 請聯絡客服. + + You already have an impersonation in process. Please leave it before continue + Vous avez déjà une incarnation en cours, veuillez mettre fin à celle-ci avant de continuer + + + Problem getting User Login Security Question record. + Problème durant la lecture de votre question de sécurité + You cannot login to this tenant No puede conectarse con esta organización @@ -865,4 +893,4 @@ 将重新启用 ${reEnableTime}。 將重新啟用 ${reEnableTime}. - \ No newline at end of file + diff --git a/framework/common/data/CommonSecurityGroupDemoData.xml b/framework/common/data/CommonSecurityGroupDemoData.xml index 62b91d67ef..0f91c425c5 100644 --- a/framework/common/data/CommonSecurityGroupDemoData.xml +++ b/framework/common/data/CommonSecurityGroupDemoData.xml @@ -40,4 +40,9 @@ + + + + + diff --git a/framework/common/data/CommonSecurityPermissionSeedData.xml b/framework/common/data/CommonSecurityPermissionSeedData.xml index 5ea573fcfd..0d69d81bc4 100644 --- a/framework/common/data/CommonSecurityPermissionSeedData.xml +++ b/framework/common/data/CommonSecurityPermissionSeedData.xml @@ -36,12 +36,15 @@ - + + + - + + diff --git a/framework/common/data/CommonTypeData.xml b/framework/common/data/CommonTypeData.xml index 658ca1cf55..9ae9fc7e38 100644 --- a/framework/common/data/CommonTypeData.xml +++ b/framework/common/data/CommonTypeData.xml @@ -113,6 +113,7 @@ under the License. + diff --git a/framework/common/servicedef/services.xml b/framework/common/servicedef/services.xml index 348bebaba9..083f81d5d5 100644 --- a/framework/common/servicedef/services.xml +++ b/framework/common/servicedef/services.xml @@ -381,6 +381,18 @@ under the License. + + Used to Automatically Authenticate a username/password; create a UserLogin object + + + + + + + + + + Create a UserLogin diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java b/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java index 43e50d95b1..bca0c8397b 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/login/LoginServices.java @@ -20,6 +20,7 @@ package org.apache.ofbiz.common.login; import java.sql.Timestamp; +import java.util.Calendar; import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; @@ -27,6 +28,7 @@ import java.util.Locale; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -53,6 +55,7 @@ import org.apache.ofbiz.entity.util.EntityListIterator; import org.apache.ofbiz.entity.util.EntityQuery; import org.apache.ofbiz.entity.util.EntityUtilProperties; import org.apache.ofbiz.security.Security; +import org.apache.ofbiz.security.SecurityUtil; import org.apache.ofbiz.service.DispatchContext; import org.apache.ofbiz.service.GenericServiceException; import org.apache.ofbiz.service.LocalDispatcher; @@ -435,6 +438,126 @@ public class LoginServices { return result; } + /** + * Login service to authenticate a username without password, storing history + * + * @return Map of results including (userLogin) GenericValue object + */ + public static Map userImpersonate(DispatchContext ctx, Map context) { + Locale locale = (Locale) context.get("locale"); + Delegator delegator = ctx.getDelegator(); + Map result = ServiceUtil.returnSuccess(); + + String userLoginIdToImpersonate = (String) context.get("userLoginIdToImpersonate"); + GenericValue originUserLogin = (GenericValue) context.get("userLogin"); + // get the visitId for the history entity + String visitId = (String) context.get("visitId"); + + if ("true".equalsIgnoreCase(EntityUtilProperties.getPropertyValue("security", "username.lowercase", delegator))) { + userLoginIdToImpersonate = userLoginIdToImpersonate.toLowerCase(); + } + + GenericValue userLogin; + try { + userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginIdToImpersonate).queryOne(); + } catch (GenericEntityException e) { + Debug.logError(e, module); + return ServiceUtil.returnError(e.getMessage()); + } + + // check impersonation controls + String errorMessage = checkImpersonationControls(delegator, originUserLogin, userLogin, locale); + if (errorMessage != null) { + return ServiceUtil.returnError(errorMessage); + } + + // return the UserLoginSession Map + Map userLoginSessionMap = LoginWorker.getUserLoginSession(userLogin); + if (userLoginSessionMap != null) { + result.put("userLoginSession", userLoginSessionMap); + } + + // grab the hasLoggedOut flag + boolean hasLoggedOut = "Y".equalsIgnoreCase(userLogin.getString("hasLoggedOut")); + if (hasLoggedOut || UtilValidate.isEmpty(userLogin.getString("hasLoggedOut"))) { + userLogin.set("hasLoggedOut", "N"); + try { + userLogin.store(); + } catch (GenericEntityException e) { + Debug.logError(e, module); + return ServiceUtil.returnError(e.getMessage()); + } + } + + //Log impersonation in UserLoginHistory + Map historyCreateMap = UtilMisc.toMap("userLoginId", userLoginIdToImpersonate); + historyCreateMap.put("visitId", visitId); + historyCreateMap.put("fromDate", UtilDateTime.nowTimestamp()); + historyCreateMap.put("successfulLogin", "Y"); + historyCreateMap.put("partyId", userLogin.get("partyId")); + historyCreateMap.put("originUserLoginId", originUserLogin.get("userLoginId")); + //End impersonation in one hour max + historyCreateMap.put("thruDate", UtilDateTime.adjustTimestamp(UtilDateTime.nowTimestamp(), Calendar.HOUR, 1)); + try { + delegator.create("UserLoginHistory", historyCreateMap); + } catch (GenericEntityException e) { + Debug.logError(e, module); + return ServiceUtil.returnError(e.getMessage()); + } + + result.put("userLogin", userLogin); + result.put("originUserLogin", originUserLogin); + return result; + } + + /** + * Return error message if a needed control has failed : + * userLoginToImpersonate must exist + * Impersonation have to be enabled + * Check userLoginIdToImpersonate is active, not Admin and not equals to userLogin + * Check userLogin has enough permission + * + * @param delegator + * @param userLogin + * @param userLoginToImpersonate + * @param locale + * @return + */ + private static String checkImpersonationControls(Delegator delegator, GenericValue userLogin, GenericValue userLoginToImpersonate, Locale locale) { + if (userLoginToImpersonate == null) { + return UtilProperties.getMessage(resource, "loginservices.username_missing", locale); + } + String userLoginId = userLogin.getString("userLoginId"); + String userLoginIdToImpersonate = userLoginToImpersonate.getString("userLoginId"); + + if (UtilProperties.getPropertyAsBoolean("security", "security.disable.impersonation", true)) { + return UtilProperties.getMessage(resource, "loginevents.impersonation_disabled", locale); + } + + if (!LoginWorker.isUserLoginActive(userLoginToImpersonate)) { + Map messageMap = UtilMisc.toMap("username", userLoginIdToImpersonate); + return UtilProperties.getMessage(resource, "loginservices.account_for_user_login_id_disabled", messageMap, locale); + } + + if (SecurityUtil.hasUserLoginAdminPermission(delegator, userLoginIdToImpersonate)) { + return UtilProperties.getMessage(resource, "loginevents.impersonate_notAdmin", locale); + } + + if (userLoginIdToImpersonate.equals(userLoginId)) { + return UtilProperties.getMessage(resource, "loginevents.impersonate_yourself", locale); + } + + //Cannot impersonate more privileged user + List missingNeededPermissions = SecurityUtil.hasUserLoginMorePermissionThan(delegator, userLoginId, userLoginIdToImpersonate); + if (UtilValidate.isNotEmpty(missingNeededPermissions)) { + String missingPermissionListString = missingNeededPermissions.stream().collect(Collectors.joining(", ")); + return UtilProperties.getMessage(resource, "loginevents.impersonate_notEnoughPermission", + UtilMisc.toMap("missingPermissions", missingPermissionListString), locale); + } + + return null; + } + public static void createUserLoginPasswordHistory(Delegator delegator,String userLoginId, String currentPassword) throws GenericEntityException{ int passwordChangeHistoryLimit = 0; try { diff --git a/framework/common/webcommon/WEB-INF/common-controller.xml b/framework/common/webcommon/WEB-INF/common-controller.xml index ed52c93241..b083c37b28 100644 --- a/framework/common/webcommon/WEB-INF/common-controller.xml +++ b/framework/common/webcommon/WEB-INF/common-controller.xml @@ -44,6 +44,7 @@ under the License. + @@ -53,6 +54,18 @@ under the License. + + + + + + + + + + + + @@ -315,6 +328,7 @@ under the License. + diff --git a/framework/common/widget/CommonScreens.xml b/framework/common/widget/CommonScreens.xml index b6e08707b1..1e6d31fd7b 100644 --- a/framework/common/widget/CommonScreens.xml +++ b/framework/common/widget/CommonScreens.xml @@ -229,6 +229,18 @@ under the License. + +
+ + + + + + + +
+
+
diff --git a/framework/security/config/security.properties b/framework/security/config/security.properties index 030ac41635..8d77f5cfc8 100644 --- a/framework/security/config/security.properties +++ b/framework/security/config/security.properties @@ -75,6 +75,11 @@ store.login.history=true store.login.history.on.service.auth=false store.login.history.incorrect.password=true +# -- disable impersonation +security.disable.impersonation=false +# -- if you want that an user cannot operate during an administrator impersonate his account. If true, it can be helpful for QA and dev site +security.login.authorised.during.impersonate=false + # -- should we encrypt (SHA Hash) the password? -- password.encrypt=true diff --git a/framework/security/data/SecurityGroupDemoData.xml b/framework/security/data/SecurityGroupDemoData.xml index a2605e8997..bd903bcf73 100644 --- a/framework/security/data/SecurityGroupDemoData.xml +++ b/framework/security/data/SecurityGroupDemoData.xml @@ -25,7 +25,8 @@ under the License. - + + diff --git a/framework/security/entitydef/entitymodel.xml b/framework/security/entitydef/entitymodel.xml index 1a056e868a..e13bc2f4d3 100644 --- a/framework/security/entitydef/entitymodel.xml +++ b/framework/security/entitydef/entitymodel.xml @@ -106,11 +106,15 @@ under the License. + + + + + + + + + + + + + + + + + + + + diff --git a/framework/security/src/doc/asciidoc/_include/security-impersonation.adoc b/framework/security/src/doc/asciidoc/_include/security-impersonation.adoc new file mode 100644 index 0000000000..a04d3e5144 --- /dev/null +++ b/framework/security/src/doc/asciidoc/_include/security-impersonation.adoc @@ -0,0 +1,127 @@ +//// +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +//// + += Impersonation +== What is Impersonation in Apache OFBiz +The Apache OFBiz Project +Release 17.12 + +:imagesdir: ../../themes/common-theme/webapp/images/img/ +ifdef::backend-pdf[] +:title-logo-image: image::OFBiz-Logo.svg[Apache OFBiz Logo, pdfwidth=4.25in, align=center] +:source-highlighter: rouge +endif::[] + +=== Introduction to User impersonation + +User Impersonation is a feature that offer a way to select a user login and impersonate it, i.e. see what the user could +see navigating through the application in his name. + +=== How do this work ? + +An authorized user _(see <> and <> section for configuration)_, can select a user +that will be impersonated. + +The impersonation start, if everything is well configured, in current application (partymgr for the demo). +Everything appears like if we were logged in with the userLoginId and the valid password (though we know nothing about it) + +The only thing showing that we currently are impersonating a user is the little bottom-right image : + +image::impersonate-ico.png[Impersonate icon, pdfwidth=0.5in, align=right] + +This icon indicates, when clicking on it, the user impersonated, and offer a way to depersonate. + +The impersonate period is stored for audit purpose, and if the impersonator forgot to depersonate, the period +is terminated _one hour_ after impersonation start. + +=== Security + +This feature can draw some concerns about security aspect. This paragraph will introduce every controls and properties +that have been implemented around the impersonation feature. + +[CAUTION] +These configuration steps are not to be neglected for a *production environment* since this feature offer a way to act + in place of another user. + +==== Properties + +The _security.properties_ file introduce two properties that control impersonation feature : + + +[source] +security.disable.impersonation = true + +This property, set by default to *true*, controls the activation of impersonation feature. If no configuration is done +any user trying to use impersonation will face an error message, indicating that the feature is disabled. + +To enable impersonation this property need to be set to *false* + + +[source] +security.login.authorised.during.impersonate = false + +This property controls the way impersonation occurred to the impersonated user : + +In default configuration, the impersonated user see nothing and can use the application without knowing that he is +currently impersonated. Several authorized user can impersonate a same login without any issue. + +[NOTE] +This configuration is intended for testing/QA environment allowing any authorized user to impersonate a login +to validate its configuration, test the application etc. + +Set to *true*, this configuration improve the control of the data generated by the impersonated user. Indeed, Only one +authorized user can impersonate a login at the same time, and during the impersonation process, the impersonated user +is unable to act within the application. + +Since the impersonation period is stored in database, the actions done by the +authorized user can be identified if there is the need to do so. +[NOTE] +This configuration is intended for production environment + + +==== Controls + +The permission:: + +First, to be able to use impersonation, a user need to possess _IMPERSONATE_ADMIN_ permissions. Demo data offer +_IMPERSONATION_ security group for this purpose. + +In demo data, _FULLADMIN_ security group also possess the permission. + + +Permission based user restriction:: + +An authorized user cannot impersonate any user. There are two main controls that will restrict the impersonation feature. + +Cannot impersonate Admin user::: + +It is impossible to impersonate a user that is granted any of the admin permission : + + "IMPERSONATE_ADMIN" + "ARTIFACT_INFO_VIEW" + "SERVICE_MAINT" + "ENTITY_MAINT" + "UTIL_CACHE_VIEW" + "UTIL_DEBUG_VIEW" + +Cannot impersonate more privileged user::: + +It is impossible to impersonate a user that has more permission than your user. Even if the missing persmission is +a minor one. + + diff --git a/framework/security/src/doc/asciidoc/security.adoc b/framework/security/src/doc/asciidoc/security.adoc new file mode 100644 index 0000000000..3341f96798 --- /dev/null +++ b/framework/security/src/doc/asciidoc/security.adoc @@ -0,0 +1,23 @@ +//// +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +//// + += Security + +include::_include/security-impersonation.adoc[leveloffset=+1] + diff --git a/framework/security/src/main/java/org/apache/ofbiz/security/SecurityUtil.java b/framework/security/src/main/java/org/apache/ofbiz/security/SecurityUtil.java new file mode 100644 index 0000000000..53403e801f --- /dev/null +++ b/framework/security/src/main/java/org/apache/ofbiz/security/SecurityUtil.java @@ -0,0 +1,122 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.apache.ofbiz.security; + + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import org.apache.ofbiz.base.util.Debug; +import org.apache.ofbiz.base.util.StringUtil; +import org.apache.ofbiz.base.util.UtilMisc; +import org.apache.ofbiz.base.util.UtilValidate; +import org.apache.ofbiz.entity.Delegator; +import org.apache.ofbiz.entity.GenericEntityException; +import org.apache.ofbiz.entity.condition.EntityCondition; +import org.apache.ofbiz.entity.condition.EntityOperator; +import org.apache.ofbiz.entity.util.EntityQuery; +import org.apache.ofbiz.entity.util.EntityUtil; + +/** + * A Security util. + */ +public final class SecurityUtil { + + public static final String module = SecurityUtil.class.getName(); + private static final List adminPermissions = UtilMisc.toList( + "IMPERSONATE_ADMIN", + "ARTIFACT_INFO_VIEW", + "SERVICE_MAINT", + "ENTITY_MAINT", + "UTIL_CACHE_VIEW", + "UTIL_DEBUG_VIEW"); + + /** + * Return true if given userLogin possess at least one of the adminPermission + * + * @param delegator + * @param userLoginId + * @return + */ + public static boolean hasUserLoginAdminPermission(Delegator delegator, String userLoginId) { + if (UtilValidate.isEmpty(userLoginId)) return false; + try { + return EntityQuery.use(delegator) + .from("UserLoginAndPermission") + .where(EntityCondition.makeCondition( + EntityCondition.makeCondition("userLoginId", userLoginId), + EntityCondition.makeCondition("permissionId", EntityOperator.IN, adminPermissions))) + .filterByDate("fromDate", "thruDate", "permissionFromDate", "permissionThruDate") + .queryCount() != 0; + } catch (GenericEntityException e) { + Debug.logError("Failed to resolve user permissions", module); + } + return false; + } + + /** + * Return the list of missing permission, if toUserLoginId has more permission thant userLoginId, emptyList either. + * + * @param delegator + * @param userLoginId + * @param toUserLoginId + * @return + */ + public static List hasUserLoginMorePermissionThan(Delegator delegator, String userLoginId, String toUserLoginId) { + ArrayList returnList = new ArrayList<>(); + if (UtilValidate.isEmpty(userLoginId) || UtilValidate.isEmpty(toUserLoginId)) return returnList; + List userLoginPermissionIds; + List toUserLoginPermissionIds; + try { + userLoginPermissionIds = EntityUtil.getFieldListFromEntityList( + EntityQuery.use(delegator) + .from("UserLoginAndPermission") + .where("userLoginId", userLoginId) + .filterByDate("fromDate", "thruDate", "permissionFromDate", "permissionThruDate") + .queryList(), "permissionId", true); + toUserLoginPermissionIds = EntityUtil.getFieldListFromEntityList( + EntityQuery.use(delegator) + .from("UserLoginAndPermission") + .where("userLoginId", toUserLoginId) + .filterByDate("fromDate", "thruDate", "permissionFromDate", "permissionThruDate") + .queryList(), "permissionId", true); + } catch (GenericEntityException e) { + Debug.logError("Failed to resolve user permissions", module); + return returnList; + } + + if (UtilValidate.isEmpty(userLoginPermissionIds)) return toUserLoginPermissionIds; + if (UtilValidate.isEmpty(toUserLoginPermissionIds)) return returnList; + + //Resolve all ADMIN permissions associated with the origin user + List adminPermissions = userLoginPermissionIds.stream() + .filter(perm -> perm.endsWith("_ADMIN")) + .map(perm -> StringUtil.replaceString(perm, "_ADMIN", "")) + .collect(Collectors.toList()); + + // if toUserLoginPermissionIds contains at least one permission that is not in admin permission or userLoginPermissionIds + // return the list of missing permission + return toUserLoginPermissionIds.stream() + .filter(perm -> + !userLoginPermissionIds.contains(perm) + && !adminPermissions.contains(perm.substring(0, perm.lastIndexOf("_")))) + .collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java index ca3515cfe7..2776c1c57d 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/LoginWorker.java @@ -26,8 +26,10 @@ import java.sql.Timestamp; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.ServiceLoader; import java.util.regex.Matcher; @@ -59,6 +61,7 @@ import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.entity.Delegator; import org.apache.ofbiz.entity.DelegatorFactory; import org.apache.ofbiz.entity.EntityCryptoException; +import org.apache.ofbiz.entity.GenericEntity; import org.apache.ofbiz.entity.GenericEntityException; import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.condition.EntityCondition; @@ -215,6 +218,52 @@ public class LoginWorker { return userLogin; } + /** + * Return the active {@link GenericValue} of a current impersonation UserLoginHistory of current userLogin session, + * only if not the impersonator himself. + * + * @param request The HTTP request object for the current JSP or Servlet request. + * @param response The HTTP response object for the current JSP or Servlet request. + * @return GenericValue + */ + public static GenericValue checkImpersonationInProcess(HttpServletRequest request, HttpServletResponse response) { + HttpSession session = request.getSession(); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); + GenericValue originUserLogin = (GenericValue) session.getAttribute("originUserLogin"); + + //if originUserLogin is present, it is the impersonator session + if (originUserLogin != null) { + return null; + } + + //Check the existence of an enabled impersonation visit + GenericValue userLoginHistory = null; + if (userLogin != null) { + try { + userLoginHistory = EntityQuery.use(userLogin.getDelegator()) + .from("UserLoginHistory") + .where(EntityCondition.makeCondition("userLoginId", userLogin.get("userLoginId")), + EntityCondition.makeCondition("originUserLoginId", EntityOperator.NOT_EQUAL, null)) + .filterByDate() + .queryFirst(); + } catch (GenericEntityException e) { + Debug.logError(e, "impossible to resolve userLogin history", module); + } + } + if (userLoginHistory != null) { + List errorMessageList = UtilGenerics.checkList(request.getAttribute("_ERROR_MESSAGE_LIST")); + if (errorMessageList == null) { + errorMessageList = new LinkedList<>(); + request.setAttribute("_ERROR_MESSAGE_LIST_", errorMessageList); + } + HashMap messageMap = new HashMap<>(); + messageMap.putAll(userLoginHistory.getAllFields()); + String errMsg = UtilProperties.getMessage(resourceWebapp, "loginevents.impersonation_in_process", messageMap, UtilHttp.getLocale(request)); + errorMessageList.add(errMsg); + } + return userLoginHistory; + } + /** This WebEvent allows for java 'services' to hook into the login path. * This method loads all instances of {@link LoginCheck}, and calls the * {@link LoginCheck#associate} method. The first implementation to return @@ -315,6 +364,16 @@ public class LoginWorker { } } + //Allow loggingOut when impersonated + boolean isLoggingOut = "logout".equals(RequestHandler.getRequestUri(request.getPathInfo())); + //Check if the user has an impersonation in process + boolean authoriseLoginDuringImpersonate = EntityUtilProperties.propertyValueEquals("security", "security.login.authorised.during.impersonate", "true"); + if (!isLoggingOut && !authoriseLoginDuringImpersonate && checkImpersonationInProcess(request, response) != null) { + //remove error message that will be displayed in impersonated status screen + request.removeAttribute("_ERROR_MESSAGE_LIST_"); + return "impersonated"; + } + return "success"; } @@ -533,6 +592,156 @@ public class LoginWorker { } } + /** + * An HTTP WebEvent handler to impersonate a given userLogin without using password. This should run before the security check. + * + * @param request The HTTP request object for the current JSP or Servlet request. + * @param response The HTTP response object for the current JSP or Servlet request. + * @return Return a boolean which specifies whether or not the calling Servlet or + * JSP should generate its own content. This allows an event to override the default content. + */ + public static String impersonateLogin(HttpServletRequest request, HttpServletResponse response) { + HttpSession session = request.getSession(); + Delegator delegator = (Delegator) request.getAttribute("delegator"); + String userLoginIdToImpersonate = request.getParameter("userLoginIdToImpersonate"); + GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); + LocalDispatcher dispatcher; + + if (UtilProperties.getPropertyAsBoolean("security","security.disable.impersonation", true)) { + String errMsg = UtilProperties.getMessage(resourceWebapp, "loginevents.impersonation_disabled", UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + + //Check if user has impersonate permission + Security security = (Security) request.getAttribute("security"); + if (!security.hasEntityPermission("IMPERSONATE", "_ADMIN", userLogin)) { + String errMsg = UtilProperties.getMessage(resourceWebapp, "loginevents.unable_to_login_this_application", UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + + List errMsgList = new LinkedList<>(); + if (UtilValidate.isNotEmpty(session.getAttribute("originUserLogin"))) { + errMsgList.add(UtilProperties.getMessage(resourceWebapp, "loginevents.origin_username_is_present", UtilHttp.getLocale(request))); + } + if (UtilValidate.isEmpty(userLoginIdToImpersonate)) { + errMsgList.add(UtilProperties.getMessage(resourceWebapp, "loginevents.username_was_empty_reenter", UtilHttp.getLocale(request))); + } + + try { + GenericValue userLoginToImpersonate = delegator.findOne("UserLogin", false, "userLoginId", userLoginIdToImpersonate); + if (!hasBasePermission(userLoginToImpersonate, request)) { + errMsgList.add(UtilProperties.getMessage(resourceWebapp, "loginevents.unable_to_login_this_application", UtilHttp.getLocale(request))); + } + } catch (GenericEntityException e) { + String errMsg ="Error impersonating the userLoginId" + userLoginIdToImpersonate; + Debug.logError(e, errMsg, module); + errMsgList.add(errMsg); + request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList); + return "error"; + } + if (!errMsgList.isEmpty()) { + request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList); + return "error"; + } + + ServletContext servletContext = session.getServletContext(); + + Debug.logInfo("Setting default delegator", module); + String delegatorName = delegator.getDelegatorBaseName(); + delegator = DelegatorFactory.getDelegator(delegatorName); + dispatcher = WebAppUtil.makeWebappDispatcher(servletContext, delegator); + + Map result; + try { + // get the visit id to pass to the userLogin for history + String visitId = VisitHandler.getVisitId(session); + result = dispatcher.runSync("userImpersonate", + UtilMisc.toMap("userLoginIdToImpersonate", userLoginIdToImpersonate, + "userLogin", userLogin,"visitId", visitId, "locale", UtilHttp.getLocale(request))); + } catch (GenericServiceException e) { + Debug.logError(e, "Error calling userImpersonate service", module); + Map messageMap = UtilMisc.toMap("errorMessage", e.getMessage()); + String errMsg = UtilProperties.getMessage(resourceWebapp, "loginevents.following_error_occurred_during_login", messageMap, UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + + if (ModelService.RESPOND_SUCCESS.equals(result.get(ModelService.RESPONSE_MESSAGE))) { + userLogin = (GenericValue) result.get("userLogin"); + GenericValue originUserLogin = (GenericValue) result.get("originUserLogin"); + + Map userLoginSession = checkMap(result.get("userLoginSession"), String.class, Object.class); + + // check on JavaScriptEnabled + String javaScriptEnabled = "N"; + if ("Y".equals(request.getParameter("JavaScriptEnabled"))) { + javaScriptEnabled = "Y"; + } + try { + dispatcher.runSync("setUserPreference", UtilMisc.toMap("userPrefTypeId", "javaScriptEnabled", + "userPrefGroupTypeId", "GLOBAL_PREFERENCES", "userPrefValue", javaScriptEnabled, "userLogin", userLogin)); + } catch (GenericServiceException e) { + Debug.logError(e, "Error setting user preference", module); + } + + //add originUserLogin in session + session.setAttribute("originUserLogin", originUserLogin); + // finally do the main login routine to set everything else up in the session, etc + return doMainLogin(request, response, userLogin, userLoginSession); + } else { + Map messageMap = UtilMisc.toMap("errorMessage", result.get(ModelService.ERROR_MESSAGE)); + String errMsg = UtilProperties.getMessage(resourceWebapp, "loginevents.following_error_occurred_during_login", messageMap, UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + } + + /** + * An HTTP WebEvent handler to reverse an impersonate login. + * + * @param request The HTTP request object for the current JSP or Servlet request. + * @param response The HTTP response object for the current JSP or Servlet request. + * @return Return a boolean which specifies whether or not the calling Servlet or + * JSP should generate its own content. This allows an event to override the default content. + */ + public static String depersonateLogin(HttpServletRequest request, HttpServletResponse response) { + HttpSession session = request.getSession(); + GenericValue originUserLogin = (GenericValue) session.getAttribute("originUserLogin"); + session.removeAttribute("originUserLogin"); + + List errMsgList = new LinkedList<>(); + if (null == originUserLogin) { + errMsgList.add(UtilProperties.getMessage(resourceWebapp, "loginevents.username_was_empty_reenter", UtilHttp.getLocale(request))); + } + if (!errMsgList.isEmpty()) { + request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList); + return "error"; + } + + //update the userLogin history, only one impersonation of this user can be active at the same time + EntityCondition conditions = EntityCondition.makeCondition( + EntityCondition.makeCondition("userLoginId", ((GenericValue) session.getAttribute("userLogin")).get("userLoginId")), + EntityCondition.makeCondition("originUserLoginId", originUserLogin.get("userLoginId")), + EntityUtil.getFilterByDateExpr()); + try { + //check impersonation process existence to avoid depersonation abuse + if (EntityQuery.use(originUserLogin.getDelegator()).from("UserLoginHistory").where(conditions).queryCount() == 0) { + String errMsg = UtilProperties.getMessage(resourceWebapp, "loginevents.impersonate_NotInProcess", UtilHttp.getLocale(request)); + request.setAttribute("_ERROR_MESSAGE_", errMsg); + return "error"; + } + originUserLogin.getDelegator().storeByCondition("UserLoginHistory", + UtilMisc.toMap("thruDate", UtilDateTime.nowTimestamp()), conditions); + } catch (GenericEntityException e) { + return "error"; + } + + // Log back the impersonating user + return doMainLogin(request, response, originUserLogin, null); + } + protected static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator, LocalDispatcher dispatcher) { HttpSession session = request.getSession(); // NOTE: we do NOT want to set this in the servletContext, only in the request and session @@ -561,6 +770,10 @@ public class LoginWorker { public static String doMainLogin(HttpServletRequest request, HttpServletResponse response, GenericValue userLogin, Map userLoginSession) { HttpSession session = request.getSession(); + boolean authoriseLoginDuringImpersonate = EntityUtilProperties.propertyValueEquals("security", "security.login.authorised.during.impersonate", "true"); + if (!authoriseLoginDuringImpersonate && checkImpersonationInProcess(request, response) != null) { + return "error"; + } if (userLogin != null && hasBasePermission(userLogin, request)) { doBasicLogin(userLogin, request); } else { @@ -1222,4 +1435,13 @@ public class LoginWorker { } return "success"; } + + /** + * Return true if userLogin has not been disabled + * @param userLogin + * @return + */ + public static boolean isUserLoginActive(GenericValue userLogin) { + return !"N".equals(userLogin.getString("enabled")) && UtilValidate.isEmpty(userLogin.getString("disabledBy")); + } } diff --git a/themes/bluelight/template/Header.ftl b/themes/bluelight/template/Header.ftl index 2f21c89c71..e54f68c140 100644 --- a/themes/bluelight/template/Header.ftl +++ b/themes/bluelight/template/Header.ftl @@ -117,6 +117,7 @@ under the License. + <#include "component://common-theme/template/ImpersonateBanner.ftl"/> diff --git a/themes/common-theme/template/ImpersonateBanner.ftl b/themes/common-theme/template/ImpersonateBanner.ftl new file mode 100644 index 0000000000..2dd3e9f2d1 --- /dev/null +++ b/themes/common-theme/template/ImpersonateBanner.ftl @@ -0,0 +1,11 @@ +<#if parameters.originUserLogin??> + ${uiLabelMap.CommonImpersonateTitle} +
+
+ × +

${uiLabelMap.CommonImpersonateTitle}

+

${uiLabelMap.CommonImpersonateUserLogin} : ${context.userLogin.userLoginId!}

+ ${uiLabelMap.CommonImpersonateStop} +
+
+ diff --git a/themes/common-theme/template/Impersonated.ftl b/themes/common-theme/template/Impersonated.ftl new file mode 100644 index 0000000000..b6117cefe3 --- /dev/null +++ b/themes/common-theme/template/Impersonated.ftl @@ -0,0 +1,33 @@ +<#-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<#assign messageMap = Static["org.apache.ofbiz.base.util.UtilMisc"].toMap("originUserLoginId", impersonator)/> +<#assign impersonationMessage= Static["org.apache.ofbiz.base.util.UtilProperties"].getMessage("SecurityextUiLabels", "loginevents.impersonation_in_process", messageMap, locale)/> +<#assign fromDate = Static["org.apache.ofbiz.base.util.UtilFormatOut"].formatDateTime(impersonationFromDate, "", locale, timeZone)/> +
+
+ ${uiLabelMap.CommonImpersonateTitle} +

${impersonationMessage!}

+

${uiLabelMap.CommonSince} ${fromDate!}

+

${uiLabelMap.CommonLogout}

+
+
+ diff --git a/themes/common-theme/webapp/common/css/impersonate.css b/themes/common-theme/webapp/common/css/impersonate.css new file mode 100644 index 0000000000..276f26c23e --- /dev/null +++ b/themes/common-theme/webapp/common/css/impersonate.css @@ -0,0 +1,180 @@ +#impersonateBtn { + position: fixed; + bottom: 37px; + right: 20px; + z-index: 10000; + width: 79px; + height: 60px; + cursor: pointer; +} + +#impersonateBtn img { + width: 100%; + max-width: 79px; + height: auto; + opacity: 0.6; + transition: opacity .6s; +} + +#impersonateBtn:hover img { + opacity: 1; +} + +#impersonateContent:before { + content: ""; + display: none; + background: rgba(225, 225, 225, 0.8); + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 10; +} + +#impersonateContent:target:before { + display: block; +} + +#impersonateContent:target .impersonateModal { + opacity: 1; + bottom: 117px; + right: 20px; + -webkit-transform: translate(0, 0); + -ms-transform: translate(0, 0); + transform: translate(0, 0); +} + +.impersonateModal { + opacity: 0; + position: fixed; + background: #FFF; + text-align: center; + padding: 30px 30px 15px 30px; + border-radius: 5px; + z-index: 11; + box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.15); + -webkit-transform: translate(0, -500%); + -ms-transform: translate(0, -500%); + transform: translate(0, -500%); + -webkit-transition: -webkit-transform 0.3s ease-out; + -moz-transition: -moz-transform 0.3s ease-out; + -o-transition: -o-transform 0.3s ease-out; + transition: transform 0.3s ease-out; +} + +.impersonateModal:before { + content: ""; + position: absolute; + bottom: -20px; + right: 37px; + border: 1em solid #FFF; + border-color: transparent transparent #FFF #FFF; + transform-origin: 0 0; + transform: rotate(-45deg); + box-shadow: -3px 3px 5px 0 rgba(0, 0, 0, 0.05); +} + +#impersonateContent .btn-close { + color: #aaa; + font-size: 25px; + text-decoration: none; + position: absolute; + right: 10px; + top: 10px; +} + +#impersonateContent .btn-close:hover { + color: #919191; +} + +#impersonateContent h3 { + font-size: 26px; + font-weight: normal; + letter-spacing: 0.5px; + line-height: 24px; + color: #f08906; + border-bottom: 1px solid #F2F2F2; + padding-bottom: 10px; + margin: 15px 0 20px 0; +} + +#impersonateContent p { + font-size: 18px; + color: #666; + letter-spacing: 0.3px; +} + +#impersonateContent p strong { + color: #005982; + font-weight: bold; +} + +#impersonateContent .btn { + border-radius: 2px; + border: 1px solid #005982; + padding: 7px 12px; + text-transform: uppercase; + letter-spacing: 1px; + color: #005982; + margin: 30px 0 10px 0; + line-height: 22px; + display: inline-block; + -webkit-transition: 0.2s ease-out; + -moz-transition: 0.2s ease-out; + -o-transition: 0.2s ease-out; + transition: 0.2s ease-out; +} + +#impersonateContent .btn:hover { + color: #f08906; + border-color: #f08906; +} + +#impersonateMode { + position: fixed; + top: 0; + left: 0; + height: 100%; + min-height: 100vh; + width: 100%; + display: flex; + justify-content: center; + align-items: center; + background: rgba(225, 225, 225, 0.8); + z-index: 11; + cursor: not-allowed; +} + +#impersonateMode .content { + background: #FFF; + padding: 30px; + box-shadow: -3px 3px 5px 0 rgba(0, 0, 0, 0.05); + text-align: center; +} + +#impersonateMode .content p.user { + margin-bottom: 15px; + color: #005982; + font-weight: bold; +} + +#impersonateMode .content p { + font-size: 18px; + color: #666; + letter-spacing: 0.3px; +} + +#impersonateMode .content img { + margin-bottom: 20px; +} + +#impersonateMode .content .user-pref-btn { + width: auto; + border-radius: 3px; + display: inline-block; + padding: 5px 15px; + font-size: 15px; + text-transform: uppercase; + font-weight: 600; +} diff --git a/themes/common-theme/webapp/images/img/impersonate-ico.png b/themes/common-theme/webapp/images/img/impersonate-ico.png new file mode 100644 index 0000000000000000000000000000000000000000..d12c252dfc8f51130d203adc7dc11a37b443a299 GIT binary patch literal 3823 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 literal 0 HcmV?d00001 diff --git a/themes/common-theme/widget/CommonScreens.xml b/themes/common-theme/widget/CommonScreens.xml index f0cf58efa1..8e674ec07a 100644 --- a/themes/common-theme/widget/CommonScreens.xml +++ b/themes/common-theme/widget/CommonScreens.xml @@ -155,6 +155,7 @@ under the License. + @@ -546,6 +547,42 @@ under the License. + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + +
+
+
+
+
+
@@ -608,7 +645,7 @@ under the License. - + diff --git a/themes/common-theme/widget/Theme.xml b/themes/common-theme/widget/Theme.xml index 7de3df01b1..1ac0e2f2cc 100644 --- a/themes/common-theme/widget/Theme.xml +++ b/themes/common-theme/widget/Theme.xml @@ -148,6 +148,7 @@ under the License. + diff --git a/themes/flatgrey/template/Header.ftl b/themes/flatgrey/template/Header.ftl index f0a7eb6c1f..d86d5f41fd 100644 --- a/themes/flatgrey/template/Header.ftl +++ b/themes/flatgrey/template/Header.ftl @@ -97,6 +97,7 @@ under the License. <#assign organizationLogoLinkURL = "${layoutSettings.organizationLogoLinkUrl!}"> + <#include "component://common-theme/template/ImpersonateBanner.ftl"/> diff --git a/themes/rainbowstone/template/includes/TopAppBar.ftl b/themes/rainbowstone/template/includes/TopAppBar.ftl index f5e7ca9e7e..6faf99b27f 100644 --- a/themes/rainbowstone/template/includes/TopAppBar.ftl +++ b/themes/rainbowstone/template/includes/TopAppBar.ftl @@ -30,6 +30,7 @@ under the License. +<#include "component://common-theme/template/ImpersonateBanner.ftl"/> diff --git a/themes/tomahawk/template/Header.ftl b/themes/tomahawk/template/Header.ftl index e027c421ad..33766149ec 100644 --- a/themes/tomahawk/template/Header.ftl +++ b/themes/tomahawk/template/Header.ftl @@ -102,6 +102,7 @@ under the License. <#assign organizationLogoLinkURL = "${layoutSettings.organizationLogoLinkUrl!}"> + <#include "component://common-theme/template/ImpersonateBanner.ftl"/>