changeset 6029:e2da1c1183d8

_getUserIdByKey: make sure we are only called for cached/supported userprofile attributes
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 14 Feb 2014 14:59:29 +0100
parents 1893da1d5213
children 5ab38cec99f7
files MoinMoin/user.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/user.py	Wed Feb 12 18:22:10 2014 +0100
+++ b/MoinMoin/user.py	Fri Feb 14 14:59:29 2014 +0100
@@ -84,7 +84,9 @@
     @param search: the value to look for
     @return the corresponding user ID or None
     """
-    if not search or not key:
+    if key not in CACHED_USER_ATTRS:
+        raise ValueError("unsupported key, must be in CACHED_USER_ATTRS")
+    if not search:
         return None
     cfg = request.cfg
     cfg_cache_attr = key + "2id"