fix(influxdb): special case the orgs resource when generating permissions

pull/11157/head
Michael Desa 2019-01-16 15:26:40 -05:00
parent 00711c5c01
commit ffdba45242
1 changed files with 8 additions and 0 deletions

View File

@ -296,6 +296,10 @@ func OwnerPermissions(orgID ID) []Permission {
ps := []Permission{}
for _, r := range AllResourceTypes {
for _, a := range actions {
if r == OrgsResourceType {
ps = append(ps, Permission{Action: a, Resource: Resource{Type: r, ID: &orgID}})
continue
}
ps = append(ps, Permission{Action: a, Resource: Resource{Type: r, OrgID: &orgID}})
}
}
@ -307,6 +311,10 @@ func OwnerPermissions(orgID ID) []Permission {
func MemberPermissions(orgID ID) []Permission {
ps := []Permission{}
for _, r := range AllResourceTypes {
if r == OrgsResourceType {
ps = append(ps, Permission{Action: ReadAction, Resource: Resource{Type: r, ID: &orgID}})
continue
}
ps = append(ps, Permission{Action: ReadAction, Resource: Resource{Type: r, OrgID: &orgID}})
}