mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
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>
This commit is contained in:
parent
7a53ded5fe
commit
87f5f1b407
1 changed files with 2 additions and 5 deletions
|
@ -226,13 +226,10 @@ db = mysql.connector.connect(host=aur_db_host, user=aur_db_user,
|
||||||
cur = db.cursor()
|
cur = db.cursor()
|
||||||
|
|
||||||
# Detect and deny non-fast-forwards.
|
# 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 = repo.walk(sha1_old, pygit2.GIT_SORT_TOPOLOGICAL)
|
||||||
walker.hide(sha1_new)
|
walker.hide(sha1_new)
|
||||||
if next(walker, None) is not None:
|
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.
|
# Prepare the walker that validates new commits.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue