AccessControl: Remove scopes from orgs endpoints (#41709)
* AccessControl: Check permissions in target org * Remove org scopes and add an authorizeInOrg middleware * Use query result org id and perform users permission check globally for GetOrgByName * Remove scope translation for orgs current * Suggestion from Ieva
This commit is contained in:
@@ -42,16 +42,11 @@ type ScopeResolver struct {
|
||||
func NewScopeResolver() ScopeResolver {
|
||||
return ScopeResolver{
|
||||
keywordResolvers: map[string]KeywordScopeResolveFunc{
|
||||
"orgs:current": resolveCurrentOrg,
|
||||
"users:self": resolveUserSelf,
|
||||
"users:self": resolveUserSelf,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func resolveCurrentOrg(u *models.SignedInUser) (string, error) {
|
||||
return Scope("orgs", "id", fmt.Sprintf("%v", u.OrgId)), nil
|
||||
}
|
||||
|
||||
func resolveUserSelf(u *models.SignedInUser) (string, error) {
|
||||
return Scope("users", "id", fmt.Sprintf("%v", u.UserId)), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user