Skip to content

Commit

Permalink
Invert the auth checking logic so it's readable
Browse files Browse the repository at this point in the history
  • Loading branch information
sdboyer committed Aug 28, 2013
1 parent aed243a commit ac186b7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drupalGitSSHDaemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,11 @@ def auth(self, auth_service, argv):

# Check to see if anonymous read access is enabled and if
# this is a read
if (not self.user.meta.anonymousReadAccess or \
'git-upload-pack' not in argv[:-1]):
if (self.user.meta.anonymousReadAccess and \
'git-upload-pack' in argv[:-1]):
# Read only command, and anonymous access is enabled
return execGitCommand
else:
# First, error out if the project itself is disabled.
if not auth_service["status"]:
error = "Project {0} has been disabled.".format(projectname)
Expand Down Expand Up @@ -251,9 +254,6 @@ def auth(self, auth_service, argv):
# unknown situation, but be safe and error out
error = "This operation cannot be completed at this time. It may be that we are experiencing technical difficulties or are currently undergoing maintenance."
return Failure(ConchError(error))
else:
# Read only command and anonymous access is enabled
return execGitCommand

def errorHandler(self, fail, proto):
"""Catch any unhandled errors and send the exception string to the remote client."""
Expand Down

0 comments on commit ac186b7

Please sign in to comment.