fix: users and orgs permissions should not be scoped under an org (#398)
This commit is contained in:
@ -444,6 +444,9 @@ func (c Client) printAuth(opts printParams) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func makePermResource(permType string, id string, orgId string) api.PermissionResource {
|
func makePermResource(permType string, id string, orgId string) api.PermissionResource {
|
||||||
|
if permType == "orgs" || permType == "users" {
|
||||||
|
orgId = ""
|
||||||
|
}
|
||||||
pr := api.PermissionResource{Type: permType}
|
pr := api.PermissionResource{Type: permType}
|
||||||
if id != "" {
|
if id != "" {
|
||||||
pr.Id = &id
|
pr.Id = &id
|
||||||
|
@ -41,6 +41,20 @@ func Test_makePermResource(t *testing.T) {
|
|||||||
inOrgId: "45678",
|
inOrgId: "45678",
|
||||||
expected: api.PermissionResource{Type: "qux", Id: api.PtrString("12345"), OrgID: api.PtrString("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 {
|
for _, tc := range testCases {
|
||||||
|
Reference in New Issue
Block a user