v1: refactor index

This commit is contained in:
Jimmy Zelinskie 2016-08-19 14:00:21 -04:00
parent 419779b9c5
commit d67991987b
3 changed files with 93 additions and 51 deletions

View file

@ -196,3 +196,54 @@ def find_image_id_by_tag(namespace_name, repo_name, tag_name):
def delete_tag(namespace_name, repo_name, tag_name):
""" Deletes the given tag from the given repository. """
model.tag.delete_tag(namespace_name, repo_name, tag_name)
def load_token(password):
try:
model.token.load_token_data(password)
return True
except model.InvalidTokenException:
return False
def verify_robot(username, password):
try:
model.user.verify_robot(username, password)
return True
except model.InvalidRobotException:
return False
def change_user_password(user, new_password):
model.user.change_password(user, new_password)
def change_user_email(user, new_email_address):
model.user.update_email(user, new_email_address)
def get_repository(namespace_name, repo_name):
#repo = model.repository.get_repository(namespace_name, repo_name)
return Repository()
def create_repository(namespace_name, repo_name, user):
#repo = model.repository.create_repository(namespace_name, repo_name, user)
pass
def repository_is_public(namespace_name, repo_name):
# return model.repository.repository_is_public(namespace_name, repo_name)
pass
def validate_oauth_token(password):
if model.oauth_access_token(password):
return True
return False
def get_sorted_matching_repositories(search_term, only_public, can_read, limit):
matching_repos = model.repository.get_sorted_matching_repositories(query, only_public, can_read,
limit=5)
return [Repository()]