MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / SetStatus

Function SetStatus

script/site_task.py:35–54  ·  view source on GitHub ↗
(get)

Source from the content-addressed store, hash-verified

33
34# 设置用户状态
35def SetStatus(get):
36 msg = public.getMsg('OFF')
37 if get.status != '0': msg = public.getMsg('ON')
38 username = 'Unknown'
39 try:
40 id = get['id']
41 username = get['username']
42 status = get['status']
43 runPath = '/www/server/pure-ftpd/bin'
44 if int(status) == 0:
45 public.ExecShell(runPath + '/pure-pw usermod ' + username + ' -r 1')
46 else:
47 public.ExecShell(runPath + '/pure-pw usermod ' + username + " -r ''")
48 FtpReload()
49 public.M('ftps').where("id=?", (id,)).setField('status', status)
50 public.WriteLog('TYPE_FTP', 'FTP_STATUS', (msg, username))
51 return public.returnMsg(True, 'SUCCESS')
52 except Exception as ex:
53 public.WriteLog('TYPE_FTP', 'FTP_STATUS_ERR', (msg, username, str(ex)))
54 return public.returnMsg(False, 'FTP_STATUS_ERR', (msg,))
55
56
57def FtpReload():

Callers 1

site_task.pyFile · 0.85

Calls 6

FtpReloadFunction · 0.85
ExecShellMethod · 0.80
returnMsgMethod · 0.80
setFieldMethod · 0.45
whereMethod · 0.45
MMethod · 0.45

Tested by

no test coverage detected