Merge pull request #154 from coreos-inc/optimize
Optimize the generate_headers check to skip the permissions load when we don't need it
This commit is contained in:
commit
d5e4b35a78
1 changed files with 2 additions and 2 deletions
|
@ -55,10 +55,10 @@ def generate_headers(scope=GrantType.READ_REPOSITORY, add_grant_for_status=None)
|
|||
grants = []
|
||||
|
||||
if scope == GrantType.READ_REPOSITORY:
|
||||
if ReadRepositoryPermission(namespace, repository).can() or force_grant:
|
||||
if force_grant or ReadRepositoryPermission(namespace, repository).can():
|
||||
grants.append(repository_read_grant(namespace, repository))
|
||||
elif scope == GrantType.WRITE_REPOSITORY:
|
||||
if ModifyRepositoryPermission(namespace, repository).can() or force_grant:
|
||||
if force_grant or ModifyRepositoryPermission(namespace, repository).can():
|
||||
grants.append(repository_write_grant(namespace, repository))
|
||||
|
||||
# Generate a signed token for the user (if any) and the grants (if any)
|
||||
|
|
Reference in a new issue