diff --git a/app/classes/web/panel_handler.py b/app/classes/web/panel_handler.py index e619f73d..33bba144 100644 --- a/app/classes/web/panel_handler.py +++ b/app/classes/web/panel_handler.py @@ -1277,10 +1277,14 @@ class PanelHandler(BaseHandler): page_data["role"] = self.controller.roles.get_role_with_servers(role_id) if exec_user["superuser"]: defined_servers = self.controller.servers.list_defined_servers() + manager = self.get_argument("manager", None) + if manager == "": + manager = None else: defined_servers = self.controller.servers.get_authorized_servers( exec_user["user_id"] ) + manager = exec_user["user_id"] page_servers = [] for server in defined_servers: if server not in page_servers: @@ -2315,6 +2319,12 @@ class PanelHandler(BaseHandler): elif page == "add_role": role_name = bleach.clean(self.get_argument("role_name", None)) + if exec_user["superuser"]: + manager = self.get_argument("manager", None) + if manager == "": + manager = None + else: + manager = exec_user["user_id"] if EnumPermissionsCrafty.ROLES_CONFIG not in exec_user_crafty_permissions: self.redirect( @@ -2337,11 +2347,6 @@ class PanelHandler(BaseHandler): self.redirect("/panel/error?error=Role exists") return - manager = None - - if not exec_user["superuser"]: - manager = exec_user["user_id"] - servers = self.get_role_servers() role_id = self.controller.roles.add_role_advanced( diff --git a/app/frontend/templates/panel/panel_edit_role.html b/app/frontend/templates/panel/panel_edit_role.html index d39f9453..86ee953a 100644 --- a/app/frontend/templates/panel/panel_edit_role.html +++ b/app/frontend/templates/panel/panel_edit_role.html @@ -49,7 +49,7 @@
-
+ {% raw xsrf_form_html() %} @@ -63,6 +63,29 @@
+ +
+ {% if data['superuser'] %} +
+ + +
+ {% end %}
@@ -252,7 +275,7 @@
{{ translate('rolesConfig', 'configUpdate', data['lang']) }} {{ str(data['role']['last_update']) }}
- Manager: {{ data['role_manager']['username'] }} + {{ translate('userConfig', 'manager', data['lang']) }}: {{ data['role_manager']['username'] }}

diff --git a/app/translations/en_EN.json b/app/translations/en_EN.json index f63a195b..fd1e8c26 100644 --- a/app/translations/en_EN.json +++ b/app/translations/en_EN.json @@ -245,7 +245,8 @@ "roleUsers": "Role Users: ", "serverAccess": "Access?", "serverName": "Server Name", - "serversDesc": "servers this role is allowed to access" + "serversDesc": "servers this role is allowed to access", + "selectManager": "Select a manager for this Role" }, "serverBackups": { "backupAtMidnight": "Auto-backup at midnight?",