diff options
author | desvox <ofunknowndescent@gmail.com> | 2018-08-05 19:13:41 -0500 |
---|---|---|
committer | desvox <ofunknowndescent@gmail.com> | 2018-08-05 19:13:41 -0500 |
commit | cba92412a82f0737cf2517412fabb825ed133ccb (patch) | |
tree | 114524ff407d6e77bce91c10515b909714e5604b /src | |
parent | 826c13db98e79e182e4e9106678a934b71d2241d (diff) | |
download | bbj-cba92412a82f0737cf2517412fabb825ed133ccb.tar.gz |
Allow setting server admins from server's config.json
Diffstat (limited to 'src')
-rw-r--r-- | src/db.py | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -411,6 +411,21 @@ def user_update(connection, user_object, parameters): return user_resolve(connection, user_id) +def set_admins(connection, users): + """ + Set the server admins to be the content of `users`. + Any other users that previously had admin rights + not included in `users` will have their privledge + revoked. + """ + connection.execute("UPDATE users SET is_admin = 0") + for user in users: + connection.execute( + "UPDATE users SET is_admin = 1 WHERE user_name = ?", + (user,)) + connection.commit() + + def user_externalize(user_object): """ Cleanse private/internal data from a user object |