summaryrefslogtreecommitdiffstats
path: root/git-interface
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-08-02 23:21:06 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-08-05 01:22:52 +0200
commit87f5f1b407fee29412c761e6f1484f51fae86eda (patch)
tree6152d38f115e6b588532eebb969389a63910199b /git-interface
parent7a53ded5fea71cc89d0530d5c087e452e89c9d3f (diff)
downloadaurweb-87f5f1b407fee29412c761e6f1484f51fae86eda.tar.xz
git-update: Use AUR_PRIVILEGED for forced pushes
Instead of looking up the account type of the current user again, use the AUR_PRIVILEGED environment variable to check whether the user is allowed to perform non-fast-forward ref updates. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'git-interface')
-rwxr-xr-xgit-interface/git-update.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/git-interface/git-update.py b/git-interface/git-update.py
index 5fc5562..68f7387 100755
--- a/git-interface/git-update.py
+++ b/git-interface/git-update.py
@@ -226,14 +226,11 @@ db = mysql.connector.connect(host=aur_db_host, user=aur_db_user,
cur = db.cursor()
# Detect and deny non-fast-forwards.
-if sha1_old != "0000000000000000000000000000000000000000":
+if sha1_old != "0000000000000000000000000000000000000000" and not privileged:
walker = repo.walk(sha1_old, pygit2.GIT_SORT_TOPOLOGICAL)
walker.hide(sha1_new)
if next(walker, None) is not None:
- cur.execute("SELECT AccountTypeID FROM Users WHERE UserName = %s ",
- [user])
- if cur.fetchone()[0] == 1:
- die("denying non-fast-forward (you should pull first)")
+ die("denying non-fast-forward (you should pull first)")
# Prepare the walker that validates new commits.
walker = repo.walk(sha1_new, pygit2.GIT_SORT_TOPOLOGICAL)