Skip to content

Commit

Permalink
Fixes #327
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Nov 26, 2024
1 parent e43465f commit 44d219c
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 12 deletions.
2 changes: 1 addition & 1 deletion client/src/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const en = {
}
},
applications: {
title: "Access Roles for this application",
title: "Access Roles for this application ({{nbr}})",
applicationFound: "Applications ({{nbr}})",
new: "New Access Role",
searchPlaceHolder: "Search for applications",
Expand Down
2 changes: 1 addition & 1 deletion client/src/locale/nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ const nl = {
andMore: "En nog {{nbr}} meer.. Bekijk de lijst van huidige gebruikers voor meer details." }
},
applications: {
title: "Toegangsrollen voor deze applicatie",
title: "Toegangsrollen voor deze applicatie ({{nbr}})",
applicationFound: "Applicaties ({{nbr}})",
new: "Nieuwe toegangsrol",
searchPlaceHolder: "Zoek naar applicaties",
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export const Application = () => {
<Entities
entities={roles}
modelName="applicationRoles"
title={I18n.t("applications.title")}
title={I18n.t("applications.title", {nbr: roles.length})}
showNew={true}
newLabel={I18n.t("applications.new")}
newEntityFunc={() => navigate("/role/new", {state: application.id})}
Expand Down
35 changes: 30 additions & 5 deletions client/src/pages/Role.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import ClipBoardCopy from "../components/ClipBoardCopy";
import {deriveApplicationAttributes} from "../utils/Manage";
import DOMPurify from "dompurify";
import {UnitHeaderInviter} from "../components/UnitHeaderInviter";
import {isEmpty} from "../utils/Utils";

export const Role = () => {
const {id, tab = "users"} = useParams();
Expand Down Expand Up @@ -96,6 +97,34 @@ export const Role = () => {

}, [id]);// eslint-disable-line react-hooks/exhaustive-deps

const separator = (role, index) => {
const l = role.applicationMaps.length;
if (index === (l - 1)) {
return "";
}
if (index === (l - 2)) {
return ` ${I18n.t("forms.and")} `
}
return ", ";
}

const landingPages = role => {
return role.applicationMaps
.filter(m => !isEmpty(m) && !m.unknown)
.map((m, index) => {
const name = m[`name:${I18n.locale}`] || m["name:en"];
const orgName = m[`OrganizationName:${I18n.locale}`] || m["OrganizationName:en"];
const landingPage = role.applicationUsages.find(au => au.application.manageId === m.id).landingPage;
return (
<span>
<a href={landingPage} target="_blank" rel="noreferrer">{`${name}`}</a>
{`${orgName ? " (" + orgName + ")" : ""}`}
{separator(role, index)}
</span>
);
})
}

const getActions = () => {
const actions = [];
if (allowedToEditRole(user, role)) {
Expand Down Expand Up @@ -158,11 +187,7 @@ export const Role = () => {
{!role.unknownInManage &&
<div className={"meta-data-row"}>
<WebsiteIcon/>
<a href={role.applicationUsages[0].landingPage}
rel="noreferrer"
target="_blank">
<span className={"application-name"}>{`${role.applicationNames}`}</span>
</a>{role.applicationOrganizationName && <span>{` (${role.applicationOrganizationName})`}</span>}
<div>{landingPages(role)}</div>
</div>}
{role.unknownInManage &&
<div className="meta-data-row unknown-in-manage">
Expand Down
2 changes: 1 addition & 1 deletion client/src/tabs/Users.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export const Users = () => {

if (hasEntities) {
title = I18n.t(`users.found`, {
count: totalElements,
count: totalElements.toLocaleString(),
plural: I18n.t(`users.${totalElements === 1 ? "singleUser" : "multipleUsers"}`)
})
}
Expand Down
4 changes: 3 additions & 1 deletion client/src/utils/Manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ export const mergeProvidersProvisioningsRoles = (providers, provisionings, roles
id: role.id,
name: role.name,
landingPage: role.applicationUsages.find(appUsage => appUsage.application.manageId === provider.id).landingPage
})),
}))
.sort((r1, r2) => r1.name.localeCompare(r2.name))
,
provisionings: provisionings
.filter(prov => prov.applications.some(app => app.id === provider.id))
.map(prov => ({
Expand Down
4 changes: 2 additions & 2 deletions server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ email:
# configure real users / passwords and test against those. See server/src/main/java/access/manage/ManageConf.java
# and server/src/main/java/access/manage/LocalManage.java to see how it works.
manage:
# enabled: True
enabled: False
enabled: True

Check warning on line 195 in server/src/main/resources/application.yml

View workflow job for this annotation

GitHub Actions / Test documentation and generate openapi html documentation

195:12 [truthy] truthy value should be one of [false, true]
# enabled: False

Check warning on line 196 in server/src/main/resources/application.yml

View workflow job for this annotation

GitHub Actions / Test documentation and generate openapi html documentation

196:1 [comments-indentation] comment not indented like content
url: "https://manage.test2.surfconext.nl"
user: invite
password: secret
Expand Down

0 comments on commit 44d219c

Please sign in to comment.