|
|
@ -1559,28 +1559,25 @@ if form.getvalue('slackdel') is not None:
|
|
|
|
alerting.delete_slack_channel(channel_id)
|
|
|
|
alerting.delete_slack_channel(channel_id)
|
|
|
|
|
|
|
|
|
|
|
|
if form.getvalue('updatetoken') is not None:
|
|
|
|
if form.getvalue('updatetoken') is not None:
|
|
|
|
|
|
|
|
import modules.alerting.alerting as alerting
|
|
|
|
|
|
|
|
|
|
|
|
token = common.checkAjaxInput(form.getvalue('updatetoken'))
|
|
|
|
token = common.checkAjaxInput(form.getvalue('updatetoken'))
|
|
|
|
channel = common.checkAjaxInput(form.getvalue('updategchanel'))
|
|
|
|
channel = common.checkAjaxInput(form.getvalue('updategchanel'))
|
|
|
|
group = common.checkAjaxInput(form.getvalue('updatetelegramgroup'))
|
|
|
|
group = common.checkAjaxInput(form.getvalue('updatetelegramgroup'))
|
|
|
|
user_id = common.checkAjaxInput(form.getvalue('id'))
|
|
|
|
user_id = common.checkAjaxInput(form.getvalue('id'))
|
|
|
|
if token is None or channel is None or group is None:
|
|
|
|
|
|
|
|
print(error_mess)
|
|
|
|
alerting.update_telegram(token, channel, group, user_id)
|
|
|
|
else:
|
|
|
|
|
|
|
|
sql.update_telegram(token, channel, group, user_id)
|
|
|
|
|
|
|
|
roxywi_common.logging('group ' + group, f'The Telegram token has been updated for channel: {channel}', roxywi=1,
|
|
|
|
|
|
|
|
login=1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if form.getvalue('update_slack_token') is not None:
|
|
|
|
if form.getvalue('update_slack_token') is not None:
|
|
|
|
|
|
|
|
import modules.alerting.alerting as alerting
|
|
|
|
|
|
|
|
|
|
|
|
token = common.checkAjaxInput(form.getvalue('update_slack_token'))
|
|
|
|
token = common.checkAjaxInput(form.getvalue('update_slack_token'))
|
|
|
|
channel = common.checkAjaxInput(form.getvalue('updategchanel'))
|
|
|
|
channel = common.checkAjaxInput(form.getvalue('updategchanel'))
|
|
|
|
group = common.checkAjaxInput(form.getvalue('updateslackgroup'))
|
|
|
|
group = common.checkAjaxInput(form.getvalue('updateslackgroup'))
|
|
|
|
user_id = common.checkAjaxInput(form.getvalue('id'))
|
|
|
|
user_id = common.checkAjaxInput(form.getvalue('id'))
|
|
|
|
if token is None or channel is None or group is None:
|
|
|
|
|
|
|
|
print(error_mess)
|
|
|
|
alerting.update_slack()
|
|
|
|
else:
|
|
|
|
|
|
|
|
sql.update_slack(token, channel, group, user_id)
|
|
|
|
|
|
|
|
roxywi_common.logging(f'group {group}', f'The Slack token has been updated for channel: {channel}', roxywi=1,
|
|
|
|
|
|
|
|
login=1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if form.getvalue('updatesettings') is not None:
|
|
|
|
if form.getvalue('updatesettings') is not None:
|
|
|
|
settings = common.checkAjaxInput(form.getvalue('updatesettings'))
|
|
|
|
settings = common.checkAjaxInput(form.getvalue('updatesettings'))
|
|
|
@ -1592,78 +1589,39 @@ if form.getvalue('updatesettings') is not None:
|
|
|
|
print("Ok")
|
|
|
|
print("Ok")
|
|
|
|
|
|
|
|
|
|
|
|
if form.getvalue('getuserservices'):
|
|
|
|
if form.getvalue('getuserservices'):
|
|
|
|
user_id = common.checkAjaxInput(form.getvalue('getuserservices'))
|
|
|
|
import modules.roxywi.user as roxy_user
|
|
|
|
groups = []
|
|
|
|
|
|
|
|
u_g = sql.select_user_groups(user_id)
|
|
|
|
roxy_user.get_user_services()
|
|
|
|
services = sql.select_services()
|
|
|
|
|
|
|
|
for g in u_g:
|
|
|
|
|
|
|
|
groups.append(g.user_group_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
|
|
|
|
|
|
|
template = env.get_template('/show_user_services.html')
|
|
|
|
|
|
|
|
template = template.render(user_services=sql.select_user_services(user_id), id=user_id, services=services)
|
|
|
|
|
|
|
|
print(template)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if form.getvalue('getusergroups'):
|
|
|
|
if form.getvalue('getusergroups'):
|
|
|
|
user_id = common.checkAjaxInput(form.getvalue('getusergroups'))
|
|
|
|
import modules.roxywi.user as roxy_user
|
|
|
|
groups = []
|
|
|
|
|
|
|
|
u_g = sql.select_user_groups(user_id)
|
|
|
|
|
|
|
|
for g in u_g:
|
|
|
|
|
|
|
|
groups.append(g.user_group_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
|
|
|
roxy_user.get_user_groups()
|
|
|
|
template = env.get_template('/show_user_groups.html')
|
|
|
|
|
|
|
|
template = template.render(groups=sql.select_groups(), user_groups=groups, id=user_id)
|
|
|
|
|
|
|
|
print(template)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if form.getvalue('changeUserGroupId') is not None:
|
|
|
|
if form.getvalue('changeUserGroupId') is not None:
|
|
|
|
group_id = common.checkAjaxInput(form.getvalue('changeUserGroupId'))
|
|
|
|
import modules.roxywi.user as roxy_user
|
|
|
|
groups = common.checkAjaxInput(form.getvalue('changeUserGroups'))
|
|
|
|
|
|
|
|
user = common.checkAjaxInput(form.getvalue('changeUserGroupsUser'))
|
|
|
|
|
|
|
|
if sql.delete_user_groups(group_id):
|
|
|
|
|
|
|
|
for group in groups:
|
|
|
|
|
|
|
|
if group[0] == ',':
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
sql.update_user_groups(groups=group[0], user_group_id=group_id)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
print(e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
roxywi_common.logging('Roxy-WI server', f'Groups has been updated for user: {user}', roxywi=1, login=1)
|
|
|
|
roxy_user.change_user_group()
|
|
|
|
|
|
|
|
|
|
|
|
if form.getvalue('changeUserServicesId') is not None:
|
|
|
|
if form.getvalue('changeUserServicesId') is not None:
|
|
|
|
user_id = common.checkAjaxInput(form.getvalue('changeUserServicesId'))
|
|
|
|
import modules.roxywi.user as roxy_user
|
|
|
|
services = common.checkAjaxInput(form.getvalue('changeUserServices'))
|
|
|
|
|
|
|
|
user = common.checkAjaxInput(form.getvalue('changeUserServicesUser'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
roxy_user.change_user_services()
|
|
|
|
if sql.update_user_services(services=services, user_id=user_id):
|
|
|
|
|
|
|
|
roxywi_common.logging('Roxy-WI server', f'Access to the services has been updated for user: {user}', roxywi=1, login=1)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
print(e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if form.getvalue('changeUserCurrentGroupId') is not None:
|
|
|
|
if form.getvalue('changeUserCurrentGroupId') is not None:
|
|
|
|
group_id = common.checkAjaxInput(form.getvalue('changeUserCurrentGroupId'))
|
|
|
|
import modules.roxywi.user as roxy_user
|
|
|
|
user_uuid = common.checkAjaxInput(form.getvalue('changeUserGroupsUser'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
roxy_user.change_user_active_group()
|
|
|
|
if sql.update_user_current_groups(group_id, user_uuid):
|
|
|
|
|
|
|
|
print('Ok')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print('error: Cannot change group')
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
print(e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if form.getvalue('getcurrentusergroup') is not None:
|
|
|
|
if form.getvalue('getcurrentusergroup') is not None:
|
|
|
|
|
|
|
|
import modules.roxywi.user as roxy_user
|
|
|
|
|
|
|
|
|
|
|
|
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
|
|
|
cookie = http.cookies.SimpleCookie(os.environ.get("HTTP_COOKIE"))
|
|
|
|
user_id = cookie.get('uuid')
|
|
|
|
user_id = cookie.get('uuid')
|
|
|
|
group = cookie.get('group')
|
|
|
|
group = cookie.get('group')
|
|
|
|
group_id = sql.get_user_id_by_uuid(user_id.value)
|
|
|
|
|
|
|
|
groups = sql.select_user_groups_with_names(group_id)
|
|
|
|
roxy_user.get_user_active_group(user_id, group)
|
|
|
|
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True)
|
|
|
|
|
|
|
|
template = env.get_template('/show_user_current_group.html')
|
|
|
|
|
|
|
|
template = template.render(groups=groups, group=group.value, id=group_id)
|
|
|
|
|
|
|
|
print(template)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if form.getvalue('newsmon') is not None:
|
|
|
|
if form.getvalue('newsmon') is not None:
|
|
|
|
user_group = roxywi_common.get_user_group(id=1)
|
|
|
|
user_group = roxywi_common.get_user_group(id=1)
|
|
|
|