Mercurial > kallithea
changeset 5340:e50a56e61b23
users: avoid unnecessary handling of c.extern_type and c.extern_name when editing users
It is user data as anything else.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Fri, 31 Jul 2015 15:44:07 +0200 |
parents | c9fcb3b04d4a |
children | 2b1928873c0a |
files | kallithea/controllers/admin/my_account.py kallithea/controllers/admin/users.py kallithea/templates/admin/my_account/my_account_profile.html kallithea/templates/admin/users/user_edit_profile.html |
diffstat | 4 files changed, 7 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/admin/my_account.py Fri Jul 31 15:44:07 2015 +0200 +++ b/kallithea/controllers/admin/my_account.py Fri Jul 31 15:44:07 2015 +0200 @@ -100,8 +100,6 @@ self.__load_data() c.perm_user = AuthUser(user_id=self.authuser.user_id) c.ip_addr = self.ip_addr - c.extern_type = c.user.extern_type - c.extern_name = c.user.extern_name defaults = c.user.get_dict() update = False @@ -119,8 +117,9 @@ skip_attrs = ['admin', 'active', 'extern_type', 'extern_name', 'new_password', 'password_confirmation'] #TODO: plugin should define if username can be updated - if c.extern_type != EXTERN_TYPE_INTERNAL: + if c.user.extern_type != EXTERN_TYPE_INTERNAL: # forbid updating username for external accounts + # TODO: also skip username (and email etc) if self registration not enabled skip_attrs.append('username') UserModel().update(self.authuser.user_id, form_result,
--- a/kallithea/controllers/admin/users.py Fri Jul 31 15:44:07 2015 +0200 +++ b/kallithea/controllers/admin/users.py Fri Jul 31 15:44:07 2015 +0200 @@ -166,8 +166,6 @@ c.active = 'profile' user_model = UserModel() c.user = user_model.get(id) - c.extern_type = c.user.extern_type - c.extern_name = c.user.extern_name c.perm_user = AuthUser(user_id=id) c.ip_addr = self.ip_addr _form = UserForm(edit=True, old_data={'user_id': id, @@ -177,7 +175,7 @@ form_result = _form.to_python(dict(request.POST)) skip_attrs = ['extern_type', 'extern_name'] #TODO: plugin should define if username can be updated - if c.extern_type != kallithea.EXTERN_TYPE_INTERNAL: + if c.user.extern_type != kallithea.EXTERN_TYPE_INTERNAL: # forbid updating username for external accounts skip_attrs.append('username') @@ -247,8 +245,6 @@ # url('edit_user', id=ID) c.user = self._get_user_or_raise_if_default(id) c.active = 'profile' - c.extern_type = c.user.extern_type - c.extern_name = c.user.extern_name c.perm_user = AuthUser(user_id=id) c.ip_addr = self.ip_addr
--- a/kallithea/templates/admin/my_account/my_account_profile.html Fri Jul 31 15:44:07 2015 +0200 +++ b/kallithea/templates/admin/my_account/my_account_profile.html Fri Jul 31 15:44:07 2015 +0200 @@ -22,11 +22,11 @@ <% readonly = None %> <% disabled = "" %> <div class="fields"> - %if c.extern_type != c.EXTERN_TYPE_INTERNAL: + %if c.user.extern_type != c.EXTERN_TYPE_INTERNAL: <% readonly = "readonly" %> <% disabled = " disabled" %> <strong>${_('Your user is in an external Source of Record; some details cannot be managed here')}.</strong> - %endif + %endif <div class="field"> <div class="label"> <label for="username">${_('Username')}:</label>
--- a/kallithea/templates/admin/users/user_edit_profile.html Fri Jul 31 15:44:07 2015 +0200 +++ b/kallithea/templates/admin/users/user_edit_profile.html Fri Jul 31 15:44:07 2015 +0200 @@ -20,11 +20,11 @@ <% readonly = None %> <% disabled = "" %> <div class="fields"> - %if c.extern_type != c.EXTERN_TYPE_INTERNAL: + %if c.user.extern_type != c.EXTERN_TYPE_INTERNAL: <div class="field"> <% readonly = "readonly" %> <% disabled = " disabled" %> - <strong>${_('This user is in an external Source of Record (%s); some details cannot be managed here.' % c.extern_type)}.</strong> + <strong>${_('This user is in an external Source of Record (%s); some details cannot be managed here.' % c.user.extern_type)}.</strong> </div> %endif