Return-Path: X-Original-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 20FAFE9D1 for ; Tue, 25 Jun 2013 02:01:27 +0000 (UTC) Received: (qmail 50821 invoked by uid 500); 25 Jun 2013 02:01:27 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 50755 invoked by uid 500); 25 Jun 2013 02:01:27 -0000 Mailing-List: contact allura-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: allura-dev@incubator.apache.org Delivered-To: mailing list allura-commits@incubator.apache.org Received: (qmail 50725 invoked by uid 99); 25 Jun 2013 02:01:27 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Jun 2013 02:01:27 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id BF72882F866; Tue, 25 Jun 2013 02:01:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: brondsem@apache.org To: allura-commits@incubator.apache.org Date: Tue, 25 Jun 2013 02:01:27 -0000 Message-Id: <0a7df3f0c7714755b73ef5b1666433c4@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [2/4] git commit: [#6053] ticket:376 Check for disabled users in LocalAuthenticationProvider [#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 Authored: Fri Jun 21 19:25:46 2013 +0400 Committer: Dave Brondsema 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