Merge lp:~cjwatson/turnip/turnipcake-auth-uid into lp:~canonical-launchpad-branches/turnip/turnipcake

Proposed by Colin Watson
Status: Merged
Merged at revision: 10
Proposed branch: lp:~cjwatson/turnip/turnipcake-auth-uid
Merge into: lp:~canonical-launchpad-branches/turnip/turnipcake
Diff against target: 31 lines (+4/-4)
1 file modified
turnipcake/views.py (+4/-4)
To merge this branch: bzr merge lp:~cjwatson/turnip/turnipcake-auth-uid
Reviewer Review Type Date Requested Status
William Grant Approve
Review via email: mp+248422@code.launchpad.net

This proposal supersedes a proposal from 2015-02-03.

Commit message

Return user.id as an additional dict entry from authenticateWithPassword; require user ID rather than name in translatePath.

Description of the change

Return user.id as an additional dict entry from authenticateWithPassword; require user ID rather than name in translatePath.

This is an incompatible API change, and goes together with https://code.launchpad.net/~cjwatson/turnip/auth-uid/+merge/248420.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'turnipcake/views.py'
--- turnipcake/views.py 2014-12-11 07:47:21 +0000
+++ turnipcake/views.py 2015-02-03 17:13:13 +0000
@@ -108,7 +108,7 @@
108108
109109
110@xmlrpc_method(endpoint='githosting')110@xmlrpc_method(endpoint='githosting')
111def translatePath(request, path, permission, authenticated_user,111def translatePath(request, path, permission, authenticated_uid,
112 can_authenticate):112 can_authenticate):
113 try:113 try:
114 repo = DBSession.query(Repo).filter(114 repo = DBSession.query(Repo).filter(
@@ -116,10 +116,10 @@
116 except NoResultFound:116 except NoResultFound:
117 raise xmlrpclib.Fault(1, "Repo does not exist")117 raise xmlrpclib.Fault(1, "Repo does not exist")
118118
119 writable = authenticated_user == repo.owner.name119 writable = authenticated_uid == repo.owner_id
120120
121 if permission != b'read' and not writable:121 if permission != b'read' and not writable:
122 if not can_authenticate or authenticated_user is not None:122 if not can_authenticate or authenticated_uid is not None:
123 raise xmlrpclib.Fault(2, "Repo is read-only")123 raise xmlrpclib.Fault(2, "Repo is read-only")
124 else:124 else:
125 raise xmlrpclib.Fault(3, "Authorisation required")125 raise xmlrpclib.Fault(3, "Authorisation required")
@@ -135,4 +135,4 @@
135 raise xmlrpclib.Fault(3, "Invalid username or password")135 raise xmlrpclib.Fault(3, "Invalid username or password")
136 if password != user.password:136 if password != user.password:
137 raise xmlrpclib.Fault(3, "Invalid username or password")137 raise xmlrpclib.Fault(3, "Invalid username or password")
138 return {'user': username}138 return {'user': username, 'uid': user.id}

Subscribers

People subscribed via source and target branches

to all changes: