summaryrefslogtreecommitdiffstats
path: root/git-interface/git-auth.py
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-06-23 14:18:13 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-06-27 13:04:03 +0200
commited0e2fd9751a04c759cd864aa838bc1f4e1ccd79 (patch)
treeb6c5e300a2e77f55aa1203a001dde5177db6b2f4 /git-interface/git-auth.py
parente9485531be24b090162ec317bd3a3de3ec9a3d82 (diff)
downloadaurweb-ed0e2fd9751a04c759cd864aa838bc1f4e1ccd79.tar.xz
git-auth: Set AUR_PRIVILEGED env var for TUs & devs
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'git-interface/git-auth.py')
-rwxr-xr-xgit-interface/git-auth.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/git-interface/git-auth.py b/git-interface/git-auth.py
index be7d4f1..b67d9de 100755
--- a/git-interface/git-auth.py
+++ b/git-interface/git-auth.py
@@ -47,18 +47,20 @@ db = mysql.connector.connect(host=aur_db_host, user=aur_db_user,
unix_socket=aur_db_socket, buffered=True)
cur = db.cursor()
-cur.execute("SELECT Username FROM Users WHERE SSHPubKey = %s " +
+cur.execute("SELECT Username, AccountTypeID FROM Users WHERE SSHPubKey = %s " +
"AND Suspended = 0", (keytype + " " + keytext,))
if cur.rowcount != 1:
exit(1)
-user = cur.fetchone()[0]
+user, account_type = cur.fetchone()
if not re.match(username_regex, user):
exit(1)
+
env_vars = {
'AUR_USER': user,
+ 'AUR_PRIVILEGED': '1' if account_type > 1 else '0',
}
key = keytype + ' ' + keytext