mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'pretzel-branch' into 'dev'
Fix user error when trying to edit own language See merge request crafty-controller/crafty-commander!123
This commit is contained in:
commit
b3cb6006e9
@ -165,7 +165,10 @@ class Permissions_Servers:
|
||||
else:
|
||||
roles_list = users_helper.get_user_roles_id(user_id)
|
||||
role_server = Role_Servers.select().where(Role_Servers.role_id.in_(roles_list)).where(Role_Servers.server_id == int(server_id)).execute()
|
||||
permissions_mask = role_server[0].permissions
|
||||
if len(role_server) > 0:
|
||||
permissions_mask = role_server[0].permissions
|
||||
else:
|
||||
permissions_mask = '00000000'
|
||||
permissions_list = server_permissions.get_permissions(permissions_mask)
|
||||
return permissions_list
|
||||
|
||||
|
@ -97,12 +97,16 @@ class Helpers:
|
||||
|
||||
@staticmethod
|
||||
def check_port(server_port):
|
||||
try:
|
||||
host_public = get('https://api.ipify.org').text
|
||||
tn = telnetlib.Telnet(host_public, server_port, 10)
|
||||
telnetlib.close()
|
||||
a_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
ip = get('https://api.ipify.org').content.decode('utf8')
|
||||
|
||||
location = (ip, server_port)
|
||||
result_of_check = a_socket.connect_ex(location)
|
||||
|
||||
if result_of_check == 0:
|
||||
return True
|
||||
except Exception as err:
|
||||
else:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
|
@ -73,7 +73,6 @@ class TasksManager:
|
||||
logger.info("Loading schedule ID#{i}: '{a}' every {n} {t} at {s}".format(
|
||||
i=j.schedule_id, a=j.action, n=j.interval, t=j.interval_type, s=j.start_time))
|
||||
try:
|
||||
print(self.controller.users.get_id_by_name('system'))
|
||||
getattr(schedule.every(j.interval), j.interval_type).at(j.start_time).do(
|
||||
self.controller.management.send_command, self.controller.users.get_id_by_name('system'), j.server_id, "127.27.23.89", j.action)
|
||||
except schedule.ScheduleValueError as e:
|
||||
|
@ -469,7 +469,7 @@ class PanelHandler(BaseHandler):
|
||||
page_data['quantity_server'] = self.controller.crafty_perms.list_crafty_permissions_quantity_limits(user_id)
|
||||
page_data['languages'] = []
|
||||
page_data['languages'].append(self.controller.users.get_user_lang_by_id(user_id))
|
||||
for file in os.listdir(os.path.join(helper.root_dir, 'app', 'translations')):
|
||||
for file in sorted(os.listdir(os.path.join(helper.root_dir, 'app', 'translations'))):
|
||||
if file.endswith('.json'):
|
||||
if file != str(page_data['languages'][0] + '.json'):
|
||||
page_data['languages'].append(file.split('.')[0])
|
||||
@ -916,8 +916,9 @@ class PanelHandler(BaseHandler):
|
||||
|
||||
|
||||
elif page == "add_user":
|
||||
if bleach.clean(self.get_argument('username', None)):
|
||||
if bleach.clean(self.get_argument('username', None)).lower() == 'system':
|
||||
self.redirect("/panel/error?error=Unauthorized access: username system is reserved for the Crafty system. Please choose a different username.")
|
||||
return
|
||||
username = bleach.clean(self.get_argument('username', None))
|
||||
password0 = bleach.clean(self.get_argument('password0', None))
|
||||
password1 = bleach.clean(self.get_argument('password1', None))
|
||||
|
Loading…
Reference in New Issue
Block a user