Merge pull request #11157 from influxdata/fix/session-permissions

fix(influxdb): special case the orgs resource when generating permissions
pull/11173/head
Michael Desa 2019-01-16 17:08:21 -05:00 committed by GitHub
commit 12c934ba6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -296,6 +296,10 @@ func OwnerPermissions(orgID ID) []Permission {
ps := []Permission{} ps := []Permission{}
for _, r := range AllResourceTypes { for _, r := range AllResourceTypes {
for _, a := range actions { 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}}) 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 { func MemberPermissions(orgID ID) []Permission {
ps := []Permission{} ps := []Permission{}
for _, r := range AllResourceTypes { 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}}) ps = append(ps, Permission{Action: ReadAction, Resource: Resource{Type: r, OrgID: &orgID}})
} }