Next batch of backend permissions for orgs.
This commit is contained in:
parent
100ec563fa
commit
dd77ebd64f
11 changed files with 13596 additions and 62 deletions
|
@ -13,8 +13,9 @@ from auth.auth import (process_auth, get_authenticated_user,
|
|||
get_validated_token)
|
||||
from util.names import parse_namespace_repository, parse_repository_name
|
||||
from util.email import send_confirmation_email
|
||||
from auth.permissions import (ModifyRepositoryPermission,
|
||||
ReadRepositoryPermission, UserPermission)
|
||||
from auth.permissions import (ModifyRepositoryPermission, UserPermission,
|
||||
ReadRepositoryPermission,
|
||||
CreateRepositoryPermission)
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -127,7 +128,9 @@ def create_repository(namespace, repository):
|
|||
abort(403)
|
||||
|
||||
else:
|
||||
if get_authenticated_user().username != namespace:
|
||||
permission = CreateRepoPermission('namespace')
|
||||
if not permission.can():
|
||||
logger.info('Attempt to create a new repo with insufficient perms.')
|
||||
abort(403)
|
||||
|
||||
logger.debug('Creaing repository with owner: %s' %
|
||||
|
|
Reference in a new issue