admin: List all existing association between users and teams

This commit is contained in:
nemunaire 2025-03-26 15:34:06 +01:00
parent e44cac32ac
commit 3881385c9e
3 changed files with 37 additions and 3 deletions

View file

@ -295,6 +295,11 @@ func bindingTeams(c *gin.Context) {
c.String(http.StatusOK, ret)
}
type teamAssociation struct {
Association string `json:"association"`
TeamId int64 `json:"team_id"`
}
func allAssociations(c *gin.Context) {
teams, err := fic.GetTeams()
if err != nil {
@ -303,7 +308,7 @@ func allAssociations(c *gin.Context) {
return
}
var ret []string
var ret []teamAssociation
for _, team := range teams {
assocs, err := pki.GetTeamAssociations(TeamsDir, team.Id)
@ -313,7 +318,7 @@ func allAssociations(c *gin.Context) {
}
for _, a := range assocs {
ret = append(ret, a)
ret = append(ret, teamAssociation{a, team.Id})
}
}

View file

@ -55,3 +55,32 @@
</ng-repeat>
</dl>
</div>
<hr>
<div class="mb-4" ng-controller="AllTeamAssociationsController">
<div class="d-flex justify-content-between align-items-center">
<h3>
Association utilisateurs et équipes
</h3>
<div>
</div>
</div>
<table class="table table-sm table-hover" ng-controller="TeamsListController" >
<tr>
<th class="text-right">Utilisateur</th>
<th></th>
<th>Équipe</th>
</tr>
<tr ng-repeat="association in allAssociations">
<td class="text-right">{{ association.association }}</td>
<td class="text-center">&#11020;</td>
<td ng-repeat="team in teams" ng-if="team.id == association.team_id">
<a ng-href="teams/{{ team.id }}">
{{ team.name }}
</a>
</td>
</tr>
</table>
</div>

View file

@ -323,7 +323,7 @@
<form class="row" ng-controller="AllTeamAssociationsController" ng-submit="addDelegatedQA()">
<div class="col">
<select class="form-control form-control-sm" ng-model="newdqa">
<option ng-selected="newdqa == m" ng-repeat="(i,m) in allAssociations" ng-value="m">{{ m }}</option>
<option ng-selected="newdqa == m.association" ng-repeat="(i,m) in allAssociations" ng-value="m.association">{{ m.association }}</option>
</select>
</div>
<div class="col input-group">