Blob Blame Raw
From 7ec0e2c6b01f27f7a23546c64d775a1befd722e4 Mon Sep 17 00:00:00 2001
From: Patrick Uiterwijk <puiterwijk@redhat.com>
Date: May 04 2017 14:02:58 +0000
Subject: Make sslLogin use getUserId


Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>

---

diff --git a/koji/auth.py b/koji/auth.py
index 105f998..6044590 100644
--- a/koji/auth.py
+++ b/koji/auth.py
@@ -401,14 +401,8 @@ class Session(object):
             else:
                 raise koji.AuthError('%s is not authorized to login other users' % client_dn)
 
-        cursor = context.cnx.cursor()
-        query = """SELECT id FROM users
-        WHERE name = %(username)s"""
-        cursor.execute(query, locals())
-        result = cursor.fetchone()
-        if result:
-            user_id = result[0]
-        else:
+        user_id = self.getUserId(username)
+        if not user_id:
             if context.opts.get('LoginCreatesUser'):
                 user_id = self.createUser(username)
             else: