fixes bug: setting user who is not present in pianist-table is no longer allowed
This commit is contained in:
14
rep_cli.py
14
rep_cli.py
@@ -23,9 +23,19 @@ class Session:
|
||||
}
|
||||
|
||||
def set_user(self, arguments):
|
||||
resultstring = ''
|
||||
db_index = arguments[0]
|
||||
self.user = db_index
|
||||
return 'User set'
|
||||
sql_command = f'''
|
||||
SELECT *
|
||||
FROM pianist
|
||||
WHERE id = {db_index}
|
||||
'''
|
||||
if self.db_agent.execute(sql_command).fetchone():
|
||||
self.user = db_index
|
||||
resultstring += 'User set'
|
||||
else:
|
||||
resultstring += 'No such user'
|
||||
return resultstring
|
||||
|
||||
def get_active_user(self):
|
||||
sql_command = f'''
|
||||
|
||||
Reference in New Issue
Block a user