Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: display user role description #393

Merged
merged 1 commit into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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[];
}