Skip to content

Commit

Permalink
feat: check for multiple punchout roles (cXML or OCI) for punchout UI…
Browse files Browse the repository at this point in the history
… adaptions

- check for new 'APP_B2B_CXML_USER' or 'APP_B2B_OCI_USER' role
- check for new permission 'APP_B2B_SEND_PUNCHOUT_BASKET'

BREAKING CHANGES: required Intershop Commerce Management version: 7.10.29.0
  • Loading branch information
shauke committed Apr 1, 2021
1 parent a5226f7 commit f5a1a2c
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
Expand Up @@ -15,7 +15,7 @@ export class PunchoutProductContextDisplayPropertiesService implements ExternalD

setup(product$: Observable<ProductView>): Observable<Partial<ProductContextDisplayProperties<false>>> {
return product$.pipe(
switchMapTo(this.roleToggleService.hasRole('APP_B2B_OCI_USER')),
switchMapTo(this.roleToggleService.hasRole(['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER'])),
map(isPunchoutUser =>
isPunchoutUser
? {
Expand Down
@@ -1,6 +1,6 @@
<ng-container *ngIf="isLoggedIn$ | async; else elseTemplate">
<a
*ishHasNotRole="'APP_B2B_OCI_USER'"
*ishHasNotRole="['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER']"
class="btn btn-secondary"
id="createQuote"
name="createQuote"
Expand Down
Expand Up @@ -7,7 +7,9 @@
data-testing-id="personal-message-b2b"
></h1>

<p *ishHasNotRole="'APP_B2B_OCI_USER'">{{ 'account.overview.message_b2b.text' | translate }}</p>
<p *ishHasNotRole="['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER']">
{{ 'account.overview.message_b2b.text' | translate }}
</p>
</ng-container>

<ng-template #personalCustomerMessage>
Expand Down Expand Up @@ -47,7 +49,7 @@
</ng-template>

<!-- Budget, Requisition, Approval & Quoting Widgets -->
<ng-container *ishHasNotRole="'APP_B2B_OCI_USER'">
<ng-container *ishHasNotRole="['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER']">
<div class="row">
<ng-container *ngIf="'services.OrderApprovalServiceDefinition.runnable' | ishServerSetting">
<ish-lazy-budget-widget class="col-12 col-md-8"></ish-lazy-budget-widget>
Expand Down
Expand Up @@ -10,7 +10,7 @@ interface NavigationItems {
feature?: string;
serverSetting?: string;
permission?: string;
notRole?: string;
notRole?: string | string[];
children?: NavigationItems;
};
}
Expand All @@ -34,7 +34,7 @@ export class AccountNavigationComponent implements OnInit, OnChanges {
localizationKey: 'account.requisitions.requisitions',
serverSetting: 'services.OrderApprovalServiceDefinition.runnable',
permission: 'APP_B2B_PURCHASE',
notRole: 'APP_B2B_OCI_USER',
notRole: ['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER'],
},
'/account/requisitions/approver': {
localizationKey: 'account.requisitions.approvals',
Expand All @@ -44,31 +44,34 @@ export class AccountNavigationComponent implements OnInit, OnChanges {
'/account/quotes': {
localizationKey: 'account.navigation.quotes.link',
feature: 'quoting',
notRole: 'APP_B2B_OCI_USER',
notRole: ['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER'],
},
'/account/order-templates': {
localizationKey: 'account.ordertemplates.link',
feature: 'orderTemplates',
dataTestingId: 'order-templates-link',
},
'/account/orders': { localizationKey: 'account.order_history.link', notRole: 'APP_B2B_OCI_USER' },
'/account/orders': {
localizationKey: 'account.order_history.link',
notRole: ['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER'],
},
'/account/wishlists': {
localizationKey: 'account.wishlists.link',
feature: 'wishlists',
dataTestingId: 'wishlists-link',
notRole: 'APP_B2B_OCI_USER',
notRole: ['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER'],
},
'/account/addresses': {
localizationKey: 'account.saved_addresses.link',
dataTestingId: 'addresses-link',
notRole: 'APP_B2B_OCI_USER',
notRole: ['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER'],
},
'/account/payment': {
localizationKey: 'account.payment.link',
dataTestingId: 'payments-link',
notRole: 'APP_B2B_OCI_USER',
notRole: ['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER'],
},
'/account/profile': { localizationKey: 'account.profile.link', notRole: 'APP_B2B_OCI_USER' },
'/account/profile': { localizationKey: 'account.profile.link', notRole: ['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER'] },
'/account/organization': {
localizationKey: 'account.organization.user_management',
permission: 'APP_B2B_MANAGE_USERS',
Expand All @@ -79,7 +82,10 @@ export class AccountNavigationComponent implements OnInit, OnChanges {
feature: 'punchout',
permission: 'APP_B2B_MANAGE_PUNCHOUT',
},
'/logout': { localizationKey: 'account.navigation.logout.link', notRole: 'APP_B2B_OCI_USER' },
'/logout': {
localizationKey: 'account.navigation.logout.link',
notRole: ['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER'],
},
};

constructor(private router: Router) {}
Expand Down
Expand Up @@ -55,15 +55,15 @@ <h2>{{ 'checkout.order_details.heading' | translate }}</h2>

<!-- ToDo: ISREST-275: disable button if basket max value is exceeded -->
<button
*ishHasNotRole="'APP_B2B_OCI_USER'"
*ishHasNotRole="['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER']"
type="submit"
class="btn btn-lg btn-block btn-primary"
(click)="checkout()"
>
{{ 'shopping_cart.proceed_to_checkout.button.label' | translate }}
</button>
<ish-lazy-punchout-transfer-basket
*ishIsAuthorizedTo="'APP_B2B_SEND_OCI_BASKET'"
*ishIsAuthorizedTo="'APP_B2B_SEND_PUNCHOUT_BASKET'"
></ish-lazy-punchout-transfer-basket>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/shell/footer/footer/footer.component.html
@@ -1,3 +1,3 @@
<ng-container *ishHasNotRole="'APP_B2B_OCI_USER'">
<ng-container *ishHasNotRole="['APP_B2B_CXML_USER', 'APP_B2B_OCI_USER']">
<div [ishServerHtml]="'footer.content' | translate: { appVersion: appVersion }" class="clearfix"></div>
</ng-container>

0 comments on commit f5a1a2c

Please sign in to comment.