web/flows: simplify consent's permission handling

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-08-18 16:31:48 +02:00
parent fb5eb7b868
commit ab25216c1f

View file

@ -37,13 +37,15 @@ export class ConsentStage extends BaseStage<ConsentChallenge, ConsentChallengeRe
}
renderPermissions(perms: Permission[]): TemplateResult {
const shouldShowId = perms.filter((perm) => perm.name === "").length === perms.length;
return html`${perms.map((permission) => {
let name = permission.name;
if (permission.name === "" && shouldShowId) {
name = permission.id;
if (permission.name === "") {
return html``;
}
return html`<li data-permission-code="${permission.id}">${name}</li>`;
// Special case for openid Scope
if (permission.id === "openid") {
return html``;
}
return html`<li data-permission-code="${permission.id}">${permission.name}</li>`;
})}`;
}