This commit is contained in:
root 2013-11-11 21:27:00 +00:00
commit 45a8f52a8f

View file

@ -1,6 +1,4 @@
import json import json
import urllib
import json
import logging import logging
import urlparse import urlparse
@ -11,7 +9,7 @@ from data import model
from app import app, mixpanel from app import app, mixpanel
from auth.auth import (process_auth, get_authenticated_user, from auth.auth import (process_auth, get_authenticated_user,
get_validated_token) get_validated_token)
from util.names import parse_namespace_repository, parse_repository_name from util.names import parse_repository_name
from util.email import send_confirmation_email from util.email import send_confirmation_email
from auth.permissions import (ModifyRepositoryPermission, UserPermission, from auth.permissions import (ModifyRepositoryPermission, UserPermission,
ReadRepositoryPermission, ReadRepositoryPermission,
@ -54,7 +52,7 @@ def create_user():
if username == '$token': if username == '$token':
try: try:
token = model.load_token_data(password) model.load_token_data(password)
return make_response('Verified', 201) return make_response('Verified', 201)
except model.InvalidTokenException: except model.InvalidTokenException:
abort(401) abort(401)
@ -130,7 +128,7 @@ def create_repository(namespace, repository):
abort(403) abort(403)
else: else:
permission = CreateRepoPermission('namespace') permission = CreateRepositoryPermission('namespace')
if not permission.can(): if not permission.can():
logger.info('Attempt to create a new repo with insufficient perms.') logger.info('Attempt to create a new repo with insufficient perms.')
abort(403) abort(403)
@ -151,7 +149,7 @@ def create_repository(namespace, repository):
existing.delete_instance(recursive=True) existing.delete_instance(recursive=True)
for image_description in added_images.values(): for image_description in added_images.values():
image = model.create_image(image_description['id'], repo) model.create_image(image_description['id'], repo)
response = make_response('Created', 201) response = make_response('Created', 201)