Skip to content

Commit

Permalink
Ajoute colonne organismes dans la recherche utilisateurs (#1872)
Browse files Browse the repository at this point in the history
  • Loading branch information
niladic authored Dec 1, 2023
1 parent 9582725 commit f1719f7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/serializers/ApiModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ object ApiModel {
if (firstName.nonEmpty || lastName.nonEmpty) User.standardName(firstName, lastName)
else user.name
}
val groups = user.groupIds.flatMap(idToGroup.get)
val organisations: List[String] =
groups.flatMap(_.organisation.map(_.shortName)).toSet.toList.sorted
UserInfos(
id = user.id,
firstName = user.firstName,
Expand All @@ -181,13 +184,13 @@ object ApiModel {
helper = user.helperRoleName.nonEmpty,
instructor = user.instructorRoleName.nonEmpty,
areas = user.areas.flatMap(Area.fromId).map(_.toString).sorted,
groupNames = user.groupIds.flatMap(idToGroup.get).map(_.name),
groups = user.groupIds
.flatMap(idToGroup.get)
groupNames = groups.map(_.name),
groups = groups
.map(group =>
UserInfos.Group(group.id, group.name, Authorization.canEditGroup(group)(rights))
),
groupEmails = user.groupIds.flatMap(idToGroup.get).flatMap(_.email),
groupEmails = groups.flatMap(_.email),
organisations = organisations,
groupAdmin = user.groupAdminRoleName.nonEmpty,
admin = user.adminRoleName.nonEmpty,
expert = user.expert,
Expand All @@ -214,6 +217,7 @@ object ApiModel {
groupNames: List[String],
groups: List[UserInfos.Group],
groupEmails: List[String],
organisations: List[String],
groupAdmin: Boolean,
admin: Boolean,
expert: Boolean,
Expand Down
8 changes: 8 additions & 0 deletions typescript/src/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ if (window.document.getElementById(usersTableId)) {
bottomCalc: "count",
width: 80,
},
{
title: "Organismes",
field: "organisations",
sorter: "string",
headerFilter: "input",
width: 200,
accessorDownload: joinWithCommaDownload,
},
{
title: "Départements",
field: "areas",
Expand Down

0 comments on commit f1719f7

Please sign in to comment.