sync with gateway moved to defs
This commit is contained in:
parent
018f075b66
commit
96188f0310
@ -71,7 +71,10 @@ class DocType:
|
||||
pr.save(1)
|
||||
|
||||
# Update Membership Type at Gateway
|
||||
if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
if 'System Manager' in role_list : membership_type = 'Administrator'
|
||||
else : membership_type = 'Member'
|
||||
|
||||
|
@ -54,7 +54,10 @@ def delete_user(args):
|
||||
args = json.loads(args)
|
||||
webnotes.conn.sql("update tabProfile set enabled=0, docstatus=2 where name=%s", args['user'])
|
||||
# erpnext-saas
|
||||
if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
from server_tools.gateway_utils import remove_user_gateway
|
||||
remove_user_gateway(args['user'])
|
||||
|
||||
@ -65,7 +68,10 @@ def delete_user(args):
|
||||
def add_user(args):
|
||||
args = json.loads(args)
|
||||
# erpnext-saas
|
||||
if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
from server_tools.gateway_utils import add_user_gateway
|
||||
add_user_gateway(args)
|
||||
|
||||
@ -183,7 +189,10 @@ def update_security(args=''):
|
||||
webnotes.conn.set_value('Profile', args['user'], 'login_before', args.get('login_before'))
|
||||
|
||||
if 'new_password' in args:
|
||||
if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
import server_tools.gateway_utils
|
||||
res = server_tools.gateway_utils.change_password('', args['new_password'], args['user'], args['sys_admin_pwd'])
|
||||
if 'Traceback' not in res['message']:
|
||||
|
@ -27,8 +27,11 @@ def change_password(arg):
|
||||
|
||||
if not webnotes.conn.sql('select name from tabProfile where name=%s and password=password(%s)', (webnotes.session['user'], arg['old_password'])):
|
||||
webnotes.msgprint('Old password is not correct', raise_exception=1)
|
||||
|
||||
if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
|
||||
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
import server_tools.gateway_utils
|
||||
webnotes.msgprint(server_tools.gateway_utils.change_password(arg['old_password'], arg['new_password'])['message'])
|
||||
|
||||
|
@ -26,9 +26,11 @@ def on_login(login_manager):
|
||||
if login_manager.user not in ('Guest', None, '') and webnotes.conn.cur_db_name!='accounts' and webnotes.conn.get_value('Control Panel', 'Control Panel', 'account_id')!='s5u011':
|
||||
try:
|
||||
login_manager = login_as(login_manager)
|
||||
update_account_details()
|
||||
import server_tools.gateway_utils
|
||||
server_tools.gateway_utils.check_login(login_manager.user)
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
update_account_details()
|
||||
import server_tools.gateway_utils
|
||||
server_tools.gateway_utils.check_login(login_manager.user)
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
@ -157,6 +159,8 @@ def update_account_details():
|
||||
# logout the user from SSO
|
||||
#
|
||||
def on_logout(login_manager):
|
||||
if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
|
||||
import webnotes.defs
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
from server_tools.gateway_utils import logout_sso
|
||||
logout_sso(user=login_manager.user)
|
||||
|
@ -83,7 +83,10 @@ def update_security(args=''):
|
||||
webnotes.conn.set_value('Profile', args['user'], 'enabled', int(args.get('enabled',0)) or 0)
|
||||
|
||||
if args.get('new_password') and args.get('sys_admin_pwd'):
|
||||
if cint(webnotes.conn.get_value('Control Panel',None,'sync_with_gateway')):
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
import server_tools.gateway_utils
|
||||
res = server_tools.gateway_utils.change_password('', args['new_password'],
|
||||
args['user'], args['sys_admin_pwd'])
|
||||
@ -104,7 +107,10 @@ def update_security(args=''):
|
||||
def add_user(args):
|
||||
args = json.loads(args)
|
||||
# erpnext-saas
|
||||
if cint(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
from server_tools.gateway_utils import add_user_gateway
|
||||
add_user_gateway(args)
|
||||
|
||||
@ -169,7 +175,10 @@ def delete(arg=None):
|
||||
webnotes.conn.sql("update tabProfile set enabled=0, docstatus=2 where name=%s",
|
||||
webnotes.form_dict['uid'])
|
||||
# erpnext-saas
|
||||
if int(webnotes.conn.get_value('Control Panel', None, 'sync_with_gateway')):
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
from server_tools.gateway_utils import remove_user_gateway
|
||||
remove_user_gateway(webnotes.form_dict['uid'])
|
||||
|
||||
|
@ -1 +1 @@
|
||||
964
|
||||
969
|
Loading…
x
Reference in New Issue
Block a user