Skip to content

Commit

Permalink
fix: resolution: only add resolver as task.resolver_usernames if used…
Browse files Browse the repository at this point in the history
… admin privileges

Signed-off-by: Romain Beuque <[email protected]>
  • Loading branch information
rbeuque74 committed Mar 27, 2020
1 parent 8f364dd commit 44a7db9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions api/handler/resolution.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ func CreateResolution(c *gin.Context, in *createResolutionIn) (*resolution.Resol

// adding current resolver to task.resolver_usernames, to be able to list resolved tasks
// as 'resolvable', if current resolver used admins privileges.
t.ResolverUsernames = append(t.ResolverUsernames, resUser)
if err := t.Update(dbp, false, false); err != nil {
dbp.Rollback()
return nil, err
if auth.IsAdmin(c) == nil {
t.ResolverUsernames = append(t.ResolverUsernames, resUser)
if err := t.Update(dbp, false, false); err != nil {
dbp.Rollback()
return nil, err
}
}

r, err := resolution.Create(dbp, t, in.ResolverInputs, resUser, false, nil) // TODO accept delay in handler
Expand Down

0 comments on commit 44a7db9

Please sign in to comment.