Add support for package base co-maintainers

This allows for having multiple co-maintainers for AUR packages.
Co-maintainers have push access to the package base Git repository but
are not allowed to change the package base category, disown the package
or modify the list of co-maintainers. The primary maintainer of an AUR
package can edit the list of co-maintainers from the Package Actions
box.

Implements FS#17911.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2015-01-07 12:10:53 +01:00
parent b32458cb8a
commit fc23a9bd50
12 changed files with 156 additions and 9 deletions

View file

@ -92,10 +92,13 @@ def check_permissions(pkgbase, user):
unix_socket=aur_db_socket, buffered=True)
cur = db.cursor()
cur.execute("SELECT COUNT(*) FROM PackageBases INNER JOIN Users " +
"ON Users.ID = PackageBases.MaintainerUID OR " +
"PackageBases.MaintainerUID IS NULL WHERE " +
"Name = %s AND Username = %s", [pkgbase, user])
cur.execute("SELECT COUNT(*) FROM PackageBases " +
"LEFT JOIN PackageComaintainers " +
"ON PackageComaintainers.PackageBaseID = PackageBases.ID " +
"INNER JOIN Users ON Users.ID = PackageBases.MaintainerUID " +
"OR PackageBases.MaintainerUID IS NULL " +
"OR Users.ID = PackageComaintainers.UsersID " +
"WHERE Name = %s AND Username = %s", [pkgbase, user])
return cur.fetchone()[0] > 0
def die(msg):