def Update( self, inFulluser=None ): ############################# # ユーザ名がない場合、名前を入力する if inFulluser==None : wStr = gVal.STR_SystemInfo['Client_Name'] + " に再登録するユーザ名を入力します。" + '\n' wStr = wStr + "再登録するユーザ名をドメインを含めて入力してください。 例= " + gVal.DEF_EXAMPLE_ACCOUNT CLS_OSIF.sPrn( wStr ) inFulluser = CLS_OSIF.sInp( "User?=> " ) ############################# # ユーザ名の妥当性チェック wSTR_user = CLS_UserData.sUserCheck( inFulluser ) if wSTR_user['Result']!=True : CLS_OSIF.sPrn( wSTR_user['Reason'] ) return False elif wSTR_user['Registed']==False : CLS_OSIF.sPrn( "そのユーザは登録されていません。: " + inFulluser ) return False ############################# # メールアドレス、パスワードの入力 wStr = '\n' + inFulluser + " を登録します。" wStr = wStr + "mastodonに登録したメールアドレスとパスワードを入力してください。" CLS_OSIF.sPrn( wStr ) ###入力受け付け wMail = CLS_OSIF.sInp( "Mailaddr: " ) wPass = CLS_OSIF.sGpp( "Password: "******"mastodon ID: " + inFulluser + '\n' wStr = wStr + "Mailaddress: " + wMail CLS_OSIF.sPrn( wStr ) wRes = CLS_OSIF.sInp( "以上の内容で登録します(y/N): " ) if wRes!="y" : CLS_OSIF.sPrn( "登録を中止しました" + '\n' ) return False ############################# # 入力チェック wRes = self.__registUser( inFulluser, wMail, wPass ) if wRes['Result']!=True : CLS_OSIF.sPrn( wRes['Reason'] ) return False CLS_OSIF.sPrn( '\n' + "通信テスト中..." ) ############################# # mastodonアクセス前 ping疎通チェック if CLS_OSIF.sPing( wSTR_user['Domain'] )!=True : CLS_OSIF.sPrn( "mastodonサーバ " + wSTR_user['Domain'] + " が応答しません。登録を中止します。" ) return False CLS_OSIF.sPrn( "通信OK" + '\n' + "データ登録中......" ) ############################# # レジストファイルの作りなおし wGetPath = CLS_UserData.sGetUserPath( inFulluser ) if wGetPath['Result']!=True : CLS_OSIF.sPrn( "CLS_Regist: Update: User path ng: " + wGetPath['Reason'] ) return False if CLS_File.sClrFile( wGetPath['Responce'] + gVal.DEF_STR_FILE['Reg_RegFile'] )!=True : CLS_OSIF.sPrn( "CLS_Regist: Update: Reg File is not found: " + wGetPath['Responce'] + gVal.DEF_STR_FILE['Reg_RegFile'] ) return False if CLS_File.sClrFile( wGetPath['Responce'] + gVal.DEF_STR_FILE['Reg_UserFile'] )!=True : CLS_OSIF.sPrn( "CLS_Regist: Update: User File is not found: " + wGetPath['Responce'] + gVal.DEF_STR_FILE['Reg_UserFile'] ) return False ############################# # mastodonアカウントへの関連付け(本レジスト) wRes = CLS_Regist.sRegistMastodon( inFulluser, wMail, wPass ) if wRes['Result']!=True : wStr = "mastodonへの関連付けに失敗しました" + '\n' wStr = wStr + "メールアドレス、パスワード、mastodonが運用中か確認してください。" + '\n' wStr = wStr + wRes['Reason'] CLS_OSIF.sPrn( wStr ) # データ削除 CLS_File.sRmtree( wGetPath['Responce'] ) return False CLS_OSIF.sPrn( "登録OK" + '\n' + "mastodon登録テスト中......" ) ############################# # 通信テスト wRes = self.CreateMastodon( inFulluser ) if wRes['Result']!=True : wStr = "mastodonへの関連付けに失敗しました" + '\n' wStr = wStr + "メールアドレス、パスワード、mastodonが運用中か確認してください。" + '\n' wStr = wStr + wRes['Reason'] CLS_OSIF.sPrn( wStr ) # データ削除 CLS_File.sRmtree( wGetPath['Responce'] ) return False CLS_OSIF.sPrn( "mastodon登録OK" + '\n' ) ############################# # 完了 CLS_OSIF.sPrn( inFulluser + " の再登録が完了しました" + '\n' ) return True
def Regist( self, inFulluser=None ): ############################# # ユーザ名がない場合、名前を入力する if inFulluser==None : wStr = gVal.STR_SystemInfo['Client_Name'] + " に新しいユーザ名を入力します。" + '\n' wStr = wStr + "登録するユーザ名をドメインを含めて入力してください。 例= " + gVal.DEF_EXAMPLE_ACCOUNT CLS_OSIF.sPrn( wStr ) inFulluser = CLS_OSIF.sInp( "User?=> " ) ############################# # ユーザ名の妥当性チェック wSTR_user = CLS_UserData.sUserCheck( inFulluser ) if wSTR_user['Result']!=True : CLS_OSIF.sPrn( wSTR_user['Reason'] ) return False elif wSTR_user['Registed']==True : CLS_OSIF.sPrn( "既に登録されているユーザです。: " + inFulluser ) return False ############################# # メールアドレス、パスワードの入力 wStr = '\n' + inFulluser + " を登録します。" wStr = wStr + "mastodonに登録したメールアドレスとパスワードを入力してください。" CLS_OSIF.sPrn( wStr ) ###入力受け付け wMail = CLS_OSIF.sInp( "Mailaddr: " ) wPass = CLS_OSIF.sGpp( "Password: "******"mastodon ID: " + inFulluser + '\n' wStr = wStr + "Mailaddress: " + wMail CLS_OSIF.sPrn( wStr ) wRes = CLS_OSIF.sInp( "以上の内容で登録します(y/N): " ) if wRes!="y" : CLS_OSIF.sPrn( "登録を中止しました" + '\n' ) return False ############################# # 入力チェック wRes = self.__registUser( inFulluser, wMail, wPass ) if wRes['Result']!=True : CLS_OSIF.sPrn( wRes['Reason'] ) return False CLS_OSIF.sPrn( '\n' + "通信テスト中..." ) ############################# # mastodonアクセス前 ping疎通チェック if CLS_OSIF.sPing( wSTR_user['Domain'] )!=True : CLS_OSIF.sPrn( "mastodonサーバ " + wSTR_user['Domain'] + " が応答しません。登録を中止します。" ) return False CLS_OSIF.sPrn( "通信OK" + '\n' + "データ登録中......" ) ############################# # テンプレートデータのコピー(データ作成) wGetPath = CLS_UserData.sGetUserPath( inFulluser ) ## if wGetPath['Result']!=True : ## CLS_OSIF.sPrn( "CLS_Regist: Regist: User path ng: " + wGetPath['Reason'] ) ## return False if CLS_File.sCopytree( gVal.DEF_STR_FILE['defUserdata_path'], wGetPath['Responce'] )!=True : ###ありえない CLS_OSIF.sPrn( "CLS_Regist: Regist: defaultデータコピー失敗" ) return False if CLS_File.sFolderExist( gVal.DEF_USERDATA_PATH, inFulluser )!=True : CLS_OSIF.sPrn( "CLS_Regist: Regist: ユーザデータの登録に失敗しました" ) return False ############################# # mastodonアカウントへの関連付け(本レジスト) wRes = self.sRegistMastodon( inFulluser, wMail, wPass ) if wRes['Result']!=True : wStr = "mastodonへの関連付けに失敗しました" + '\n' wStr = wStr + "メールアドレス、パスワード、mastodonが運用中か確認してください。" + '\n' wStr = wStr + wRes['Reason'] CLS_OSIF.sPrn( wStr ) # データ削除 CLS_File.sRmtree( wGetPath['Responce'] ) return False CLS_OSIF.sPrn( "登録OK" + '\n' + "mastodon登録テスト中......" ) ############################# # 通信テスト wRes = self.CreateMastodon( inFulluser ) if wRes['Result']!=True : wStr = "mastodonへの関連付けに失敗しました" + '\n' wStr = wStr + "メールアドレス、パスワード、mastodonが運用中か確認してください。" + '\n' wStr = wStr + wRes['Reason'] CLS_OSIF.sPrn( wStr ) # データ削除 CLS_File.sRmtree( wGetPath['Responce'] ) return False CLS_OSIF.sPrn( "mastodon登録OK" + '\n' ) ############################# # cron作成 if inFulluser == gVal.STR_MasterConfig['MasterUser'] : wKind = gVal.DEF_CRON_MASTER else: wKind = gVal.DEF_CRON_SUB wCLS_botjib = CLS_Botjob() wPutRes = wCLS_botjib.Put( wKind, inFulluser ) if wPutRes['Result']!=True : ## CLS_OSIF.sPrn( "CLS_Regist: Regist: cron create failed: " + wPutRes['Reason'] ) ## return False ## ## CLS_OSIF.sPrn( '\n' + "cronを起動しました" ) CLS_OSIF.sPrn( "cronの起動に失敗しました: " + wPutRes['Reason'] ) else : CLS_OSIF.sPrn( '\n' + "cronを起動しました" ) ############################# # トラヒックの登録 wRes = self.__regTrafficUser( inFulluser ) if wRes['Result']!=True : CLS_OSIF.sPrn( "CLS_Regist: Regist: " + wRes['Reason'] ) return False if wRes['Update']==True : CLS_OSIF.sPrn( "DBにトラヒック情報が追加されました" ) ############################# # 完了 CLS_OSIF.sPrn( inFulluser + " の登録が完了しました" + '\n' ) return True