Skip to content

Commit

Permalink
Merge pull request #2035 from scireum/feature/mbo/SIRI-1020
Browse files Browse the repository at this point in the history
User Accounts - Extends user account cards and open search results by the option to jump to a tenant if the user has the support role
  • Loading branch information
scireum-mbo authored Sep 30, 2024
2 parents 941c6ce + 2bf049d commit 8397863
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/main/java/sirius/biz/tenants/UserAccountSearchProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,17 @@ public void query(String query, int maxResults, Consumer<OpenSearchResult> resul
if (currentUser.hasPermission(TenantUserManager.PERMISSION_SELECT_USER_ACCOUNT)) {
openSearchResult.withTemplateFromCode("""
<i:arg name="user" type="sirius.biz.tenants.UserAccount"/>
@user (@user.getTenant().fetchValue().toString())
@user (
<i:if test="UserContext.get().getUser().hasPermission(sirius.biz.tenants.TenantUserManager.PERMISSION_SELECT_TENANT)">
<t:smartValue type="tenant"
id="@generateId('smarty-useraccount-%s')"
payload="@user.getTenantAsString()"
label="@user.getTenant().fetchValue().toString()"/>
<i:else>
@user.getTenant().fetchValue().toString()
</i:else>
</i:if>
)
<br>
<a href="/user-accounts/select/@user.getIdAsString()" class="card-link">@i18n("TenantController.select")</a>
""", userAccount);
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/biz_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ TenantController.cannotBecomeTenant = Sie können den gewählten Mandanten nicht
TenantController.cannotDeleteSelf = Sie können nicht Ihren eigenen Mandanten löschen.
TenantController.delete = Löschen…
TenantController.edit = Bearbeiten
TenantController.jumpTo = Zum Mandanten
TenantController.select = Übernehmen
TenantData.accountNumber = Kundennummer
TenantData.canAccessParent = Verwaltung des übergeordneten Mandanten
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/default/taglib/t/smartValue.html.pasta
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
type="String"
default=""
description="Contains the textual representation of the payload to show as link"/>
<i:arg name="id"
type="String"
default="@generateId('smarty-%s')"
description="Contains the id of the smartValue"/>

<i:pragma name="description">
Permits to show a link in the UI when (on click) will load additional data and show this as tooltip. This can
Expand All @@ -17,7 +21,7 @@

<i:if test="isFilled(payload)">
<i:local name="signature" value="@computeAuthSignature(apply('%s/%s', type, payload))"/>
<i:local name="id" value="@generateId('smarty-%s')"/>
<i:local name="id" value="@id"/>
<a id="@id"
class="text-black link smart-values-link-js"
href="javascript:openSmartValues('@id', '@type','@payload', '@signature')">@label</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
url="@apply('/user-accounts/select/%s', account.getIdAsString())"/>
</t:dropdownSection>
</i:if>
<i:if test="UserContext.get().getUser().hasPermission(sirius.biz.tenants.TenantUserManager.PERMISSION_SELECT_TENANT)">
<t:dropdownSection>
<t:dropdownItem labelKey="TenantController.jumpTo"
icon="fa-solid fa-building"
url="@apply('/tenant/%s', account.getTenantAsString())"/>
</t:dropdownSection>
</i:if>
<t:dropdownSection>
<t:dropdownItem
labelKey="Model.password.set"
Expand Down Expand Up @@ -104,6 +111,13 @@
url="@apply('/user-accounts/select/%s', account.getIdAsString())"/>
</t:dropdownSection>
</i:if>
<i:if test="UserContext.get().getUser().hasPermission(sirius.biz.tenants.TenantUserManager.PERMISSION_SELECT_TENANT)">
<t:dropdownSection>
<t:dropdownItem labelKey="TenantController.jumpTo"
icon="fa-solid fa-building"
url="@apply('/tenant/%s', account.getTenantAsString())"/>
</t:dropdownSection>
</i:if>
<i:if test="account.getUserAccountData().isOwnTenant()">
<t:dropdownSection>
<t:dropdownItem labelKey="TenantController.edit"
Expand Down

0 comments on commit 8397863

Please sign in to comment.