Added handler to get user id by username
@@ -22,3 +22,20 @@ class User(Resource):
abort(404)
return user
+
+
+@ns.route('/id/<username>')
+class User(Resource):
+
+ @auth_required(['user'], check_project_access=False)
+ def get(self, username):
+ user_id = g.db.execute_one('''
+ SELECT id
+ FROM "user"
+ WHERE username = %s
+ ''', [username])
+
+ if not user_id:
+ abort(404, 'User not found')
+
+ return user_id[0]
