Don't use repository object anywhere in endpoints/api/repositorynotification

Also adds support for audit logging with repo name only
This commit is contained in:
Evan Cordell 2017-07-17 17:55:00 -04:00
parent 047722b295
commit 9dad44e93d
5 changed files with 36 additions and 41 deletions

View file

@ -9,16 +9,14 @@ from endpoints.notificationhelper import build_notification_data
class PreOCIModel(RepoNotificationInterface):
def get_repository(self, namespace_name, repository_name):
return self._notification(model.repository.get_repository(namespace_name, repository_name))
def create_repo_notification(self, repository, event_name, method_name, method_config, event_config, title=None):
def create_repo_notification(self, namespace_name, repository_name, event_name, method_name, method_config, event_config, title=None):
repository = model.repository.get_repository(namespace_name, repository_name)
return self._notification(model.notification.create_repo_notification(repository,
event_name,
method_name,
method_config,
event_config,
title))
event_name,
method_name,
method_config,
event_config,
title))
def list_repo_notifications(self, namespace_name, repository_name, event_name=None):
return [self._notification(n)
@ -27,13 +25,13 @@ class PreOCIModel(RepoNotificationInterface):
def get_repo_notification(self, uuid):
return self._notification(model.notification.get_repo_notification(uuid))
def delete_repo_notification(self, repository, uuid):
def delete_repo_notification(self, namespace_name, repository_name, uuid):
return self._notification(
self.model.notification.delete_repo_notification(repository.namespace_user, repository.name, uuid))
self.model.notification.delete_repo_notification(namespace_name, repository_name, uuid))
def reset_notification_number_of_failures(self, repository, uuid):
def reset_notification_number_of_failures(self, namespace_name, repository_name, uuid):
return self._notification(
model.notification.reset_notification_number_of_failures(repository.namespace_user, repository.name, uuid))
model.notification.reset_notification_number_of_failures(namespace_name, repository_name, uuid))
def queue_test_notification(self, notification):
event_info = NotificationEvent.get_event(notification.event.name)