Took out ability to assign specific users to specific servers. All role based now.

This commit is contained in:
Andrew 2021-08-21 10:07:43 -04:00
parent 77a6d260a1
commit 89f6a98dc9
2 changed files with 2 additions and 14 deletions

View File

@ -324,17 +324,9 @@ class PanelHandler(BaseHandler):
elif page == "edit_user":
user_id = self.get_argument('id', None)
user_servers = db_helper.get_authorized_servers(user_id)
role_servers = db_helper.get_authorized_servers_from_roles(user_id)
page_role_servers = []
servers = set()
for server in user_servers:
flag = False
for rserver in role_servers:
if rserver['server_id'] == server['server_id']:
flag = True
if not flag:
servers.add(server['server_id'])
for server in role_servers:
page_role_servers.append(server['server_id'])
page_data['new_user'] = False
@ -638,7 +630,6 @@ class PanelHandler(BaseHandler):
"enabled": enabled,
"regen_api": regen_api,
"roles": roles,
"servers": servers,
}
db_helper.update_user(user_id, user_data=user_data)
@ -694,7 +685,6 @@ class PanelHandler(BaseHandler):
user_id = db_helper.add_user(username, password=password0, enabled=enabled)
user_data = {
"roles": roles,
"servers": servers,
}
db_helper.update_user(user_id, user_data)

View File

@ -121,12 +121,10 @@
<tr>
<td>{{ server['server_name'] }}</td>
<td>
{% if server['server_id'] in data['servers'] %}
<input type="checkbox" class="form-check-input" id="server_{{ server['server_id'] }}_access" name="server_{{ server['server_id'] }}_access" checked="" value="1">
{% elif server['server_id'] in data['role-servers'] %}
{% if server['server_id'] in data['role-servers'] %}
<input type="checkbox" class="form-check-input" id="server_{{ server['server_id'] }}_access" name="server_{{ server['server_id'] }}_access" checked="" value="" disabled>
{% else %}
<input type="checkbox" class="form-check-input" id="server_{{ server['server_id'] }}_access" name="server_{{ server['server_id'] }}_access" value="1">
<input type="checkbox" class="form-check-input" id="server_{{ server['server_id'] }}_access" name="server_{{ server['server_id'] }}_access" value="1" disabled>
{% end %}
</td>
</tr>