Fixed bug where if a user created a server they would not have access to it.

This commit is contained in:
Andrew 2021-08-06 12:49:07 -04:00
parent e40fb45853
commit 67008f0e37
2 changed files with 6 additions and 0 deletions

View File

@ -569,6 +569,11 @@ class db_shortcuts:
#logger.debug("user: ({}) {}".format(user_id, user))
return user
@staticmethod
def add_user_server(server_id, user_id):
servers = User_Servers.insert({User_Servers.server_id: server_id, User_Servers.user_id: user_id}).execute()
return servers
@staticmethod
def user_query(user_id):

View File

@ -201,6 +201,7 @@ class ServerHandler(BaseHandler):
server_type, server_version = server_parts
# todo: add server type check here and call the correct server add functions if not a jar
new_server_id = self.controller.create_jar_server(server_type, server_version, server_name, min_mem, max_mem, port)
db_helper.add_user_server(new_server_id, exec_user_id)
db_helper.add_to_audit_log(exec_user_data['user_id'],
"created a {} {} server named \"{}\"".format(server_version, str(server_type).capitalize(), server_name), # Example: Admin created a 1.16.5 Bukkit server named "survival"
new_server_id,