Merge pull request #3653 from AlanCoding/instance_token_management2

Fix 403 bug using write PAT and view.always_allow_superuser=True

Reviewed-by: Alan Rominger <arominge@redhat.com>
             https://github.com/AlanCoding
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-04-09 20:37:05 +00:00 committed by GitHub
commit 7f935084df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,8 +103,7 @@ class ModelAccessPermission(permissions.BasePermission):
return False
# Always allow superusers
if getattr(view, 'always_allow_superuser', True) and request.user.is_superuser \
and not hasattr(request.user, 'oauth_scopes'):
if getattr(view, 'always_allow_superuser', True) and request.user.is_superuser:
return True
# Check if view supports the request method before checking permission