diff MoinMoin/apps/admin/views.py @ 2024:2d11470eb41b

fix userbrowser, enable/disable user
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 03 Mar 2013 02:25:21 +0100
parents 3e8c910f66f8
children ca5e39389265
line wrap: on
line diff
--- a/MoinMoin/apps/admin/views.py	Sun Mar 03 01:41:14 2013 +0100
+++ b/MoinMoin/apps/admin/views.py	Sun Mar 03 02:25:21 2013 +0100
@@ -20,7 +20,7 @@
 from MoinMoin.themes import render_template
 from MoinMoin.apps.admin import admin
 from MoinMoin import user
-from MoinMoin.constants.keys import NAME, ITEMID, SIZE, EMAIL
+from MoinMoin.constants.keys import NAME, ITEMID, SIZE, EMAIL, DISABLED
 from MoinMoin.constants.rights import SUPERUSER
 from MoinMoin.security import require_permission
 
@@ -47,7 +47,7 @@
     user_accounts = [dict(uid=rev.meta[ITEMID],
                           name=rev.meta[NAME],
                           email=rev.meta[EMAIL],
-                          disabled=False,  # TODO: add to index
+                          disabled=rev.meta[DISABLED],
                           groups=[groupname for groupname in groups if rev.meta[NAME] in groups[groupname]],
                      ) for rev in revs]
     return render_template('admin/userbrowser.html', user_accounts=user_accounts, title_name=_(u"Users"))
@@ -70,9 +70,9 @@
         ok = False
         if hasattr(u, key):
             ok = True
-            oldval = getattr(u, key)
+            oldval = u.profile[key]
             if isinstance(oldval, bool):
-                val = bool(val)
+                val = bool(int(val))
             elif isinstance(oldval, int):
                 val = int(val)
             elif isinstance(oldval, unicode):
@@ -80,7 +80,7 @@
             else:
                 ok = False
         if ok:
-            setattr(u, key, val)
+            u.profile[key] = val
             u.save()
             flash(u'{0}.{1}: {2} -> {3}'.format(user_name, key, unicode(oldval), unicode(val), ), "info")
         else: