feat(webui): act in a selected organisation the caller is a member of, enforced at the dashboard and the State Store
This commit is contained in:
1 parent
2cf9d435cc
commit
2fb0084d2c
17 files changed
+356
-69
No files matched your search
@@ -37,6 +37,10 @@ func (s *Server) authorize(h http.Handler) http.Handler {
|
||||
http.Error(w, "principal unavailable", http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
if principal, err = s.selectedOrg(w, r, principal); err != nil {
|
||||
http.Error(w, "principal unavailable", http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
action, kind, id := accessRequest(r)
|
||||
ctx := org.WithOrg(access.WithPrincipal(r.Context(), principal), principal.Org)
|
||||
// The record's org is not loaded here: org-filtered lookups keep a
|
||||
@@ -455,6 +459,10 @@ func accountRoute(path string) (access.Action, access.ResourceKind, bool) {
|
||||
switch path {
|
||||
case "/api/accounts":
|
||||
return access.ActionManageMembers, access.KindMember, true
|
||||
case "/api/orgs/current":
|
||||
// Choosing an org is open to any member; the handler checks the
|
||||
// membership.
|
||||
return access.ActionRead, access.KindDashboard, true
|
||||
case "/api/authentication":
|
||||
return access.ActionManageIdentities, access.KindIdentity, true
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user