Skip to content

Commit

Permalink
feat: display user role description
Browse files Browse the repository at this point in the history
  • Loading branch information
SGrueber committed Sep 30, 2020
1 parent c82b493 commit 9d2891a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
<div class="form-check form-control">
<label [for]="item.key">
<input type="checkbox" id="item.key" value="item.value.value" [formControl]="item.value" />
<span>{{ role.displayName }}</span>
<span>{{ role.displayName }}</span
><br />
<span *ngIf="role.description" class="input-help">{{ role.description }}</span>
</label>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export interface B2bRoleData {
roleID: string;
fixed: boolean;
roleDisplayName: string;
roleDescription?: string;
permissions: { permissionDisplayName: string }[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,51 +24,43 @@ describe('B2b Role Mapper', () => {
const data = [
{
roleID: 'APP_B2B_BUYER',
roleDisplayName: 'Einkäufer',
roleDisplayName: 'Buyer',
roleDescription: 'The buyer manages own requisitions, order templates, quotes, orders and subscriptions.',
fixed: true,
permissions: [
{ permissionDisplayName: 'Kostenobjekt zu Warenkorb zuordnen' },
{ permissionDisplayName: 'Kostenobjekt zu Warenkorbposition zuordnen' },
{ permissionDisplayName: 'Preisangebote erstellen' },
{ permissionDisplayName: 'Einkäufe tätigen' },
{ permissionDisplayName: 'Kostenobjekte anzeigen' },
{ permissionDisplayName: 'Assign a cost object to a basket' },
{ permissionDisplayName: 'Assign a cost object to a basket line item' },
{ permissionDisplayName: 'Create Quotes' },
],
},
{
roleID: 'APP_B2B_APPROVER',
roleDisplayName: 'Genehmiger',
roleDisplayName: 'Approver',
fixed: false,
permissions: [
{ permissionDisplayName: 'Kostenobjekt zu Warenkorb zuordnen' },
{ permissionDisplayName: 'Kostenobjekt zu Warenkorbposition zuordnen' },
{ permissionDisplayName: 'Preisangebote erstellen' },
{ permissionDisplayName: 'Offene Bestellungen genehmigen' },
{ permissionDisplayName: 'Einkäufe tätigen' },
{ permissionDisplayName: 'Kostenobjekte anzeigen' },
],
permissions: [{ permissionDisplayName: 'Approve Pending Orders' }],
},
] as B2bRoleData[];
const mapped = b2bRoleMapper.fromData(data);
expect(mapped).toMatchInlineSnapshot(`
Array [
Object {
"displayName": "Einkäufer",
"description": "The buyer manages own requisitions, order templates, quotes, orders and subscriptions.",
"displayName": "Buyer",
"fixed": true,
"id": "APP_B2B_BUYER",
"permissionDisplayNames": Array [
"Kostenobjekt zu Warenkorb zuordnen",
"Kostenobjekt zu Warenkorbposition zuordnen",
"Preisangebote erstellen",
"Einkäufe tätigen",
"Kostenobjekte anzeigen",
"Assign a cost object to a basket",
"Assign a cost object to a basket line item",
"Create Quotes",
],
},
Object {
"displayName": "Genehmiger",
"description": undefined,
"displayName": "Approver",
"fixed": false,
"id": "APP_B2B_APPROVER",
"permissionDisplayNames": Array [
"Offene Bestellungen genehmigen",
"Approve Pending Orders",
],
},
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class B2bRoleMapper {
id: role.roleID,
fixed: role.fixed,
displayName: role.roleDisplayName,
description: role.roleDescription,
permissionDisplayNames: role.permissions.map(p => p.permissionDisplayName),
}))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export interface B2bRole {
id: string;
fixed: boolean;
displayName: string;
description?: string;
permissionDisplayNames: string[];
}

1 comment on commit 9d2891a

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Azure Demo Servers are available:

Please sign in to comment.