Skip to content

Commit

Permalink
client: owner should be fetched from original client when updating
Browse files Browse the repository at this point in the history
  • Loading branch information
Aeneas Rekkas (arekkas) committed Sep 23, 2016
1 parent a922002 commit 06077e9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,17 @@ func (h *Handler) Update(w http.ResponseWriter, r *http.Request, ps httprouter.P
return
}

o, err := h.Manager.GetConcreteClient(ps.ByName("id"))
if err != nil {
h.H.WriteError(ctx, w, r, err)
return
}

if _, err := h.W.TokenAllowed(ctx, h.W.TokenFromRequest(r), &ladon.Request{
Resource: ClientsResource,
Action: "update",
Context: ladon.Context{
"owner": c.Owner,
"owner": o.Owner,
},
}, Scope); err != nil {
h.H.WriteError(ctx, w, r, err)
Expand Down

0 comments on commit 06077e9

Please sign in to comment.