[aur-dev] [PATCH 2/4] git-auth: Set AUR_PRIVILEGED env var for TUs & devs

Lukas Fleischer lfleischer at archlinux.org
Tue Jun 23 08:15:29 UTC 2015


On Tue, 23 Jun 2015 at 00:00:19, Johannes Löthberg wrote:
> Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
> ---
>  git-interface/git-auth.py | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/git-interface/git-auth.py b/git-interface/git-auth.py
> index af1f8d4..668f6c1 100755
> --- a/git-interface/git-auth.py
> +++ b/git-interface/git-auth.py
> @@ -40,18 +40,25 @@ 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()[0]
>  if not re.match(username_regex, user):
>      exit(1)
>  
> +if account_type > 1:
> +    privileged = True
> +else:
> +    privileged = False
> +
> +
>  env_vars = {
>      'AUR_USER': user,
> +    'AUR_PRIVILEGED': privileged,

Maybe drop the if-else-block above and directly use (account_type > 1)
here? I am not sure about which version is more readable...

>  }
>  key = keytype + ' ' + keytext
>  
> -- 
> 2.4.4


More information about the aur-dev mailing list