diff MoinMoin/user.py @ 6027:8618232296b5

optimized notification of superusers on user account creation new user.superusers function that efficiently yields superuser User objects without listing / reading ALL user profiles as the previous code did. reduced code duplication.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 12 Feb 2014 12:53:41 +0100
parents 28a3951fc9f6
children 1893da1d5213
line wrap: on
line diff
--- a/MoinMoin/user.py	Wed Feb 12 12:12:17 2014 +0100
+++ b/MoinMoin/user.py	Wed Feb 12 12:53:41 2014 +0100
@@ -149,6 +149,16 @@
     return _getUserIdByKey(request, 'openids', openid)
 
 
+def superusers(request):
+    """
+    yields superuser User objects
+    """
+    for name in request.cfg.superuser:
+        u = User(request, auth_username=name)
+        if u.isSuperUser():  # this checks for addtl. criteria
+            yield u
+
+
 def getUserIdentification(request, username=None):
     """ Return user name or IP or '<unknown>' indicator.