incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/4] git commit: [#6053] ticket:376 Check for disabled users in LocalAuthenticationProvider
Date Tue, 25 Jun 2013 02:01:27 GMT
[#6053]  ticket:376 Check for disabled users in LocalAuthenticationProvider


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/b58bd1ca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b58bd1ca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b58bd1ca

Branch: refs/heads/master
Commit: b58bd1caee556b7500b3d47e1e868cca4e06c089
Parents: e7850dc
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Fri Jun 21 19:25:46 2013 +0400
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Tue Jun 25 02:00:44 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/basetest_project_root.py | 2 ++
 Allura/allura/lib/plugin.py                        | 4 ++--
 Allura/allura/model/notification.py                | 4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b58bd1ca/Allura/allura/controllers/basetest_project_root.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/basetest_project_root.py b/Allura/allura/controllers/basetest_project_root.py
index 8c48ed6..d29656b 100644
--- a/Allura/allura/controllers/basetest_project_root.py
+++ b/Allura/allura/controllers/basetest_project_root.py
@@ -123,6 +123,8 @@ class BasetestProjectRootController(WsgiDispatchController, ProjectController):
         c.project = M.Project.query.get(shortname='test', neighborhood_id=self.p_nbhd._id)
         auth = plugin.AuthenticationProvider.get(request)
         user = auth.by_username(environ.get('username', 'test-admin'))
+        if not user:
+            user = M.User.by_username('test-admin')
         environ['beaker.session']['userid'] = user._id
         c.user = auth.authenticate_request()
         return WsgiDispatchController.__call__(self, environ, start_response)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b58bd1ca/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 861fb4f..0d104f5 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -233,7 +233,7 @@ class LocalAuthenticationProvider(AuthenticationProvider):
         un = un.replace(r'\_', '[-_]')
         un = un.replace(r'\-', '[-_]')
         rex = re.compile('^' + un + '$')
-        return M.User.query.get(username=rex)
+        return M.User.query.get(username=rex, disabled=False)
 
     def set_password(self, user, old_password, new_password):
         user.password = self._encode_password(new_password)
@@ -251,7 +251,7 @@ class LocalAuthenticationProvider(AuthenticationProvider):
 
     def user_by_project_shortname(self, shortname):
         from allura import model as M
-        return M.User.query.get(username=shortname)
+        return M.User.query.get(username=shortname, disabled=False)
 
     def update_notifications(self, user):
         return ''

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b58bd1ca/Allura/allura/model/notification.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/notification.py b/Allura/allura/model/notification.py
index 5370c92..2645428 100644
--- a/Allura/allura/model/notification.py
+++ b/Allura/allura/model/notification.py
@@ -265,7 +265,9 @@ class Notification(MappedClass):
                     reply_to_address=None):
         if not notifications: return
         user = User.query.get(_id=ObjectId(user_id), disabled=False)
-        if not user: return
+        if not user:
+            log.debug("Skipping notification - User %s isn't active " % user_id)
+            return
         # Filter out notifications for which the user doesn't have read
         # permissions to the artifact.
         artifact = self.ref.artifact


Mime
View raw message