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
1=== modified file 'turnipcake/views.py'
2--- turnipcake/views.py 2014-12-11 07:47:21 +0000
3+++ turnipcake/views.py 2015-02-03 17:13:13 +0000
4@@ -108,7 +108,7 @@
5
6
7 @xmlrpc_method(endpoint='githosting')
8-def translatePath(request, path, permission, authenticated_user,
9+def translatePath(request, path, permission, authenticated_uid,
10 can_authenticate):
11 try:
12 repo = DBSession.query(Repo).filter(
13@@ -116,10 +116,10 @@
14 except NoResultFound:
15 raise xmlrpclib.Fault(1, "Repo does not exist")
16
17- writable = authenticated_user == repo.owner.name
18+ writable = authenticated_uid == repo.owner_id
19
20 if permission != b'read' and not writable:
21- if not can_authenticate or authenticated_user is not None:
22+ if not can_authenticate or authenticated_uid is not None:
23 raise xmlrpclib.Fault(2, "Repo is read-only")
24 else:
25 raise xmlrpclib.Fault(3, "Authorisation required")
26@@ -135,4 +135,4 @@
27 raise xmlrpclib.Fault(3, "Invalid username or password")
28 if password != user.password:
29 raise xmlrpclib.Fault(3, "Invalid username or password")
30- return {'user': username}
31+ return {'user': username, 'uid': user.id}

Subscribers

People subscribed via source and target branches

to all changes: