mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 23:51:08 +00:00
Add per-package upload permission checks.
This commit is contained in:
parent
b04a9071c0
commit
d830c5a4c1
8
debian/changelog
vendored
8
debian/changelog
vendored
@ -6,7 +6,13 @@ ubuntu-dev-tools (0.65) UNRELEASED; urgency=low
|
||||
[ Jonathan Davies ]
|
||||
* requestsync: Only check existing reports if the --lp flag is used.
|
||||
|
||||
-- Jonathan Davies <jpds@ubuntu.com> Mon, 16 Feb 2009 15:06:16 +0000
|
||||
[ Luca Falavigna ]
|
||||
* Add per-package upload permission checks:
|
||||
- ubuntutools/lp/functions.py: implement isPerPackageUploader.
|
||||
- requestsync: check if submitter has per-package upload permission
|
||||
using isPerPackageUploader function and adjust report accordingly.
|
||||
|
||||
-- Luca Falavigna <dktrkranz@ubuntu.com> Thu, 19 Feb 2009 23:55:04 +0100
|
||||
|
||||
ubuntu-dev-tools (0.64) jaunty; urgency=low
|
||||
|
||||
|
10
requestsync
10
requestsync
@ -78,6 +78,11 @@ def checkNeedsSponsorship(component):
|
||||
teamMember = lp_functions.isLPTeamMember(team)
|
||||
|
||||
if not teamMember:
|
||||
|
||||
# Check if they have a per-package upload permission.
|
||||
if lp_functions.isPerPackageUploader(args[0]):
|
||||
return "perpackageupload"
|
||||
|
||||
print "You are not a member (direct or indirect) of the '%s' " \
|
||||
"team on Launchpad." % team
|
||||
print "Your sync request shall require an approval by a member of " \
|
||||
@ -526,7 +531,7 @@ if __name__ == '__main__':
|
||||
# Generate bug report.
|
||||
subscribe = 'ubuntu-archive'
|
||||
status = 'confirmed'
|
||||
if sponsorship:
|
||||
if sponsorship == True:
|
||||
status = 'new'
|
||||
if component in ['main', 'restricted']:
|
||||
subscribe = 'ubuntu-main-sponsors'
|
||||
@ -550,6 +555,9 @@ if __name__ == '__main__':
|
||||
report += 'Explanation of the Ubuntu delta and why it can be dropped:\n' + \
|
||||
'>>> ENTER_EXPLANATION_HERE <<<\n\n'
|
||||
|
||||
if sponsorship == 'perpackageupload':
|
||||
report += 'Note that I have per-package upload permissions for %s.\n\n' % srcpkg
|
||||
|
||||
uidx = base_ver.find('build')
|
||||
if uidx > 0:
|
||||
base_ver = base_ver[:uidx]
|
||||
|
@ -22,6 +22,9 @@ import cookie
|
||||
import urlopener as lp_urlopener
|
||||
import urllib2
|
||||
import sys
|
||||
import libsupport as lp_libsupport
|
||||
import launchpadlib
|
||||
from re import findall
|
||||
|
||||
def isLPTeamMember(team):
|
||||
""" Checks if the user is a member of a certain team on Launchpad.
|
||||
@ -53,3 +56,18 @@ def isLPTeamMember(team):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def isPerPackageUploader(package):
|
||||
# Checks if the user has upload privileges for a certain package.
|
||||
|
||||
launchpad = lp_libsupport.get_launchpad("ubuntu-dev-tools")
|
||||
me = findall('~(\S+)', '%s' % launchpad.me)[0]
|
||||
main_archive = launchpad.distributions["ubuntu"].main_archive
|
||||
try:
|
||||
perms = main_archive.getUploadersForPackage(source_package_name=package)
|
||||
except launchpadlib.errors.HTTPError:
|
||||
return False
|
||||
for perm in perms:
|
||||
if perm.person.name == me:
|
||||
return True
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user