Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1220)

Unified Diff: appengine/findit/model/versioned_config.py

Issue 1836293002: [Findit] Adding central config test class for unit tests (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/findit/model/versioned_config.py
diff --git a/appengine/findit/model/versioned_config.py b/appengine/findit/model/versioned_config.py
index d85a3d3590d34a3d925622ba4b5d3fd5b5c44bf3..139c97bfbe00e3bdb8e88a38b3e8ed84b58d9fa1 100644
--- a/appengine/findit/model/versioned_config.py
+++ b/appengine/findit/model/versioned_config.py
@@ -6,7 +6,6 @@
import logging
-from google.appengine.api import users
from google.appengine.ext import ndb
from model.versioned_model import VersionedModel
@@ -30,9 +29,9 @@ class VersionedConfig(VersionedModel):
config_data = cls.GetVersion(version)
return config_data or cls() if version is None else config_data
- def Update(self, **kwargs):
+ def Update(self, user, is_admin, **kwargs):
"""Applies |kwargs| dict to the entity and stores the entity if changed."""
- if not users.is_current_user_admin():
+ if not is_admin:
raise Exception('Only admin could update config.')
dirty = False
@@ -43,7 +42,7 @@ class VersionedConfig(VersionedModel):
dirty = True
if dirty:
- user_name = users.get_current_user().email().split('@')[0]
+ user_name = user.email().split('@')[0]
self.updated_by = user_name
self.Save()
logging.info('Config %s was updated by %s', self.__class__, user_name)

Powered by Google App Engine
This is Rietveld 408576698