Chromium Code Reviews| 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..b923a3e60f43f30d7023c54df5f6799026f3a01e 100644 |
| --- a/appengine/findit/model/versioned_config.py |
| +++ b/appengine/findit/model/versioned_config.py |
| @@ -30,9 +30,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=None, is_admin=False, **kwargs): |
| """Applies |kwargs| dict to the entity and stores the entity if changed.""" |
| - if not users.is_current_user_admin(): |
| + if not user and not is_admin and not users.is_current_user_admin(): |
|
stgao
2016/04/01 23:35:48
As we already pass in the user and is_admin, why w
stgao
2016/04/01 23:35:48
bug: seems we should use 'or' instead of 'and' her
lijeffrey
2016/04/04 21:35:05
Done.
|
| raise Exception('Only admin could update config.') |
| dirty = False |
| @@ -43,7 +43,8 @@ class VersionedConfig(VersionedModel): |
| dirty = True |
| if dirty: |
| - user_name = users.get_current_user().email().split('@')[0] |
| + current_user = user if user else users.get_current_user() |
| + user_name = current_user.email().split('@')[0] |
| self.updated_by = user_name |
| self.Save() |
| logging.info('Config %s was updated by %s', self.__class__, user_name) |