fix: users and orgs permissions should not be scoped under an org (#398)

This commit is contained in:
Jeffrey Smith II 2022-06-13 09:20:26 -04:00 committed by GitHub
parent fc529745a5
commit 0c17ebd621
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View File

@ -444,6 +444,9 @@ func (c Client) printAuth(opts printParams) error {
}
func makePermResource(permType string, id string, orgId string) api.PermissionResource {
if permType == "orgs" || permType == "users" {
orgId = ""
}
pr := api.PermissionResource{Type: permType}
if id != "" {
pr.Id = &id

View File

@ -41,6 +41,20 @@ func Test_makePermResource(t *testing.T) {
inOrgId: "45678",
expected: api.PermissionResource{Type: "qux", Id: api.PtrString("12345"), OrgID: api.PtrString("45678")},
},
{
name: "users",
inType: "users",
inId: "12345",
inOrgId: "45678",
expected: api.PermissionResource{Type: "users", Id: api.PtrString("12345"), OrgID: nil},
},
{
name: "orgs",
inType: "orgs",
inId: "12345",
inOrgId: "45678",
expected: api.PermissionResource{Type: "orgs", Id: api.PtrString("12345"), OrgID: nil},
},
}
for _, tc := range testCases {