| 33 | |
| 34 | # 设置用户状态 |
| 35 | def 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 | |
| 57 | def FtpReload(): |