Esempio n. 1
0
    def processOfRequest(self, tenant):
        try:
            if self.isValidTenant(not_redirect=True) == False:
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
                self.responseAjaxResult()
                return

            if loginfunc.checkLogin(self, not_redirect=True) == False:
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            # ���O�C�����̊e������擾���`�F�b�N
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if is_select_ok == False:
                self._code = 403
                self._msg = error_msg
                self.responseAjaxResult()
                return


#			if self.isAdmin() == False:
#				self._code = 403
#				self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
#				self.responseAjaxResult(ret_value)
#				return

# Request����vo�ɃZ�b�g
            req = UcfVoInfo.setRequestToVo(self)
            logging.info(req)

            # �Z�b�V�����L�[
            session_key = UcfUtil.nvl(
                self.getRequest(UcfConfig.REQUESTKEY_SESSION_SCID))

            # �G���[��Ԃ�
            if session_key == '':
                self._code = 100
                self._msg = self.getMsg('MSG_INVALID_PARAMETER',
                                        (UcfConfig.REQUESTKEY_SESSION_SCID))
                self.responseAjaxResult()
                return

            scond = req  # TODO

            # �����������Z�b�g
            self.setSession(
                UcfConfig.SESSIONKEY_PREFIX_SEARCHCOND + session_key, scond)
            self._code = 0
            self.responseAjaxResult()

        except BaseException, e:
            self.outputErrorLog(e)
            self._code = 999
            self.responseAjaxResult()
Esempio n. 2
0
    def processOfRequest(self, tenant):
        try:
            if not self.isValidTenant(not_redirect=True):
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
                self.responseAjaxResult()
                return

            if not loginfunc.checkLogin(self, not_redirect=True):
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if not is_select_ok:
                self._code = 403
                self._msg = error_msg
                self.responseAjaxResult()
                return

            if not self.isAdmin():
                self._code = 403
                self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
                self.responseAjaxResult()
                return

            # Javascriptから、パラメータ取得
            req = UcfVoInfo.setRequestToVo(self)
            unique_id = req['more_config_unqid']
            ip_address = req['ip_address'].split(',')
            sort_order = req['sort_order']

            FAQMoreConfig.updateMoreConfig(unique_id, sort_order, ip_address)

            operation_log_detail = req
            UCFMDLOperationLog.addLog(
                self.getLoginOperatorMailAddress(),
                self.getLoginOperatorUniqueID(), UcfConfig.SCREEN_DASHBOARD,
                UcfConfig.OPERATION_TYPE_MODIFY_MORE_CONFIG, '', '',
                self.getClientIPAddress(),
                JSONEncoder().encode(operation_log_detail))

            self._code = 0
            self.responseAjaxResult()

        except BaseException, e:
            self.outputErrorLog(e)
            self.responseAjaxResult()
Esempio n. 3
0
    def processOfRequest(self, tenant):
        try:
            if self.isValidTenant(not_redirect=True) == False:
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
                self.responseAjaxResult()
                return

            if loginfunc.checkLogin(self, not_redirect=True) == False:
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if is_select_ok == False:
                self._code = 403
                self._msg = error_msg
                self.responseAjaxResult()
                return

            if self.isAdmin() == False and self.isOperator(target_function=[
                    UcfConfig.DELEGATE_FUNCTION_OPERATOR_CONFIG
            ]) == False:
                self._code = 403
                self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
                self.responseAjaxResult()
                return

            # Requestからvoにセット
            req = UcfVoInfo.setRequestToVo(self)

            unique_id = req['unique_id']

            ret_value = {}
            # タスク履歴取得
            entry = TaskChangeIDUtils.getData(self, unique_id)
            if entry:
                vo = entry.exchangeVo(self._timezone)
                TaskChangeIDUtils.editVoForSelect(self, vo)
                ret_value['log_text'] = vo['log_text']
            self._code = 0
            self.responseAjaxResult(ret_value)

        except BaseException, e:
            self.outputErrorLog(e)
            self._code = 999
            self.responseAjaxResult()
Esempio n. 4
0
	def processOfRequest(self, tenant):
		try:
			if self.isValidTenant(not_redirect=True) == False:
				self._code = 400
				self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
				self.responseAjaxResult()
				return

			if loginfunc.checkLogin(self, not_redirect=True) == False:
				self._code = 403
				self._msg = self.getMsg('MSG_NOT_LOGINED')
				self.responseAjaxResult()
				return

			# ログイン時の各種情報を取得&チェック
			is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(self, not_redirect=True)
			if is_select_ok == False:
				self._code = 403
				self._msg = error_msg
				self.responseAjaxResult()
				return

#			if self.isAdmin() == False:
#				self._code = 403
#				self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
#				self.responseAjaxResult(ret_value)
#				return

			# Requestからvoにセット
			req = UcfVoInfo.setRequestToVo(self)

			leftmenu_class = UcfUtil.nvl(self.getRequest('leftmenu_class'))

			# エラーを返す
			if leftmenu_class == '':
				self._code = 100
				self._msg = self.getMsg('MSG_INVALID_PARAMETER', ('leftmenu_class'))
				self.responseAjaxResult()
				return

			# Cookieにセット
			self.setCookie(UcfConfig.COOKIEKEY_LEFTMENUCLASS, leftmenu_class)
			self._code = 0
			self.responseAjaxResult()

		except BaseException, e:
			self.outputErrorLog(e)
			self._code = 999
			self.responseAjaxResult()
Esempio n. 5
0
    def processOfRequest(self, tenant):
        try:
            if self.isValidTenant(not_redirect=True) == False:
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
                self.responseAjaxResult()
                return

            if loginfunc.checkLogin(self, not_redirect=True) == False:
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            # ���O�C�����̊e������擾���`�F�b�N
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if is_select_ok == False:
                self._code = 403
                self._msg = error_msg
                self.responseAjaxResult()
                return

            if self.isAdmin() == False and self.isOperator() == False:
                self._code = 403
                self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
                self.responseAjaxResult()
                return

            # Request����vo�ɃZ�b�g
            req = UcfVoInfo.setRequestToVo(self)

            unique_id = req['unique_id']

            ret_value = {}
            # �t�@�C���擾
            entry = FileUtils.getData(self, unique_id)
            if entry:
                vo = entry.exchangeVo(self._timezone)
                FileUtils.editVoForSelect(self, vo)
                ret_value['log_text'] = vo['log_text']
            self._code = 0
            self.responseAjaxResult(ret_value)

        except BaseException, e:
            self.outputErrorLog(e)
            self._code = 999
            self.responseAjaxResult()
Esempio n. 6
0
    def processOfRequest(self, tenant):
        try:
            self._approot_path = os.path.dirname(__file__)
            if self.isValidTenant() == False:
                return

            if loginfunc.checkLogin(self) == False:
                return

            # 権限チェック
            if self.isAdmin() == False and self.isOperator(
                    target_function=UcfConfig.DELEGATE_FUNCTION_OPERATOR_CONFIG
            ) == False:
                #				self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')))
                self.redirect('/a/' + tenant + '/personal/')
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self)
            if is_select_ok == False:
                return
            # パスワード次回変更フラグをチェック
            if self.checkForcePasswordChange() == False:
                return

            ucfp = UcfTenantParameter(self)
            ucfp.data['gnaviid'] = _gnaviid
            ucfp.data['leftmenuid'] = _leftmenuid
            ucfp.data['explains'] = [
                self.getMsg('EXPLAIN_LOGINHISTORY_HEADER')
            ]

            template_vals = {
                'ucfp': ucfp,
            }
            self.appendBasicInfoToTemplateVals(template_vals)

            self.render('acs_log.html', self._design_type, template_vals)
        except BaseException, e:
            self.outputErrorLog(e)
            self.redirectError(
                UcfMessage.getMessage(self.getMsg('MSG_SYSTEM_ERROR'), ()))
            return
Esempio n. 7
0
    def processOfRequest(self, tenant):
        try:
            self._approot_path = os.path.dirname(__file__)
            if self.isValidTenant() == False:
                return

            if loginfunc.checkLogin(self) == False:
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self)
            if is_select_ok == False:
                return

            # 自動遷移先URLが指定されていたらリダイレクト
            if ucffunc.redirectAutoRedirectURL(self,
                                               profile_vo,
                                               is_force_deal=True):
                return

            ucfp = UcfTenantParameter(self)

            template_vals = {
                'ucfp':
                ucfp,
                'is_hide_backstretch':
                self._career_type == UcfConfig.
                VALUE_CAREER_TYPE_TABLET,  # アクセス申請用ログイン画面でタブレットの場合はそもそも出さない
            }
            self.appendBasicInfoToTemplateVals(template_vals)

            self.render('personal_minfo_thanks.html', self._design_type,
                        template_vals)
        except BaseException, e:
            self.outputErrorLog(e)
            self.redirectError(
                UcfMessage.getMessage(self.getMsg('MSG_SYSTEM_ERROR'), ()))
            return
Esempio n. 8
0
	def processOfRequest(self, tenant):

		try:
			self._approot_path = os.path.dirname(__file__)
			if self.isValidTenant() == False:
				return

			if loginfunc.checkLogin(self) == False:
				return

			# 権限チェック
			if self.isAdmin() == False and self.isOperator() == False:
				self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')))
				return

			# ログイン時の各種情報を取得&チェック
			is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(self, not_check_target_env=True)		# not_check_target_env=True…BlobstoreUploadHandlerの影響か、クライアントIPが変更されてしまうためネットワークや環境のチェックはしない
			if is_select_ok == False:
				return

			blob_key = self.getRequest('key')

			blob_key = str(urllib.unquote(blob_key)) 

			# BlobKeyを指定してファイルを取得
			blob_info = blobstore.BlobInfo.get(blob_key)

			if blob_info.content_type == 'application/vnd.ms-excel':
				self.response.charset = UcfConfig.DL_ENCODING
				self.setResponseHeaderForDownload('test.csv', UcfConfig.DL_ENCODING)

			# 結果をクライアントに返す
			self.send_blob(blob_info)

		except BaseException, e:
			self.outputErrorLog(e)
#			self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_SYSTEM_ERROR'), ()))
			return
Esempio n. 9
0
    def processOfRequest(self, tenant):

        CSRF_TOKEN_KEY = 'operator'

        try:
            self._approot_path = os.path.dirname(__file__)
            if self.isValidTenant() == False:
                return

            if loginfunc.checkLogin(self) == False:
                return

            # 権限チェック
            if self.isAdmin() == False and self.isOperator(
                    target_function=UcfConfig.DELEGATE_FUNCTION_OPERATOR_CONFIG
            ) == False:
                #				self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')))
                self.redirect('/a/' + tenant + '/personal/')
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self)
            if is_select_ok == False:
                return
            # パスワード次回変更フラグをチェック
            if self.checkForcePasswordChange() == False:
                return

            # Requestからvoにセット
            req = UcfVoInfo.setRequestToVo(self)

            # ブラウザによる「employee_id」と「password」の自動セットを防止するため、「employee_id」が空の場合にダミーの空白をセットしておく(小細工... ここでクリア) 2015.09.01
            # 念のためTRIM
            #if req.get('employee_id', '') == '\t':
            #	req['employee_id'] = ''
            #if req.has_key('employee_id'):
            #	req['employee_id'] = req['employee_id'].strip()
            if req.has_key('federation_identifier'):
                req['federation_identifier'] = req[
                    'federation_identifier'].strip()

            # チェックボックス値補正(TODO 本来はフロントからPOSTするようにExtJsなどで処理すべきが取り急ぎ)
            OperatorUtils.setNotPostValue(self, req)

            # 新規 or 編集 or 削除
            edit_type = UcfUtil.getHashStr(req, UcfConfig.QSTRING_TYPE)
            # コピー新規
            edit_type2 = UcfUtil.getHashStr(req, UcfConfig.QSTRING_TYPE2)
            # ステータス
            edit_status = UcfUtil.getHashStr(req, UcfConfig.QSTRING_STATUS)
            # ユニークキー
            unique_id = UcfUtil.getHashStr(req, UcfConfig.QSTRING_UNIQUEID)
            if (edit_type == UcfConfig.EDIT_TYPE_RENEW
                    or edit_type == UcfConfig.EDIT_TYPE_DELETE or edit_type2
                    == UcfConfig.EDIT_TYPE_COPYNEWREGIST) and unique_id == '':
                self.redirectError(
                    UcfMessage.getMessage(self.getMsg('MSG_INVALID_ACCESS')))
                return

            ucfp = UcfTenantParameter(self)
            vo = {}
            entry_vo = {}
            if edit_status == UcfConfig.VC_CHECK:

                # CSRF対策:トークンチェック
                if not self.checkCSRFToken(
                        CSRF_TOKEN_KEY +
                    (unique_id if
                     edit_type2 != UcfConfig.EDIT_TYPE_COPYNEWREGIST else ''),
                        self.request.get(UcfConfig.REQUESTKEY_CSRF_TOKEN)):
                    self.redirectError(
                        UcfMessage.getMessage(self.getMsg('MSG_CSRF_CHECK')))
                    return

                # 削除処理の場合
                if edit_type == UcfConfig.EDIT_TYPE_DELETE:
                    entry = OperatorUtils.getData(self, unique_id)
                    if entry is None:
                        self.redirectError(
                            UcfMessage.getMessage(
                                self.getMsg('MSG_NOT_EXIST_DATA')))
                        return
                    entry_vo = entry.exchangeVo(self._timezone)  # 既存データをVoに変換
                    # 委託管理者の場合は自分がアクセスできる管理グループかをチェック
                    if self.isOperator(
                    ) and not ucffunc.isDelegateTargetManagementGroup(
                            UcfUtil.getHashStr(entry_vo, 'management_group'),
                            UcfUtil.csvToList(
                                self.getLoginOperatorDelegateManagementGroups(
                                ))):
                        self.redirectError(
                            UcfMessage.getMessage(
                                self.getMsg(
                                    'MSG_INVALID_ACCESS_BY_DELEGATE_MANAGEMENT_GROUPS'
                                )))
                        return

                    # このユーザを所属メンバーに持つグループからメンバーを削除
                    OperatorGroupUtils.removeOneMemberFromBelongGroups(
                        self, UcfUtil.getHashStr(entry_vo,
                                                 'operator_id_lower'))
                    ## このユーザを所属メンバーに持つ組織からメンバーを削除
                    #OrgUnitUtils.removeMemberFromBelongOrgUnits(self, [UcfUtil.getHashStr(entry_vo, 'operator_id_lower')], None)
                    # 削除(※トランザクションは制約やデメリットが多いので使用しない)
                    entry.delete()
                    ## ユーザー数キャッシュをクリア
                    #UCFMDLOperator.clearActiveUserAmountCache(tenant)
                    # オペレーションログ出力
                    UCFMDLOperationLog.addLog(
                        self.getLoginOperatorMailAddress(),
                        self.getLoginOperatorUniqueID(),
                        UcfConfig.SCREEN_OPERATOR,
                        UcfConfig.OPERATION_TYPE_REMOVE,
                        entry_vo.get('operator_id', ''),
                        entry_vo.get('unique_id',
                                     ''), self.getClientIPAddress(), '')
                    # 処理後一覧ページに遷移
                    # ダッシュボードに遷移に変更
                    #self.redirect('/a/' + self._tenant + '/operator/')
                    self.redirect('/a/' + self._tenant + '/')
                    return

                # 新規登録の場合
                elif edit_type == UcfConfig.EDIT_TYPE_NEW:
                    # RequestからVoを作成
                    UcfUtil.margeHash(vo, req)  # Requestからの情報をVoにマージ
                    # パスワード更新フラグによってパスワード上書きするかどうかの制御
                    if UcfUtil.getHashStr(vo,
                                          'PasswordUpdateFlag') != 'UPDATE':
                        vo['password'] = ''
                    #if UcfUtil.getHashStr(vo, 'Password1UpdateFlag') != 'UPDATE':
                    #	vo['password1'] = ''
                    #if UcfUtil.getHashStr(vo, 'MatrixAuthPinCodeUpdateFlag') != 'UPDATE':
                    #	vo['matrixauth_pin_code'] = ''

                # 編集の場合
                elif edit_type == UcfConfig.EDIT_TYPE_RENEW:
                    entry = OperatorUtils.getData(self, unique_id)
                    if entry is None:
                        self.redirectError(
                            UcfMessage.getMessage(
                                self.getMsg('MSG_NOT_EXIST_DATA')))
                        return

                    entry_vo = entry.exchangeVo(self._timezone)  # 既存データをVoに変換
                    OperatorUtils.editVoForSelect(
                        self, entry_vo,
                        is_with_parent_group_info=True)  # データ加工(取得用)
                    UcfUtil.margeHash(vo, entry_vo)  # 既存データをVoにコピー
                    UcfUtil.margeHash(vo, req)  # Requestからの情報をVoにマージ
                    # パスワード更新フラグによってパスワード上書きするかどうかの制御
                    if UcfUtil.getHashStr(vo,
                                          'PasswordUpdateFlag') != 'UPDATE':
                        vo['password'] = entry_vo['password']
                    #if UcfUtil.getHashStr(vo, 'Password1UpdateFlag') != 'UPDATE':
                    #	vo['password1'] = entry_vo['password1']
                    #if UcfUtil.getHashStr(vo, 'MatrixAuthPinCodeUpdateFlag') != 'UPDATE':
                    #	vo['matrixauth_pin_code'] = entry_vo['matrixauth_pin_code']

                else:
                    # エラーページに遷移
                    self.redirectError(
                        UcfMessage.getMessage(
                            self.getMsg('MSG_INVALID_ACCESS')))
                    return

                # 入力チェック
                vc = OperatorValidator(
                    edit_type,
                    self.isOperator()
                    and self.getLoginOperatorDelegateManagementGroups() != '',
                    self.getLoginOperatorDelegateManagementGroups().split(',')
                    if self.getLoginOperatorDelegateManagementGroups() != ''
                    else None)
                # AD連携パスワード桁数制御撤廃対応:一環でパスワード更新時以外はパスワードチェックしないように対応 2017.03.17
                is_without_password_check = UcfUtil.getHashStr(
                    vo, 'PasswordUpdateFlag') != 'UPDATE'
                vc.validate(
                    self,
                    vo,
                    self.getLoginOperatorMailAddress(),
                    is_without_password_check=is_without_password_check)
                ucfp.voinfo.validator = vc
                # 入力エラーがなければ登録処理
                if ucfp.voinfo.validator.total_count <= 0:

                    # 更新日時チェック(編集時のみ)
                    if edit_type == UcfConfig.EDIT_TYPE_RENEW and not self.checkDateChanged(
                            entry):
                        # エラーページに遷移
                        self.redirectError(
                            UcfMessage.getMessage(
                                self.getMsg('MSG_ALREADY_UPDATED_DATA')))
                        return

                    # オペレーションログ詳細用に更新フィールドを取得(加工前に比較しておく)
                    if edit_type == UcfConfig.EDIT_TYPE_NEW:
                        is_diff = True
                        diff_for_operation_log = []
                    else:
                        is_diff, diff_for_operation_log = OperatorUtils.isDiff(
                            self, vo, entry_vo)

                    # 加工データ
                    OperatorUtils.editVoForRegist(self, vo, entry_vo,
                                                  edit_type)

                    # 新規登録場合モデルを新規作成
                    if edit_type == UcfConfig.EDIT_TYPE_NEW:
                        unique_id = UcfUtil.guid()
                        vo['unique_id'] = unique_id
                        entry = UCFMDLOperator(unique_id=unique_id,
                                               id=OperatorUtils.getKey(
                                                   self, vo))

                    # Voからモデルにマージ
                    entry.margeFromVo(vo, self._timezone)

                    # 更新日時、更新者の更新
                    entry.updater_name = UcfUtil.nvl(self.getLoginID())
                    entry.date_changed = UcfUtil.getNow()

                    # 新規登録場合ユニークIDを生成
                    if edit_type == UcfConfig.EDIT_TYPE_NEW:
                        # 作成日時、作成者の更新
                        entry.creator_name = UcfUtil.nvl(self.getLoginID())
                        entry.date_created = UcfUtil.getNow()

                    ########################
                    # 親グループ
                    parent_groups = []
                    parent_group_info = OperatorUtils.getParentGroupInfoFromRequest(
                        vo)
                    if parent_group_info is not None:
                        for member in parent_group_info:
                            parent_groups.append(
                                UcfUtil.getHashStr(member,
                                                   'MailAddress').lower())

                    # 親グループ情報を更新
                    add_groups, del_groups = OperatorGroupUtils.setOneUserToBelongGroups(
                        self, UcfUtil.getHashStr(vo, 'operator_id_lower'),
                        parent_groups)
                    # 更新処理(※トランザクションは制約やデメリットが多いので使用しない)
                    entry.put()
                    # UserEntryにレコード追加
                    sateraito_func.addUpdateUserEntryTaskQueue(tenant, entry)
                    ## ユーザー数キャッシュをクリア
                    #if edit_type == UcfConfig.EDIT_TYPE_NEW:
                    #	UCFMDLOperator.clearActiveUserAmountCache(tenant)

                    # オペレーションログ出力
                    operation_log_detail = {}
                    if edit_type == UcfConfig.EDIT_TYPE_RENEW:
                        operation_log_detail['fields'] = diff_for_operation_log
                    operation_log_detail['add_groups'] = add_groups
                    if edit_type == UcfConfig.EDIT_TYPE_RENEW:
                        operation_log_detail['del_groups'] = del_groups
                    UCFMDLOperationLog.addLog(
                        self.getLoginOperatorMailAddress(),
                        self.getLoginOperatorUniqueID(),
                        UcfConfig.SCREEN_OPERATOR, UcfConfig.OPERATION_TYPE_ADD
                        if edit_type == UcfConfig.EDIT_TYPE_NEW else
                        UcfConfig.OPERATION_TYPE_MODIFY,
                        vo.get('operator_id', ''), vo.get('unique_id', ''),
                        self.getClientIPAddress(),
                        JSONEncoder().encode(operation_log_detail))

                    # 処理後一覧ページに遷移
                    # ダッシュボードに遷移に変更
                    #self.redirect('/a/' + self._tenant + '/operator/')
                    self.redirect('/a/' + self._tenant + '/')
                    return

                # 入力エラーがあれば画面に戻る
                else:

                    for k, v in vc.msg.iteritems():
                        logging.info(k)
                        logging.info(v)

                    ucfp.voinfo.setVo(vo, OperatorViewHelper(), None, self)

            # 初回表示
            else:
                # コピー新規
                if edit_type2 == UcfConfig.EDIT_TYPE_COPYNEWREGIST:
                    entry = OperatorUtils.getData(self, unique_id)
                    if entry is None:
                        self.redirectError(
                            UcfMessage.getMessage(
                                self.getMsg('MSG_NOT_EXIST_DATA')))
                        return

                    vo = entry.exchangeVo(self._timezone)  # 既存データをVoに変換
                    OperatorUtils.editVoForSelect(
                        self, vo, is_with_parent_group_info=True)  # データ加工(取得用)

                    # コピー新規なので不要なデータを削除
                    OperatorUtils.removeFromVoForCopyRegist(self, vo)

                    ucfp.voinfo.setVo(vo, None, None, self)

                else:
                    # 新規
                    if edit_type == UcfConfig.EDIT_TYPE_NEW:
                        OperatorUtils.editVoForDefault(self, vo)  # データ加工(初期値用)
                    # 編集
                    elif edit_type == UcfConfig.EDIT_TYPE_RENEW:
                        entry = OperatorUtils.getData(self, unique_id)
                        if entry is None:
                            self.redirectError(
                                UcfMessage.getMessage(
                                    self.getMsg('MSG_NOT_EXIST_DATA')))
                            return

                        vo = entry.exchangeVo(self._timezone)  # 既存データをVoに変換
                        OperatorUtils.editVoForSelect(
                            self, vo,
                            is_with_parent_group_info=True)  # データ加工(取得用)

                        # 委託管理者の場合は自分がアクセスできる管理グループかをチェック
                        if self.isOperator(
                        ) and not ucffunc.isDelegateTargetManagementGroup(
                                UcfUtil.getHashStr(vo, 'management_group'),
                                UcfUtil.csvToList(
                                    self.
                                    getLoginOperatorDelegateManagementGroups())
                        ):
                            self.redirectError(
                                UcfMessage.getMessage(
                                    self.getMsg(
                                        'MSG_INVALID_ACCESS_BY_DELEGATE_MANAGEMENT_GROUPS'
                                    )))
                            return

                    else:
                        # エラーページに遷移
                        self.redirectError(
                            UcfMessage.getMessage(
                                self.getMsg('MSG_INVALID_ACCESS')))
                        return

                    ucfp.voinfo.setVo(vo, None, None, self)

            # ブラウザによる「employee_id」と「password」の自動セットを防止するため、「employee_id」が空の場合にダミーの空白をセットしておく(小細工... ↑とFocus時にクリア) 2015.09.01
            #if vo is not None and vo.get('employee_id', '') == '':
            #	vo['employee_id'] = '\t'
            #if vo is not None and vo.get('federation_identifier', '') == '':
            #	vo['federation_identifier'] = '\t'
            # CSRF対策:トークン発行
            ucfp.data['token'] = self.createCSRFToken(CSRF_TOKEN_KEY + (
                unique_id
                if edit_type2 != UcfConfig.EDIT_TYPE_COPYNEWREGIST else ''))

            ucfp.data['gnaviid'] = _gnaviid
            ucfp.data['leftmenuid'] = _leftmenuid
            ucfp.data['explains'] = [self.getMsg('EXPLAIN_OPERATOR_HEADER')]
            ucfp.data[UcfConfig.QSTRING_TYPE] = UcfUtil.nvl(
                self.getRequest(UcfConfig.QSTRING_TYPE))

            # マルチドメイン時のドメインリストを作成
            #domain_list = []
            #domain_list.extend(UcfUtil.csvToList(UcfUtil.getHashStr(self.getDeptInfo(), 'federated_domains')))
            #domain_list = sateraito_func.getFederatedDomainList(self._tenant, is_with_cache=True)

            # 言語一覧
            language_list = []
            for language in sateraito_func.ACTIVE_LANGUAGES:
                language_list.append([
                    language,
                    self.getMsg(
                        sateraito_func.LANGUAGES_MSGID.get(language, ''))
                ])

            template_vals = {
                'ucfp':
                ucfp,
                'vcmsg':
                ucfp.voinfo.validator.msg
                if ucfp.voinfo.validator != None else {},
                'is_exist_delegate_management_groups':
                True if len(
                    UcfUtil.csvToList(
                        self.getLoginOperatorDelegateManagementGroups())) > 0
                else False,
                #'is_multidomain':True if len(domain_list) > 1 else False,
                #'domain_list':JSONEncoder().encode(domain_list),
                'language_list':
                JSONEncoder().encode(language_list)
            }
            self.appendBasicInfoToTemplateVals(template_vals)

            self.render('operator_regist.html', self._design_type,
                        template_vals)
        except BaseException, e:
            self.outputErrorLog(e)
            self.redirectError(
                UcfMessage.getMessage(self.getMsg('MSG_SYSTEM_ERROR'), ()))
            return
Esempio n. 10
0
    def processOfRequest(self, tenant):

        logging.info('**** requests *********************')
        logging.info(self.request)

        try:
            if self.isValidTenant(not_redirect=True) is False:
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
                self.responseAjaxResult()
                return

            if loginfunc.checkLogin(self, not_redirect=True) is False:
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if is_select_ok is False:
                self._code = 403
                self._msg = error_msg
                self.responseAjaxResult()
                return

            if self.isAdmin() is False:
                self._code = 403
                self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
                self.responseAjaxResult()
                return

            # Requestからvoにセット
            req = UcfVoInfo.setRequestToVo(self)
            # logging.info(req)

            unique_id = UcfUtil.getHashStr(req, 'unique_id')
            channel_kind = UcfUtil.getHashStr(req, 'channel_kind')
            channel_config = UcfUtil.getHashStr(req, 'channel_config')

            channel_config_jsondata = json.JSONDecoder().decode(channel_config)
            open_api_id = channel_config_jsondata['open_api_id']
            consumer_key = channel_config_jsondata['consumer_key']
            server_id = channel_config_jsondata['server_id']
            priv_key = channel_config_jsondata['priv_key']
            domain_id = channel_config_jsondata['domain_id']

            edit_type = self.request.get('edit_type')
            bot_no = self.request.get('bot_no')
            bot_name = self.request.get('bot_name')
            bot_description = self.request.get('bot_description')
            bot_photourl = self.request.get('bot_photourl')
            if unique_id:
                bot_url = self.request.get('bot_url')
            else:
                unique_id = UcfUtil.guid()
                bot_url = sateraito_inc.my_site_url + '/webhook/' + self._tenant + '/' + unique_id
            bot_manager = self.request.get('bot_manager')
            richmenu_id = FileUpSettingConfig.getRichMenuId(channel_kind)

            # 入力チェック
            if open_api_id == '' or consumer_key == '' or server_id == '' or priv_key == '':
                self._code = 400
                self._msg = self.getMsg('ERR_EMPTY_LINEWORKSAPIKEYS')
                self.responseAjaxResult()
                return

            # 新規登録
            if edit_type == 'new':

                payload = {
                    'name':
                    bot_name,
                    'photoUrl':
                    bot_photourl,
                    'description':
                    bot_description,
                    'managers':
                    UcfUtil.csvToList(bot_manager.strip().replace(' ', '')),
                    'useCallback':
                    True,
                    'callbackUrl':
                    bot_url,
                    'callbackEvents': ['text', 'image', 'location']
                }
                result = lineworks_func.callLineWorksAPIBotAction(
                    '/message/v1', open_api_id, consumer_key, server_id,
                    priv_key, payload, 'POST')
                logging.debug(result)
                if not result:
                    self._code = 400
                    self._msg = self.getMsg(
                        'ERR_FAILED_TO_ACCESS_LINEWORKSAPI')
                    self.responseAjaxResult()
                    return
                else:
                    result_json = json.JSONDecoder().decode(result.content)
                    bot_no = result_json.get('botNo', 0)

                # regist bot to domain
                payload = {'usePublic': True}
                result = lineworks_func.callLineWorksRegisterDomain(
                    '/message/v1', open_api_id, consumer_key, server_id,
                    priv_key, payload, bot_no, domain_id, 'POST')
                logging.debug(result)
                if not result:
                    self._code = 400
                    self._msg = self.getMsg(
                        'ERR_FAILED_TO_ACCESS_LINEWORKSAPI2')
                    self.responseAjaxResult()
                    return
                else:
                    if result.status_code != 200:
                        result_json = json.JSONDecoder().decode(result.content)
                        if result.status_code == 400 and result_json[
                                'code'] == 'ALREADY_REGISTERED_BOT':
                            pass
                        else:
                            self._code = 400
                            self._msg = self.getMsg(
                                'ERR_FAILED_TO_ACCESS_LINEWORKSAPI2')
                            self.responseAjaxResult()
                            return

                logging.info(result.content)

                # create rich menu
                richmenu_id = lineworks_func.createRichMenu(
                    self, open_api_id, consumer_key, server_id, priv_key,
                    bot_no)

            # BOT変更
            elif edit_type == 'renew':

                # check domain
                payload = {'usePublic': True}
                result = lineworks_func.callLineWorksRegisterDomain(
                    '/message/v1', open_api_id, consumer_key, server_id,
                    priv_key, payload, bot_no, domain_id, 'POST')
                if not result:
                    self._code = 400
                    self._msg = self.getMsg(
                        'ERR_FAILED_TO_ACCESS_LINEWORKSAPI2')
                    self.responseAjaxResult()
                    return
                else:
                    if result.status_code != 200:
                        result_json = json.JSONDecoder().decode(result.content)
                        if result.status_code == 400 and result_json[
                                'code'] == 'ALREADY_REGISTERED_BOT':
                            pass
                        else:
                            self._code = 400
                            self._msg = self.getMsg(
                                'ERR_FAILED_TO_ACCESS_LINEWORKSAPI2')
                            self.responseAjaxResult()
                            return

                # update bot
                payload = {
                    'name':
                    bot_name,
                    'photoUrl':
                    bot_photourl,
                    'description':
                    bot_description,
                    'useCallback':
                    True,
                    'callbackUrl':
                    bot_url,
                    'managers':
                    UcfUtil.csvToList(bot_manager.strip().replace(' ', '')),
                    'callbackEvents': ['text', 'image', 'location']
                }

                result = lineworks_func.callLineWorksAPIBotAction(
                    '/message/v1', open_api_id, consumer_key, server_id,
                    priv_key, payload, 'PUT', bot_no, 'update_bot')
                if not result:
                    self._code = 400
                    self._msg = self.getMsg(
                        'ERR_FAILED_TO_ACCESS_LINEWORKSAPI')
                    self.responseAjaxResult()
                    return

                # create rich menu
                richmenu_id = lineworks_func.createRichMenu(
                    self, open_api_id, consumer_key, server_id, priv_key,
                    bot_no)

            if bot_no:
                channel_config_jsondata['bot_no'] = UcfUtil.toInt(bot_no)

            if richmenu_id:
                channel_config_jsondata['richmenu_id'] = richmenu_id

            channel_config = json.JSONEncoder().encode(channel_config_jsondata)

            # modify file up lineworks config
            FileUpSettingConfig.modifyFileUpSettingConfig(
                unique_id, channel_config, channel_kind)

            operation_log_detail = req
            UCFMDLOperationLog.addLog(
                self.getLoginOperatorMailAddress(),
                self.getLoginOperatorUniqueID(), UcfConfig.SCREEN_DASHBOARD,
                UcfConfig.OPERATION_TYPE_MODIFY_LINEWORKS_CONFIG, '', '',
                self.getClientIPAddress(),
                JSONEncoder().encode(operation_log_detail))

            ret_value = {
                'bot_no': UcfUtil.toInt(bot_no) if bot_no else 0,
                'bot_url': bot_url,
                'unique_id': unique_id
            }

            self._code = 0
            self.responseAjaxResult(ret_value)

        except BaseException, e:
            self.outputErrorLog(e)
            self._code = 999
            self.responseAjaxResult()
Esempio n. 11
0
    def processOfRequest(self, tenant):
        try:
            if self.isValidTenant(not_redirect=True) == False:
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
                self.responseAjaxResult()
                return

            if loginfunc.checkLogin(self, not_redirect=True) == False:
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if is_select_ok == False:
                self._code = 403
                self._msg = error_msg
                self.responseAjaxResult()
                return

            if self.isAdmin() == False and self.isOperator() == False:
                self._code = 403
                self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
                self.responseAjaxResult()
                return

            data_key = self.getRequest('data_key')

            if data_key == '':
                self._code = 500
                self._msg = self.getMsg('MSG_INVALID_PARAMETER', ('data_key'))
                self.responseAjaxResult()
                return

            # ファイルデータを取得
            file_vo, file_entry = FileUtils.getDataVoByDataKey(self, data_key)
            # レコードなし=エラー
            if file_vo is None:
                self._code = 500
                self._msg = self.getMsg('MSG_NOTFOUND_TARGET_FILE', (data_key))
                ret_value = {}
                ret_value['data_key'] = data_key
                self.responseAjaxResult(ret_value)
            # 作成確認
            elif UcfUtil.getHashStr(file_vo, 'deal_status') == 'FIN':
                self._code = 0
                ret_value = {}
                ret_value['data_key'] = data_key
                self.responseAjaxResult(ret_value)
            # 作成中
            elif UcfUtil.getHashStr(file_vo, 'deal_status') == 'CREATING':
                self._code = 404
                ret_value = {}
                ret_value['data_key'] = data_key
                self.responseAjaxResult(ret_value)
            # 期限切れ
            elif UcfUtil.getHashStr(
                    file_vo, 'expire_date') == '' or UcfUtil.getDateTime(
                        UcfUtil.getHashStr(
                            file_vo, 'expire_date')) < UcfUtil.getNowLocalTime(
                                self._timezone):
                self._code = 500
                self._msg = self.getMsg('MSG_EXPIRE_TARGET_FILE')
                ret_value = {}
                ret_value['data_key'] = data_key
                self.responseAjaxResult(ret_value)
            # その他エラー
            else:
                self._code = 500
                self._msg = self.getMsg('MSG_NOTFOUND_TARGET_FILE', (data_key))
                ret_value = {}
                ret_value['data_key'] = data_key
                self.responseAjaxResult(ret_value)

        except BaseException, e:
            self.outputErrorLog(e)
            self._code = 999
            self.responseAjaxResult()
Esempio n. 12
0
    def processOfRequest(self, tenant):
        try:
            if self.isValidTenant(not_redirect=True) == False:
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
                self.responseAjaxResult()
                return

            if loginfunc.checkLogin(self, not_redirect=True) == False:
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            # ���O�C�����̊e������擾���`�F�b�N
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if is_select_ok == False:
                self._code = 403
                self._msg = error_msg
                self.responseAjaxResult()
                return

            if self.isAdmin() == False and self.isOperator(
                    target_function=UcfConfig.DELEGATE_FUNCTION_OPERATOR_CONFIG
            ) == False:
                self._code = 403
                self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
                self.responseAjaxResult()
                return

            # �L���[�L�[
            data_kind = self.getRequest('data_kind')
            # UCFMDLFile�̃f�[�^�L�[���쐬
            data_key = UcfUtil.guid()
            # CSV�����̏����i����ꍇ�̂݁j
            search_key = self.getRequest('search_key')
            # ���̑���������JSON�i�ꗗ�Ō�����������i�荞���Export���邽�߁j
            optional_scond_json = self.getRequest('optional_scond')

            # �X�e�[�^�X=CREATING �ɂ� 1���R�[�h�lj����Ă����i�t�����g����̔��萧��Ȃǂ̂��߁j
            file_entry = FileUtils.insertNewCreatingRecord(
                self, data_key, data_kind)

            try:
                # CSV�쐬�^�X�N��lj�
                token = UcfUtil.guid()
                params = {
                    'data_key':
                    data_key,
                    'data_kind':
                    data_kind,
                    'search_key':
                    search_key,
                    'optional_scond':
                    optional_scond_json,
                    'login_operator_id':
                    self.getLoginOperatorID(),
                    'login_operator_unique_id':
                    self.getLoginOperatorUniqueID(),
                    'login_operator_mail_address':
                    self.getLoginOperatorMailAddress()
                }
                import_q = taskqueue.Queue('csv-export-import')
                import_t = taskqueue.Task(
                    url='/a/' + tenant + '/' + token + '/queue_csv_export',
                    params=params,
                    target=sateraito_func.getBackEndsModuleName(tenant),
                    countdown='1')
                import_q.add(import_t)

                self._code = 0
                ret_value = {}
                ret_value['data_key'] = data_key
                self.responseAjaxResult(ret_value)

            except BaseException, e:
                file_entry.status = 'FAILED'
                file_entry.updater_name = UcfUtil.nvl(self.getLoginID())
                file_entry.date_changed = UcfUtil.getNow()
                file_entry.put()
                raise e

        except BaseException, e:
            self.outputErrorLog(e)
            self._code = 999
            self.responseAjaxResult()
Esempio n. 13
0
	def processOfRequest(self, tenant):
		CSRF_TOKEN_KEY = 'personal_password'
		try:
			self._approot_path = os.path.dirname(__file__)
			if self.isValidTenant() == False:
				return

			if loginfunc.checkLogin(self) == False:
				return

			# ログイン時の各種情報を取得&チェック
			is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(self)
			if is_select_ok == False:
				return

			# パスワード変更をさせないフラグがたっていないかをチェック
			if profile_vo is not None and UcfUtil.getHashStr(profile_vo, 'passwordchange_unavailable_flag') == 'UNAVAILABLE':
				self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_UNAVAILABLE_PASSWORD_CHANGE')))
				return

			# 自動遷移先URLが指定されていたらリダイレクト(このページではしない)
			if ucffunc.redirectAutoRedirectURL(self, is_no_redirect=True):
				return

			ucfp = UcfTenantParameter(self)

			# Requestからvoにセット
			req = UcfVoInfo.setRequestToVo(self)

			# ステータス
			edit_status = UcfUtil.getHashStr(req, UcfConfig.QSTRING_STATUS)
			vo = req
			if edit_status == UcfConfig.VC_CHECK:

				# CSRF対策:トークンチェック
				if not self.checkCSRFToken(CSRF_TOKEN_KEY, self.request.get(UcfConfig.REQUESTKEY_CSRF_TOKEN)):
					self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_CSRF_CHECK')))
					return

				# 入力チェック
				vc = PasswordChangeValidator('')
				vc.validate(self, vo, user_vo, profile_vo)
				ucfp.voinfo.validator = vc
				# 入力エラーがなければ登録処理
				if ucfp.voinfo.validator.total_count <= 0:

					is_password_change_success, password_change_error_code = ProfileUtils.changeUserPassword(self, req, user_vo, profile_vo, updater_name=UcfUtil.nvl(self.getLoginID()))
					if is_password_change_success:
						# セッションのパスワード強制変更フラグをクリア
						self.setLoginOperatorForcePasswordChangeFlag('')
						# 処理後一覧ページに遷移
						self.redirect('/a/' + self._tenant + '/personal/password/thanks')
					return

				# 入力エラーがあれば画面に戻る
				else:
					ucfp.voinfo.setVo(vo, None, None, self)
			else:
				pass

			# CSRF対策:トークン発行
			ucfp.data['token'] = self.createCSRFToken(CSRF_TOKEN_KEY)

			ucfp.data[UcfConfig.REQUESTKEY_RURL] = ''	# Google以外のSAML SPからのリクエストを想定
			template_vals = {
				'ucfp' : ucfp,
				'vcmsg': ucfp.voinfo.validator.msg if ucfp.voinfo.validator != None else {},
				'is_hide_backstretch':self._career_type == UcfConfig.VALUE_CAREER_TYPE_TABLET,		# アクセス申請用ログイン画面でタブレットの場合はそもそも出さない

			}
			self.appendBasicInfoToTemplateVals(template_vals)

			self.render('personal_password_index.html', self._design_type, template_vals)
		except BaseException, e:
			self.outputErrorLog(e)
			self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_SYSTEM_ERROR'), ()))
			return
Esempio n. 14
0
    def processOfRequest(self, tenant):
        try:
            self._approot_path = os.path.dirname(__file__)
            if self.isValidTenant() == False:
                return

            if loginfunc.checkLogin(self) == False:
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self)
            if is_select_ok == False:
                return
            # パスワード次回変更フラグをチェック
            if self.checkForcePasswordChange() == False:
                return

            if profile_vo is not None:
                ProfileUtils.editVoForSelect(self,
                                             profile_vo,
                                             with_expand_mypage_links=True)

            # 自動遷移先URLが指定されていたらリダイレクト
            if ucffunc.redirectAutoRedirectURL(self, profile_vo):
                return

            ucfp = UcfTenantParameter(self)

            is_available_matrixauth = profile_vo is not None and profile_vo[
                'login_type'] == 'DCARD'
            # パスワード変更のリンクを表示するかどうか
            ucfp.data[
                'is_available_password_change'] = not is_available_matrixauth and (
                    profile_vo is None
                    or profile_vo['passwordchange_unavailable_flag'] !=
                    'UNAVAILABLE')
            # ワンタイム・ランダムパスワード PINコード変更のリンクを表示するかどうか
            ucfp.data['is_available_matrixauth'] = is_available_matrixauth and (
                profile_vo is None or
                profile_vo['passwordchange_unavailable_flag'] != 'UNAVAILABLE')
            # アクセス申請のリンクを表示するかどうか(まずはシンプルにアクセス制御が有効なら全表示)
            #			ucfp.data['is_available_access_apply'] = profile_vo and profile_vo['acsctrl_active_flag'] == 'ACTIVE' and profile_vo['device_check_flag'] == 'ACTIVE' and UcfUtil.getHashStr(vo, UcfConfig.REQUESTKEY_TEMP_LOGIN_CHECK_ACTION_KEY) == ''
            ucfp.data['is_available_access_apply'] = profile_vo and profile_vo[
                'acsctrl_active_flag'] == 'ACTIVE'
            # 予備のメールアドレスのリンクを表示するかどうか
            ucfp.data['is_available_sub_mailaddress_regist'] = True
            # サービスURLと表示フラグ

            icon_info = []  # Nexus7デザイン用なのでApps版以外は不要...
            icon_cnt = 0
            mypage_links = {}
            custom_links = []

            if profile_vo is not None:
                if self._tenant.endswith('.my.salesforce.com'):
                    mypage_links['mypage_links_ck_mydomain'] = profile_vo.get(
                        'mypage_links_ck_mydomain', False)
                    mypage_links[
                        'mypage_links_lk_mydomain'] = 'https://' + self._tenant
                    # リンク
                    if profile_vo.get('mypage_links_ck_mydomain', False):
                        icon_info.append({
                            'link': True,
                            'icon': 'mydomain',
                            'url': 'https://' + self._tenant
                        })
                        icon_cnt += 1

                # マイページのカスタムリンク設定を取得
                mypagelink_info = None
                mypagelink_unique_id = MyPageLinkUtils.DEFAULT_UNIQUE_ID
                mypagelink_entry = MyPageLinkUtils.getData(
                    self, mypagelink_unique_id)
                if mypagelink_entry is not None:
                    mypagelink_vo = mypagelink_entry.exchangeVo(
                        self._timezone)  # 既存データをVoに変換
                    MyPageLinkUtils.editVoForSelect(
                        self, mypagelink_vo)  # データ加工(取得用)
                    link_info_json = UcfUtil.getHashStr(
                        mypagelink_vo, 'link_info')
                    if link_info_json != '':
                        mypagelink_info = JSONDecoder().decode(link_info_json)
                        for link_data in mypagelink_info:
                            link = link_data.get('link')
                            if profile_vo.get(
                                    'mypage_links_ck_' + link.get('id', ''),
                                    False):
                                custom_links.append({
                                    'name':
                                    link.get('name', ''),
                                    'url':
                                    link.get('url', ''),
                                    'icon':
                                    link.get('icon', ''),
                                })

            logging.info(custom_links)

            # パスワード変更アイコン
            if ucfp.data['is_available_password_change']:
                icon_info.append({
                    'link':
                    True,
                    'icon':
                    'password',
                    'url':
                    '/a/' + self._tenant + '/personal/password/'
                })
                icon_cnt += 1
            # 端末申請アイコン(アイズ様Nexus7連携なら表示しない)
            if ucfp.data['is_available_access_apply'] and self.getDeptInfo(
            )['hide_access_apply_link_flag'] != 'HIDDEN':
                icon_info.append({
                    'link': True,
                    'icon': 'accessapply',
                    'url': '/a/' + self._tenant + '/acs/apply'
                })
                icon_cnt += 1
            # 予備のメールアドレス登録アイコン
            if ucfp.data[
                    'is_available_sub_mailaddress_regist'] and self.getDeptInfo(
                    )['hide_regist_sub_mail_address_link_flag'] != 'HIDDEN':
                icon_info.append({
                    'link':
                    True,
                    'icon':
                    'submailaddress',
                    'url':
                    '/a/' + self._tenant + '/personal/minfo/'
                })
                icon_cnt += 1
            # ワンタイムランダムパスワード PINコード変更
            if ucfp.data['is_available_matrixauth']:
                icon_info.append({
                    'link': True,
                    'icon': 'matrixauth',
                    'url': '/a/' + self._tenant + '/personal/otp/'
                })
                icon_cnt += 1

            # 6 * 2 = 12 分、定義
            for i in range(12 - icon_cnt):
                icon_info.append({'link': False, 'icon': 'no', 'url': '#'})
                icon_cnt += 1

            # セキュリティブラウザを表示するかどうか(PCは表示しない、スマホとタブレットは表示)
            #ucfp.data['is_display_securitybrowser_link'] = self._design_type == 'sp' or self._career_type == UcfConfig.VALUE_CAREER_TYPE_TABLET
            ucfp.data['is_display_securitybrowser_link'] = False
            # セキュリティブラウザリンク
            ucfp.data['securitybrowser_link'] = ''
            if self._is_android:
                ucfp.data[
                    'securitybrowser_link'] = 'https://play.google.com/store/apps/details?id=xxxxxx'
            elif self._is_ios:
                ucfp.data[
                    'securitybrowser_link'] = 'https://itunes.apple.com/app/idxxxxxx'

            # nexus7かどうか(Salesforce版ではとりあえず対応しない)
            #is_nexus7 = self.getUserAgent().lower().find('nexus 7 ') >= 0
            is_nexus7 = False

            if (is_nexus7 or self.request.get('dtp')
                    == 'nexus7') and self._design_type != 'm':
                template_vals = {
                    'ucfp':
                    ucfp,
                    'icon_info':
                    icon_info,
                    'mypage_links':
                    mypage_links,
                    'custom_links':
                    custom_links,
                    'exist_custom_links':
                    custom_links is not None and len(custom_links) > 0,
                    'is_hide_backstretch':
                    self._career_type == UcfConfig.
                    VALUE_CAREER_TYPE_TABLET  # アクセス申請用ログイン画面でタブレットの場合はそもそも出さない
                }
                self.appendBasicInfoToTemplateVals(template_vals)
                self.render('personal_index_nexus7.html', self._design_type,
                            template_vals)
            else:
                template_vals = {
                    'ucfp':
                    ucfp,
                    'mypage_links':
                    mypage_links,
                    'custom_links':
                    custom_links,
                    'exist_custom_links':
                    custom_links is not None and len(custom_links) > 0,
                    'is_hide_backstretch':
                    self._career_type == UcfConfig.
                    VALUE_CAREER_TYPE_TABLET  # アクセス申請用ログイン画面でタブレットの場合はそもそも出さない
                }
                self.appendBasicInfoToTemplateVals(template_vals)
                self.render('personal_index.html', self._design_type,
                            template_vals)
        except BaseException, e:
            self.outputErrorLog(e)
            self.redirectError(
                UcfMessage.getMessage(self.getMsg('MSG_SYSTEM_ERROR'), ()))
            return
Esempio n. 15
0
    def processOfRequest(self, tenant):
        try:

            if self.isValidTenant(not_redirect=True) == False:
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
                self.responseAjaxResult()
                return

            if loginfunc.checkLogin(self, not_redirect=True) == False:
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if is_select_ok == False:
                self._code = 403
                self._msg = error_msg
                self.responseAjaxResult()
                return

            if self.isAdmin() == False:
                self._code = 403
                self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
                self.responseAjaxResult()
                return

            # Requestからvoにセット
            req = UcfVoInfo.setRequestToVo(self)

            start = int(req['start'])
            limit = int(req['limit'])

            sk_operation = UcfUtil.getHashStr(req, 'sk_operation').lower()
            sk_operator_unique_id = UcfUtil.getHashStr(
                req, 'sk_operator_unique_id')

            # 検索
            q = UCFMDLOperationLog.query()

            # ユーザ詳細ページの検索
            if sk_operator_unique_id != '':
                q = q.filter(UCFMDLOperationLog.operator_unique_id ==
                             sk_operator_unique_id)
            # 全体のログイン履歴一覧
            else:
                if sk_operation != '':
                    q = q.filter(UCFMDLOperationLog.operation == sk_operation)

            q = q.order(-UCFMDLOperationLog.operation_date)

            # q.count() が非常に負荷、時間がかかるので暫定的に変更(将来は「もっと表示」方式、あるいはマウススクロールで次の情報を取る方式に変更したい) 2016.02.26
            #logging.info('before q.count()...')
            #count = q.count()
            #logging.info('after q.count() = ' + str(count) + '...')
            login_history_max_export_cnt = self.getDeptInfo().get(
                'login_history_max_export_cnt')
            max_export_cnt = UcfUtil.toInt(
                login_history_max_export_cnt)  # 最大出力件数
            if max_export_cnt <= 0:
                max_export_cnt = 1000
            count = max_export_cnt

            result_list = []
            for model in q.iter(limit=limit, offset=start):
                vo = model.exchangeVo(self._timezone)
                OperationLogUtils.editVoForList(self, vo)
                result_list.append(vo)

            logging.info(result_list)
            ret_value = {'all_count': str(count), 'records': result_list}

            self._code = 0
            self.responseAjaxResult(ret_value)

        except BaseException, e:
            self.outputErrorLog(e)
            self._code = 999
            self.responseAjaxResult()
Esempio n. 16
0
	def processOfRequest(self, tenant):
		try:
			if self.isValidTenant(not_redirect=True) == False:
				self._code = 400
				self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
				self.responseAjaxResult()
				return

			if loginfunc.checkLogin(self, not_redirect=True) == False:
				self._code = 403
				self._msg = self.getMsg('MSG_NOT_LOGINED')
				self.responseAjaxResult()
				return

			# ログイン時の各種情報を取得&チェック
			is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(self, not_redirect=True)
			if is_select_ok == False:
				self._code = 403
				self._msg = error_msg
				self.responseAjaxResult()
				return

			if self.isAdmin() == False and self.isOperator(target_function=[UcfConfig.DELEGATE_FUNCTION_OPERATOR_CONFIG]) == False:
				self._code = 403
				self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
				self.responseAjaxResult()
				return

			# Requestからvoにセット
			req = UcfVoInfo.setRequestToVo(self)

			start = int(req['start'])
			limit = int(req['limit'])
			if limit <= 0:
				limit = 1000

			sk_task_type = UcfUtil.getHashStr(req, 'sk_task_type').lower()
			sk_target_unique_id = UcfUtil.getHashStr(req, 'sk_target_unique_id')
			
			# タスク検索
			gql = ''
			wheres = []
			wheres.append("task_type = '" + UcfUtil.escapeGql(sk_task_type) + "'")
			wheres.append("target_unique_id = '" + UcfUtil.escapeGql(sk_target_unique_id) + "'")
			gql += UcfUtil.getToGqlWhereQuery(wheres)
			models = UCFMDLTaskChangeID.gql(gql)
			count = 0
			fetch_data = None
			if models:
				count = models.count()
				fetch_data = models.fetch(limit, start)
			tasks_list = []
			for model in fetch_data:
				vo = model.exchangeVo(self._timezone)
				TaskChangeIDUtils.editVoForSelect(self, vo)
				tasks_list.append(vo)

			ret_value = {
				 'all_count': str(count)
				,'records': tasks_list
			}

			self._code = 0
			self.responseAjaxResult(ret_value)

		except BaseException, e:
			self.outputErrorLog(e)
			self._code = 999
			self.responseAjaxResult()
Esempio n. 17
0
    def processOfRequest(self, tenant):
        try:
            if self.isValidTenant(not_redirect=True) == False:
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
                self.responseAjaxResult()
                return

            if loginfunc.checkLogin(self, not_redirect=True) == False:
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if is_select_ok == False:
                self._code = 403
                self._msg = error_msg
                self.responseAjaxResult()
                return

            if self.isAdmin() == False:
                self._code = 403
                self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
                self.responseAjaxResult()
                return

            # Requestからvoにセット
            req = UcfVoInfo.setRequestToVo(self)

            #			logging.info(req)
            #			self._code = 999
            #			self._msg = self.getMsg('MSG_NOT_EXIST_DATA', ())
            #			self.responseAjaxResult()
            #			return

            # 既存データを取得
            query = UCFMDLDeptMaster.gql("where tenant = :1", tenant)
            dept_entry = query.get()

            if dept_entry is None:
                self._code = 999
                self._msg = self.getMsg('MSG_NOT_EXIST_DATA', ())
                self.responseAjaxResult()
                return


#			vo = dept_entry.exchangeVo(self._timezone)					# 既存データをVoに変換
#			UcfUtil.margeHash(vo, req)										# Requestからの情報をVoにマージ
            vo = {}
            entry_vo = dept_entry.exchangeVo(self._timezone)  # 既存データをVoに変換
            DeptUtils.editVoForSelect(self, entry_vo)  # データ加工(取得用)
            UcfUtil.margeHash(vo, entry_vo)  # 既存データをVoにコピー
            UcfUtil.margeHash(vo, req)  # Requestからの情報をVoにマージ

            # 入力チェック
            ret_value = {}
            vc = DeptValidator('')
            vc.validate(self, req)
            if vc.total_count > 0:
                self._code = 100
                ret_value['vcmsg'] = vc.msg
                self.responseAjaxResult(ret_value)
                return

            # データ加工更新用
            DeptUtils.editVoForRegist(self, vo, None,
                                      UcfConfig.EDIT_TYPE_RENEW)

            dept_entry.margeFromVo(vo, self._timezone)
            dept_entry.updater_name = UcfUtil.nvl(self.getLoginID())
            dept_entry.date_changed = UcfUtil.getNow()
            dept_entry.put()

            # ここで一度キャッシュではなく最新の情報を取得しておく
            self.getDeptInfo(is_force_select=True)

            # オペレーションログ出力
            operation_log_detail = {}
            UCFMDLOperationLog.addLog(
                self.getLoginOperatorMailAddress(),
                self.getLoginOperatorUniqueID(), UcfConfig.SCREEN_DASHBOARD,
                UcfConfig.OPERATION_TYPE_MODIFY, '', '',
                self.getClientIPAddress(),
                JSONEncoder().encode(operation_log_detail))

            self._code = 0
            self.responseAjaxResult()

        except BaseException, e:
            self.outputErrorLog(e)
            self._code = 999
            self.responseAjaxResult()
Esempio n. 18
0
	def processOfRequest(self, tenant):

		try:
			self._approot_path = os.path.dirname(__file__)
			if self.isValidTenant() == False:
				return

			if loginfunc.checkLogin(self) == False:
				return

			# ログイン時の各種情報を取得&チェック
			is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(self)
			if is_select_ok == False:
				return

			# 有償版チェック
			if sateraito_func.isFreeMode(self._tenant):
				self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_NOAVAILABLE_FREE_APP')))
				return

			if self.isAdmin() == False:
				self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')))
				return

			# デザインタイプ
			design_type = UcfUtil.nvl(self.getRequest('dtp'))
			if design_type == '':
				design_type = UcfConfig.TEMPLATE_DEFAULT_DESIGN_TYPE

			# 画像ID
			picture_id = UcfUtil.nvl(self.getRequest('picture_id'))
			# 画像IDチェック
			if picture_id not in ('logo', 'mainbg01', 'mainbg02', 'mainbg03', 'mainbg04', 'mainbg05', 'mainbg06', 'mainbg07', 'mainbg08', 'mainbg09', 'mainbg10'):
				self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_INVALID_PARAMETER',('picture_id'))))
				return

			# 企業マスタから対象の既存データキーを取得
			data_key_field = ''
			# ロゴ
			if picture_id == 'logo':
				data_key_field =  'logo_data_key'
			# ログイン画面背景画像
			elif picture_id == 'mainbg01':
				data_key_field =  'login_background_' + design_type + '1_data_key'
			elif picture_id == 'mainbg02':
				data_key_field =  'login_background_' + design_type + '2_data_key'
			elif picture_id == 'mainbg03':
				data_key_field =  'login_background_' + design_type + '3_data_key'
			elif picture_id == 'mainbg04':
				data_key_field =  'login_background_' + design_type + '4_data_key'
			elif picture_id == 'mainbg05':
				data_key_field =  'login_background_' + design_type + '5_data_key'
			elif picture_id == 'mainbg06':
				data_key_field =  'login_background_' + design_type + '6_data_key'
			elif picture_id == 'mainbg07':
				data_key_field =  'login_background_' + design_type + '7_data_key'
			elif picture_id == 'mainbg08':
				data_key_field =  'login_background_' + design_type + '8_data_key'
			elif picture_id == 'mainbg09':
				data_key_field =  'login_background_' + design_type + '9_data_key'
			elif picture_id == 'mainbg10':
				data_key_field =  'login_background_' + design_type + '10_data_key'

			data_key =  UcfUtil.nvl(self.getDeptInfo(True)[data_key_field])

			file_entry = None
			file_vo = None
			if data_key != '':
				file_entry = FileUtils.getDataEntryByDataKey(self, data_key)

			# あればキーをクリア&データも削除
			if file_entry is not None:
				dept = DeptUtils.getDeptEntryByUniqueID(self, UcfUtil.nvl(self.getDeptInfo(True)['unique_id']))
				dept_vo = dept.exchangeVo(self._timezone)
				DeptUtils.editVoForSelect(self, dept_vo)
				# 企業マスタのdata_keyをクリア
				dept_vo[data_key_field] = ''
				DeptUtils.editVoForRegist(self, dept_vo, None, UcfConfig.EDIT_TYPE_RENEW)
				dept.margeFromVo(dept_vo, self._timezone)
				dept.updater_name = UcfUtil.nvl(self.getLoginID())
				dept.date_changed = UcfUtil.getNow()
				dept.put()
				# ファイル自体も削除
				file_entry.delete()

				memcache_key = 'tenant_picture?tenant=' + tenant + '&picture_id=' + picture_id + '&designe_type=' + design_type
				memcache_key2 = 'tenant_picture2?tenant=' + tenant + '&picture_id=' + picture_id + '&designe_type=' + design_type
				memcache_key3 = 'tenant_picture3?tenant=' + tenant + '&picture_id=' + picture_id + '&designe_type=' + design_type
				memcache_key4 = 'tenant_picture4?tenant=' + tenant + '&picture_id=' + picture_id + '&designe_type=' + design_type
				memcache.delete(memcache_key)
				memcache.delete(memcache_key2)
				memcache.delete(memcache_key3)
				memcache.delete(memcache_key4)

			# memcacheを更新
			self.getDeptInfo(is_force_select=True)

			# オペレーションログ出力
			operation_log_detail = {}
			operation_log_detail['design_type'] = design_type
			operation_log_detail['picture_id'] = picture_id
			UCFMDLOperationLog.addLog(self.getLoginOperatorMailAddress(), self.getLoginOperatorUniqueID(), UcfConfig.SCREEN_DASHBOARD, UcfConfig.OPERATION_TYPE_REMOVE_PICTURE, '', '', self.getClientIPAddress(), JSONEncoder().encode(operation_log_detail))

			# リダイレクト
			self.redirect('/a/' + tenant + '/config/bgupload')

		except BaseException, e:
			self.outputErrorLog(e)
			self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_SYSTEM_ERROR'), ()))
			return
Esempio n. 19
0
    def processOfRequest(self, tenant):
        CSRF_TOKEN_KEY = 'UPLOAD'
        try:
            self._approot_path = os.path.dirname(__file__)

            if self.isValidTenant() == False:
                return

            if loginfunc.checkLogin(self) == False:
                return

            # 有償版チェック
            if sateraito_func.isFreeMode(self._tenant):
                self.redirectError(
                    UcfMessage.getMessage(
                        self.getMsg('MSG_NOAVAILABLE_FREE_APP')))
                return

            # 権限チェック
            if self.isAdmin() == False:
                self.redirectError(
                    UcfMessage.getMessage(
                        self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')))
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self)
            if is_select_ok == False:
                return
            # パスワード次回変更フラグをチェック
            if self.checkForcePasswordChange() == False:
                return

            ucfp = UcfTenantParameter(self)
            ucfp.data['explains'] = [self.getMsg('EXPLAIN_BGUPLOAD_HEADER')]

            ucfp.data['is_uploaded_mainbg01'] = UcfUtil.getHashStr(
                self.getDeptInfo(), 'login_background_pc1_data_key') != ''
            ucfp.data['is_uploaded_mainbg02'] = UcfUtil.getHashStr(
                self.getDeptInfo(), 'login_background_pc2_data_key') != ''
            ucfp.data['is_uploaded_mainbg03'] = UcfUtil.getHashStr(
                self.getDeptInfo(), 'login_background_pc3_data_key') != ''
            ucfp.data['is_uploaded_mainbg04'] = UcfUtil.getHashStr(
                self.getDeptInfo(), 'login_background_pc4_data_key') != ''
            ucfp.data['is_uploaded_mainbg05'] = UcfUtil.getHashStr(
                self.getDeptInfo(), 'login_background_pc5_data_key') != ''
            ucfp.data['is_uploaded_mainbg06'] = UcfUtil.getHashStr(
                self.getDeptInfo(), 'login_background_pc6_data_key') != ''
            ucfp.data['is_uploaded_mainbg07'] = UcfUtil.getHashStr(
                self.getDeptInfo(), 'login_background_pc7_data_key') != ''
            ucfp.data['is_uploaded_mainbg08'] = UcfUtil.getHashStr(
                self.getDeptInfo(), 'login_background_pc8_data_key') != ''
            ucfp.data['is_uploaded_mainbg09'] = UcfUtil.getHashStr(
                self.getDeptInfo(), 'login_background_pc9_data_key') != ''
            ucfp.data['is_uploaded_mainbg10'] = UcfUtil.getHashStr(
                self.getDeptInfo(), 'login_background_pc10_data_key') != ''
            ucfp.data['is_uploaded_mainbgsp01'] = UcfUtil.getHashStr(
                self.getDeptInfo(), 'login_background_sp1_data_key') != ''

            default_bg_idx = self._getBgDefaultIdx()

            ucfp.data['BgDefaultIdx'] = {
                '01': default_bg_idx[0],
                '02': default_bg_idx[1],
                '03': default_bg_idx[2],
                '04': default_bg_idx[3],
                '05': default_bg_idx[4],
                '06': default_bg_idx[5],
                '07': default_bg_idx[6],
                '08': default_bg_idx[7],
                '09': default_bg_idx[8],
                '10': default_bg_idx[9]
            }
            # CSRF対策:トークン発行
            ucfp.data['token'] = self.createCSRFToken(CSRF_TOKEN_KEY)

            template_vals = {
                'ucfp': ucfp,
            }
            self.appendBasicInfoToTemplateVals(template_vals)

            self.render('bgupload.html', self._design_type, template_vals)
        except BaseException, e:
            self.outputErrorLog(e)
            self.redirectError(
                UcfMessage.getMessage(self.getMsg('MSG_SYSTEM_ERROR'), ()))
            return
Esempio n. 20
0
    def processOfRequest(self, tenant):
        CSRF_TOKEN_KEY = 'UPLOAD'
        try:
            self._approot_path = os.path.dirname(__file__)

            if self.isValidTenant() == False:
                return

            if loginfunc.checkLogin(self) == False:
                return

            # ���O�C�����̊e������擾���`�F�b�N
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self)
            if is_select_ok == False:
                return

            # �p�X���[�h����ύX�t���O���`�F�b�N
            if self.checkForcePasswordChange() == False:
                return

            # �����`�F�b�N
            #if self.isAdmin() == False:
            if self.isAdmin(
            ) == False or self._design_type != UcfConfig.VALUE_DESIGN_TYPE_PC:
                #				self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')))
                # �����J�ڐ�URL���w�肳��Ă����烊�_�C���N�g�i�Ǘ��҂���Ȃ���΁j
                if ucffunc.redirectAutoRedirectURL(self,
                                                   profile_vo,
                                                   is_force_deal=True):
                    return

                # ���̃y�[�W���g���w�肳���Ɩ������[�v�ɂȂ�̂ł��̏ꍇ�̓}�C�y�[�W�ɔ�΂��i�O�̂��߁j
                # �w��Ȃ��Ȃ�p�[�\�i���i�}�C�y�[�W�j�g�b�v�Ƀ��_�C���N�g
                #self.redirect('/a/' + self._tenant + '/personal/')
                ucffunc.routerURLPermission(self)
                return

            # �����ň�x�L���b�V���ł͂Ȃ��ŐV�̏����擾���Ă���
            self.getDeptInfo(is_force_select=True)

            # �e�i���g�����擾
            tenant_entry = sateraito_func.getTenantEntry(self._tenant)
            if tenant_entry is None or (tenant_entry.is_disable is not None
                                        and tenant_entry.is_disable == True):
                self.redirectError(
                    UcfMessage.getMessage(self.getMsg('MSG_INVALID_TENANT'),
                                          ()))
                return

            available_users = tenant_entry.available_users
            charge_start_date = tenant_entry.charge_start_date if tenant_entry.charge_start_date is not None else ''
            cancel_date = tenant_entry.cancel_date if tenant_entry.cancel_date is not None else ''
            if charge_start_date != '':
                is_free_mode = UcfUtil.set_time(
                    UcfUtil.getNowLocalTime(self._timezone), 0, 0,
                    0) < UcfUtil.set_time(
                        UcfUtil.getDateTime(charge_start_date), 0, 0, 0)
            else:
                is_free_mode = True
            if cancel_date != '':
                is_canceled = UcfUtil.set_time(
                    UcfUtil.getNowLocalTime(self._timezone),
                    0, 0, 0) >= UcfUtil.set_time(
                        UcfUtil.getDateTime(cancel_date), 0, 0, 0)
            else:
                is_canceled = False

            cancel_date_str = ''
            if cancel_date != '':
                cancel_date_str = UcfUtil.add_seconds(
                    UcfUtil.set_time(UcfUtil.getDateTime(cancel_date), 0, 0,
                                     0), -1).strftime('%Y/%m/%d')

            # ���p���[�U�[�����擾
            #active_users = UCFMDLOperator.getActiveUserAmount(self._tenant)
            active_users = sateraito_db.User.getActiveUserAmount(self._tenant)

            # ���C�Z���X���̏���ɋߕt���Ă���i���邢�͒����Ă���j�|�̌x�����o��
            is_disp_warning_about_license = False
            is_disp_error_about_license = False
            RATIO_OF_DISP_WARNING_ABOUT_LICENSE = 0.8  # ���C�Z���X����8���ɒB���Ă���x�����o��

            if available_users >= 0:
                if available_users < active_users:
                    is_disp_error_about_license = True
                elif (available_users *
                      RATIO_OF_DISP_WARNING_ABOUT_LICENSE) < active_users:
                    is_disp_warning_about_license = True

            attentions = []
            vo = {}

            lineworks_config = FileUpSettingConfig.getSettingConfigByChannelKind(
                'lineworksbot')
            if lineworks_config:
                lineworks_config = lineworks_config.exchangeVo(self._timezone)

            directcloudbox_config = FileServerSettingConfig.getConfig(
                'directcloudbox')
            if directcloudbox_config:
                directcloudbox_config = directcloudbox_config.exchangeVo(
                    self._timezone)
            logging.debug(directcloudbox_config)

            ucfp = UcfTenantParameter(self)

            # add data API
            logging.info(vo)
            ucfp.voinfo.setVo(vo, None, None, self)

            ucfp.data['gnaviid'] = _gnaviid
            ucfp.data['leftmenuid'] = _leftmenuid
            ucfp.data['explains'] = [
                self.getMsg('FILEUP_EXPLAIN_DASHBOARD_HEADER')
            ]
            ucfp.data['attentions'] = attentions

            # ucfp.data['federated_domains'] = UcfUtil.listToCsv(sateraito_func.getFederatedDomainList(tenant, is_with_cache=True))
            # CSRF�΍�:�g�[�N�����s
            ucfp.data['token'] = self.createCSRFToken(CSRF_TOKEN_KEY)

            logging.info(ucfp.data['token'])

            # ����ꗗ
            language_list = []
            for language in sateraito_func.ACTIVE_LANGUAGES:
                language_list.append([
                    language,
                    self.getMsg(
                        sateraito_func.LANGUAGES_MSGID.get(language, ''))
                ])

            ## �h���C���R���{�{�b�N�X���
            #federated_domains = sateraito_func.getFederatedDomainList(tenant, is_with_cache=True)
            #not_checked_domains = []
            #for domain_name in federated_domains:
            #	not_checked_domains.append(domain_name.lower())
            #domaincombobox_config_text = self.getDeptValue('domaincombobox_config')
            #domaincombobox_config = []
            #if domaincombobox_config_text is not None and domaincombobox_config_text != '':
            #	domaincombobox_config_datastore = JSONDecoder().decode(domaincombobox_config_text)
            #	for domaininfo in domaincombobox_config_datastore:
            #		if domaininfo.get('domain_name', '') in federated_domains:
            #			domaincombobox_config.append(domaininfo)
            #		if domaininfo.get('domain_name', '').lower() in not_checked_domains:
            #			not_checked_domains.remove(domaininfo.get('domain_name', '').lower())
            #else:
            #	domaincombobox_config = []
            #for domain_name in not_checked_domains:
            #	domaincombobox_config.append({
            #		'domain_name':domain_name,
            #		'is_hidden':False,
            #	})

            template_vals = {
                'ucfp':
                ucfp,
                'language_disp':
                self.getMsg(
                    sateraito_func.LANGUAGES_MSGID.get(self._language,
                                                       'VMSG_LANG_DEFAULT')),
                'language_list':
                json.JSONEncoder().encode(language_list),
                # 'domaincombobox_config':JSONEncoder().encode(domaincombobox_config),
                'is_free_mode':
                is_free_mode,
                'is_canceled':
                is_canceled,
                'cancel_date':
                cancel_date_str,
                'charge_start_date':
                charge_start_date,
                'active_users':
                active_users,
                'available_users':
                available_users,
                'is_disp_warning_about_license':
                is_disp_warning_about_license,
                'is_disp_error_about_license':
                is_disp_error_about_license,
                'lineworks_config':
                lineworks_config,
                'directcloudbox_config':
                directcloudbox_config
            }
            self.appendBasicInfoToTemplateVals(template_vals)

            # #fix run on PC
            # self._design_type = UcfConfig.VALUE_CAREER_TYPE_PC

            self.render('index.html', self._design_type, template_vals)
        except BaseException, e:
            self.outputErrorLog(e)
            self.redirectError(
                UcfMessage.getMessage(self.getMsg('MSG_SYSTEM_ERROR'), ()))
            return
Esempio n. 21
0
	def processOfRequest(self, tenant):
		CSRF_TOKEN_KEY = 'minfo'
		try:
			self._approot_path = os.path.dirname(__file__)
			if self.isValidTenant() == False:
				return

			if loginfunc.checkLogin(self) == False:
				return

			# ���O�C�����̊e������擾���`�F�b�N
			is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(self)
			if is_select_ok == False:
				return

			if False:
				self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_UNAVAILABLE_SUBMAILADDRESS')))
				return

			if user_vo is None:
				self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_NOT_EXIST_USER_FOR_SUBMAILADDRESS')))
				return


			# �����J�ڐ�URL���w�肳��Ă����烊�_�C���N�g
			if ucffunc.redirectAutoRedirectURL(self, is_no_redirect=False):
				return

			ucfp = UcfTenantParameter(self)

			# Request����vo�ɃZ�b�g
			req = UcfVoInfo.setRequestToVo(self)
			# �X�e�[�^�X
			edit_status = UcfUtil.getHashStr(req, UcfConfig.QSTRING_STATUS)
			vo = req
			if edit_status == UcfConfig.VC_CHECK:

				# CSRF�΍�F�g�[�N���`�F�b�N
				if not self.checkCSRFToken(CSRF_TOKEN_KEY, self.request.get(UcfConfig.REQUESTKEY_CSRF_TOKEN)):
					self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_CSRF_CHECK')))
					return

				# ���̓`�F�b�N
				vc = Validator('')
				vc.validate(self, vo, user_vo, profile_vo)
				ucfp.voinfo.validator = vc
				# ���̓G���[���Ȃ���Γo�^����
				if ucfp.voinfo.validator.total_count <= 0:

					sub_mail_address = UcfUtil.getHashStr(req, 'sub_mail_address')

					# ���߂ă��[�U�f�[�^���擾
					entry = OperatorUtils.getData(self, UcfUtil.getHashStr(user_vo, 'unique_id'))
					if entry is None:
						self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_NOT_EXIST_LOGIN_ACCOUNT_DATA')))
						return
					user_vo = entry.exchangeVo(self._timezone)										# user_vo�����ւ�
					user_vo['sub_mail_address'] = sub_mail_address
					# Vo���烂�f���Ƀ}�[�W
					entry.margeFromVo(user_vo, self._timezone)
					# �X�V�����A�X�V�҂̍X�V
					entry.updater_name = UcfUtil.nvl(self.getLoginID())
					entry.date_changed = UcfUtil.getNow()
					entry.put()

					# �T���L���[���[�����M
					self.sendNotificationMail(user_vo)

					# ������ꗗ�y�[�W�ɑJ��
					self.redirect('/a/' + self._tenant + '/personal/minfo/thanks')
					return

				# ���̓G���[������Ή�ʂɖ߂�
				else:
					ucfp.voinfo.setVo(vo, None, None, self)
			else:
				pass

			# CSRF�΍�:�g�[�N�����s
			ucfp.data['token'] = self.createCSRFToken(CSRF_TOKEN_KEY)

			ucfp.data['sub_mail_address'] = UcfUtil.getHashStr(user_vo, 'sub_mail_address')
			template_vals = {
				'ucfp' : ucfp,
				'vcmsg': ucfp.voinfo.validator.msg if ucfp.voinfo.validator != None else {},
				'is_hide_backstretch':self._career_type == UcfConfig.VALUE_CAREER_TYPE_TABLET,		# �A�N�Z�X�\���p���O�C����ʂŃ^�u���b�g�̏ꍇ�͂��������o���Ȃ�
			}
			self.appendBasicInfoToTemplateVals(template_vals)

			self.render('personal_minfo_index.html', self._design_type, template_vals)
		except BaseException, e:
			self.outputErrorLog(e)
			self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_SYSTEM_ERROR'), ()))
			return
Esempio n. 22
0
	def processOfRequest(self, tenant):
		CSRF_TOKEN_KEY = 'GENERAL'
		# �t�@�C���A�b�v���[�h�ł�����w�肷���NG�Ȃ̂ŃR�����g�A�E�g �ˁ@BlobstoreUploadHandler�g���ꍇ�͑��v���ۂ�
		# IE��json�t�@�C�����_�E�����[�h����Ă��܂��̂ŕύX 2013.09.12
		#self.response.headers['Content-Type'] = 'application/json'
		self.response.headers['Content-Type'] = 'text/html'
		try:
		
			# CSRF�΍�F�g�[�N���`�F�b�N
			if not self.checkCSRFToken(CSRF_TOKEN_KEY, self.request.get(UcfConfig.REQUESTKEY_CSRF_TOKEN)):
				self._code = 403
				self._msg = self.getMsg('MSG_CSRF_CHECK')
				self.responseAjaxResult()
				return
		
			if self.isValidTenant(not_redirect=True) == False:
				self._code = 400
				self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
				self.responseAjaxResult()
				return

			if loginfunc.checkLogin(self, not_redirect=True, not_check_authid=True) == False:			# not_check_authid=True�cBlobstoreUploadHandler�̉e����Cookie����l���擾�ł��Ȃ��̂ł��������̓`�F�b�N���Ȃ�
				self._code = 403
				self._msg = self.getMsg('MSG_NOT_LOGINED')
				self.responseAjaxResult()
				return

			# ���O�C�����̊e������擾���`�F�b�N
			is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(self, not_redirect=True, not_check_target_env=True)		# not_check_target_env=True�cBlobstoreUploadHandler�̉e�����A�N���C�A���gIP���ύX����Ă��܂����߃l�b�g���[�N��‹��̃`�F�b�N�͂��Ȃ�
			if is_select_ok == False:
				self._code = 403
				self._msg = error_msg
				self.responseAjaxResult()
				return

			if self.isAdmin() == False and self.isOperator(target_function=UcfConfig.DELEGATE_FUNCTION_OPERATOR_CONFIG) == False:
				self._code = 403
				self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
				self.responseAjaxResult()
				return

			file_id = self.getRequest('file_id')
			upload_files = self.get_uploads(file_id)  # 'file' is file upload field in the form
			if len(upload_files) <= 0:
				self._code = 500
				self._msg = self.getMsg('MSG_FAILED_FILE_IMPORT')
				self.responseAjaxResult()
				return

			# [0]�ɓ���Ă���o�C�i���f�[�^�擾
			blob_info = upload_files[0]
			blob_key = str(blob_info.key())

#			# �t�@�C�������邩�ȁ[
#			blob_reader = blobstore.BlobReader(blob_key)
#			csvfile = csv.reader(blob_reader, dialect=csv.excel)

			data_kind = self.getRequest('data_kind')
			# UCFMDLFile�̃f�[�^�L�[���쐬
			data_key = UcfUtil.guid()
			# �X�e�[�^�X=CREATING �ɂ� 1���R�[�h�lj����Ă����i�t�����g����̔��萧��Ȃǂ̂��߁j
			file_entry = FileUtils.insertNewCreatingRecord(self, data_key, data_kind)
			file_vo = file_entry.exchangeVo(self._timezone)
			file_vo['data_type'] = 'CSV'
			file_vo['content_type'] = blob_info.content_type
			file_vo['data_size'] = blob_info.size
			try:
				check_multibyte = unicode(blob_info.filename)
				file_vo['data_name'] = blob_info.filename
			except:
				file_vo['data_name'] = 'multi byte file name'					# TODO �}���`�o�C�g���Ή�...

			#file_vo['data_encoding'] = UcfConfig.DL_ENCODING
			file_encoding = UcfUtil.getHashStr(self.getDeptInfo(), 'file_encoding')
			if file_encoding == '' or file_encoding == 'SJIS':
				data_encoding = 'cp932'
			elif file_encoding == 'JIS':
				data_encoding = 'jis'
			elif file_encoding == 'EUC':
				data_encoding = 'euc-jp'
			elif file_encoding == 'UTF7':
				data_encoding = 'utf-7'
			elif file_encoding == 'UTF8':
				data_encoding = 'utf-8'
			elif file_encoding == 'UNICODE':
				data_encoding = 'utf-16'
			else:
				data_encoding = 'cp932'
			file_vo['data_encoding'] = data_encoding
			
			file_vo['blob_key'] = blob_key
			file_entry.margeFromVo(file_vo, self._timezone)
			file_entry.put()

			token = UcfUtil.guid()
			params = {
				 'key': blob_key
				,'data_key': data_key
				,'data_kind':data_kind
                ,'login_operator_id': self.getLoginOperatorID()
                ,'login_operator_unique_id': self.getLoginOperatorUniqueID()
                ,'login_operator_mail_address': self.getLoginOperatorMailAddress()
				,'login_operator_client_ip': self.getSession(UcfConfig.SESSIONKEY_CLIENTIP + '_' + self.request.get(UcfConfig.REQUESTKEY_CSRF_TOKEN))
			}
			import_q = taskqueue.Queue('csv-export-import')
			import_t = taskqueue.Task(
				url='/a/' + tenant + '/' + token + '/queue_csv_import',
				params=params,
        target=sateraito_func.getBackEndsModuleName(tenant),
				countdown='1'
			)
			import_q.add(import_t)
			self._code = 0
			self.responseAjaxResult()

		except BaseException, e:
			self.outputErrorLog(e)
			self._code = 999
			self.responseAjaxResult()
Esempio n. 23
0
    def processOfRequest(self, tenant):
        CSRF_TOKEN_KEY = 'UPLOAD'

        # �t�@�C���A�b�v���[�h�ł�����w�肷���NG�Ȃ̂ŃR�����g�A�E�g
        # self.response.headers['Content-Type'] = 'application/json'
        try:
            req = UcfVoInfo.setRequestToVo(self)
            logging.info(req)

            # CSRF�΍�F�g�[�N���`�F�b�N
            if not self.checkCSRFToken(CSRF_TOKEN_KEY,
                                       self.request.get(
                                           UcfConfig.REQUESTKEY_CSRF_TOKEN),
                                       without_refresh_token=True):
                self._code = 403
                self._msg = self.getMsg('MSG_CSRF_CHECK')
                self.responseAjaxResult()
                return

            if self.isValidTenant(not_redirect=True) == False:
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
                self.responseAjaxResult()
                return

            if loginfunc.checkLogin(self, not_redirect=True) == False:
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            # ���O�C�����̊e������擾���`�F�b�N
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if is_select_ok == False:
                self._code = 403
                self._msg = error_msg

                # �}�C�y�[�W��icon�A�b�v�@�\�̂��߂����̃`�F�b�N�͂Ȃ��Ƃ���i��ʕ\���Ő��䂵�Ă���̂Łj
                ## �L���Ń`�F�b�N
                #if sateraito_func.isFreeMode(self._tenant):
                #	self._code = 403
                self.responseAjaxResult()
                return
            #	self._msg = self.getMsg('MSG_NOAVAILABLE_FREE_APP')
            #	self.responseAjaxResult()
            #	return

            if self.isAdmin() == False:
                self._code = 403
                self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
                self.responseAjaxResult()
                return

            # �f�U�C���^�C�v
            design_type = UcfUtil.nvl(self.getRequest('dtp'))
            if design_type == '':
                design_type = UcfConfig.TEMPLATE_DEFAULT_DESIGN_TYPE

            # �摜ID
            picture_id = UcfUtil.nvl(self.getRequest('picture_id'))
            # �摜ID�`�F�b�N
            #if picture_id not in ['logo', 'mainbg01', 'mainbg02', 'mainbg03', 'mainbg04', 'mainbg05', 'mainbg06', 'mainbg07', 'mainbg08', 'mainbg09', 'mainbg10']:
            #if picture_id not in ['icon', 'logo', 'mainbg01', 'mainbg02', 'mainbg03', 'mainbg04', 'mainbg05', 'mainbg06', 'mainbg07', 'mainbg08', 'mainbg09', 'mainbg10']:
            if picture_id not in [
                    'boticon', 'icon', 'logo', 'mainbg01', 'mainbg02',
                    'mainbg03', 'mainbg04', 'mainbg05', 'mainbg06', 'mainbg07',
                    'mainbg08', 'mainbg09', 'mainbg10'
            ]:
                self._code = 400
                self._msg = self.getMsg('MSG_INVALID_PARAMETER',
                                        ('picture_id'))
                self.responseAjaxResult()
                return

            file_id = self.request.get('file_id')  # custom_id
            blob_data = self.request.get(file_id)

            logging.info(blob_data)

            # �`���`�F�b�N
            try:
                im = images.Image(blob_data)
                image_format = im.format
                if image_format != 0 and image_format != 1:  # png or jpg
                    logging.info('fail in try')
                    self._code = 500
                    self._msg = self.getMsg('MSG_INVALID_PICTURE_FORMAT')
                    self.responseAjaxResult()
                    return
            except images.NotImageError, e:
                logging.info('fail in except')
                self._code = 500
                self._msg = self.getMsg('MSG_INVALID_PICTURE_FORMAT')
                self.responseAjaxResult()
                return

            # �T�C�Y�`�F�b�N
            logging.info('size=' + str(len(blob_data)))
            if len(blob_data) > 1024000 - 100:  # 1MB����x
                self._code = 500
                self._msg = self.getMsg('MSG_TOO_LARGE_PICTURE_SIZE')
                self.responseAjaxResult()
                return

            # ��ƃ}�X�^����Ώۂ̊����f�[�^�L�[���擾
            data_key_field = ''
            file_name = ''
            content_type = None
            last_modified = ''
            # ���S
            if picture_id == 'logo':
                data_key_field = 'logo_data_key'
                file_name = 'Logo.png'
                content_type = 'image/png'
#				if blob_data:
#					blob_data = images.resize(blob_data, 295, 44)
# ���O�C����ʔw�i�摜
            elif picture_id == 'mainbg01':
                data_key_field = 'login_background_' + design_type + '1_data_key'
                file_name = '01.jpg'
                content_type = 'image/jpeg'
#				if design_type == UcfConfig.VALUE_DESIGN_TYPE_PC:
#					blob_data = images.resize(blob_data, 956, 532)
#				elif design_type == UcfConfig.VALUE_DESIGN_TYPE_SP:
#					blob_data = images.resize(blob_data, 320, 356)
            elif picture_id == 'mainbg02':
                data_key_field = 'login_background_' + design_type + '2_data_key'
                file_name = '02.jpg'
                content_type = 'image/jpeg'
#				if design_type == UcfConfig.VALUE_DESIGN_TYPE_PC:
#					blob_data = images.resize(blob_data, 956, 532)
#				elif design_type == UcfConfig.VALUE_DESIGN_TYPE_SP:
#					blob_data = images.resize(blob_data, 320, 356)
            elif picture_id == 'mainbg03':
                data_key_field = 'login_background_' + design_type + '3_data_key'
                file_name = '03.jpg'
                content_type = 'image/jpeg'
#				if design_type == UcfConfig.VALUE_DESIGN_TYPE_PC:
#					blob_data = images.resize(blob_data, 956, 532)
#				elif design_type == UcfConfig.VALUE_DESIGN_TYPE_SP:
#					blob_data = images.resize(blob_data, 320, 356)
            elif picture_id == 'mainbg04':
                data_key_field = 'login_background_' + design_type + '4_data_key'
                file_name = '04.jpg'
                content_type = 'image/jpeg'
#				if design_type == UcfConfig.VALUE_DESIGN_TYPE_PC:
#					blob_data = images.resize(blob_data, 956, 532)
#				elif design_type == UcfConfig.VALUE_DESIGN_TYPE_SP:
#					blob_data = images.resize(blob_data, 320, 356)
            elif picture_id == 'mainbg05':
                data_key_field = 'login_background_' + design_type + '5_data_key'
                file_name = '05.jpg'
                content_type = 'image/jpeg'
#				if design_type == UcfConfig.VALUE_DESIGN_TYPE_PC:
#					blob_data = images.resize(blob_data, 956, 532)
#				elif design_type == UcfConfig.VALUE_DESIGN_TYPE_SP:
#					blob_data = images.resize(blob_data, 320, 356)
            elif picture_id == 'mainbg06':
                data_key_field = 'login_background_' + design_type + '6_data_key'
                file_name = '06.jpg'
                content_type = 'image/jpeg'
#				if design_type == UcfConfig.VALUE_DESIGN_TYPE_PC:
#					blob_data = images.resize(blob_data, 956, 532)
#				elif design_type == UcfConfig.VALUE_DESIGN_TYPE_SP:
#					blob_data = images.resize(blob_data, 320, 356)
            elif picture_id == 'mainbg07':
                data_key_field = 'login_background_' + design_type + '7_data_key'
                file_name = '07.jpg'
                content_type = 'image/jpeg'
#				if design_type == UcfConfig.VALUE_DESIGN_TYPE_PC:
#					blob_data = images.resize(blob_data, 956, 532)
#				elif design_type == UcfConfig.VALUE_DESIGN_TYPE_SP:
#					blob_data = images.resize(blob_data, 320, 356)
            elif picture_id == 'mainbg08':
                data_key_field = 'login_background_' + design_type + '8_data_key'
                file_name = '08.jpg'
                content_type = 'image/jpeg'
#				if design_type == UcfConfig.VALUE_DESIGN_TYPE_PC:
#					blob_data = images.resize(blob_data, 956, 532)
#				elif design_type == UcfConfig.VALUE_DESIGN_TYPE_SP:
#					blob_data = images.resize(blob_data, 320, 356)
            elif picture_id == 'mainbg09':
                data_key_field = 'login_background_' + design_type + '9_data_key'
                file_name = '09.jpg'
                content_type = 'image/jpeg'
#				if design_type == UcfConfig.VALUE_DESIGN_TYPE_PC:
#					blob_data = images.resize(blob_data, 956, 532)
#				elif design_type == UcfConfig.VALUE_DESIGN_TYPE_SP:
#					blob_data = images.resize(blob_data, 320, 356)
            elif picture_id == 'mainbg10':
                data_key_field = 'login_background_' + design_type + '10_data_key'
                file_name = '10.jpg'
                content_type = 'image/jpeg'


#				if design_type == UcfConfig.VALUE_DESIGN_TYPE_PC:
#					blob_data = images.resize(blob_data, 956, 532)
#				elif design_type == UcfConfig.VALUE_DESIGN_TYPE_SP:
#					blob_data = images.resize(blob_data, 320, 356)
            elif picture_id == 'icon':
                pass
            elif picture_id == 'boticon':
                pass

            if picture_id not in ['icon', 'boticon']:
                data_key = UcfUtil.nvl(self.getDeptInfo(True)[data_key_field])
            else:
                data_key = self.request.get('data_key')

            file_entry = None
            file_vo = None
            if data_key != '':
                file_entry = FileUtils.getDataEntryByDataKey(self, data_key)

            #logging.info(db.Blob(blob_data))

            # ����΍����ւ�
            if file_entry is not None:
                file_entry.blob_data = db.Blob(blob_data)
                file_entry.last_upload_date = UcfUtil.getNow()
                file_entry.last_upload_operator_id = UcfUtil.nvl(
                    self.getLoginID())
                file_entry.last_upload_operator_unique_id = UcfUtil.nvl(
                    self.getLoginOperatorUniqueID())
                #				file_vo['upload_operator_id'] = login_operator_id
                #				file_vo['upload_operator_unique_id'] = login_operator_unique_id
                file_entry.updater_name = UcfUtil.nvl(self.getLoginID())
                file_entry.date_changed = UcfUtil.getNow()
                file_entry.put()

            # �f�[�^�L�[���Ȃ����A�t�@�C���G���g���[���Ȃ���ΐV�K�쐬
            elif file_entry is None:

                if picture_id not in ['icon', 'boticon']:
                    dept = DeptUtils.getDeptEntryByUniqueID(
                        self, UcfUtil.nvl(self.getDeptInfo(True)['unique_id']))
                    dept_vo = dept.exchangeVo(self._timezone)
                    DeptUtils.editVoForSelect(self, dept_vo)

                unique_id = UcfUtil.guid()
                data_key = UcfUtil.guid()  # data_key ���ꉞ�쐬���Ȃ���
                file_vo = {}
                file_vo['unique_id'] = unique_id
                file_vo['data_key'] = data_key
                file_vo['data_kind'] = 'picture'
                file_vo['data_type'] = 'BINARY'
                #file_vo['content_type'] = content_type
                file_vo['deal_status'] = ''
                file_vo['status'] = ''

                FileUtils.editVoForRegist(self, file_vo,
                                          UcfConfig.EDIT_TYPE_NEW)

                file_entry = UCFMDLFile(unique_id=unique_id,
                                        key_name=FileUtils.getKey(
                                            self, file_vo))
                file_entry.margeFromVo(file_vo, self._timezone)
                file_entry.blob_data = db.Blob(blob_data)
                file_entry.last_upload_date = UcfUtil.getNow()
                file_entry.last_upload_operator_id = UcfUtil.nvl(
                    self.getLoginID())
                file_entry.last_upload_operator_unique_id = UcfUtil.nvl(
                    self.getLoginOperatorUniqueID())
                file_entry.upload_operator_id = UcfUtil.nvl(self.getLoginID())
                file_entry.upload_operator_unique_id = UcfUtil.nvl(
                    self.getLoginOperatorUniqueID())
                file_entry.updater_name = UcfUtil.nvl(self.getLoginID())
                file_entry.date_changed = UcfUtil.getNow()
                file_entry.creator_name = UcfUtil.nvl(self.getLoginID())
                file_entry.date_created = UcfUtil.getNow()
                file_entry.put()

                # ��ƃ}�X�^��data_key���Z�b�g
                if picture_id not in ['icon', 'boticon']:
                    dept_vo[data_key_field] = data_key
                    DeptUtils.editVoForRegist(self, dept_vo, None,
                                              UcfConfig.EDIT_TYPE_RENEW)
                    dept.margeFromVo(dept_vo, self._timezone)
                    dept.updater_name = UcfUtil.nvl(self.getLoginID())
                    dept.date_changed = UcfUtil.getNow()
                    dept.put()

            # ������memcache���X�V���邱�Ƃɂ��A�b�v�シ���ɔ��f�����悤�ɂ���Ɠ����ɁAmemcache�̎��Ԃ𒷂����ĂقƂ��DB�ɃA�N�Z�X����Ȃ��悤�ɂ���
            if picture_id in ['icon', 'boticon']:
                memcache_key = 'tenant_picture?tenant=' + tenant + '&picture_id=' + picture_id + '&data_key=' + data_key
                memcache_key2 = 'tenant_picture2?tenant=' + tenant + '&picture_id=' + picture_id + '&data_key=' + data_key
                memcache_key3 = 'tenant_picture3?tenant=' + tenant + '&picture_id=' + picture_id + '&data_key=' + data_key
                memcache_key4 = 'tenant_picture4?tenant=' + tenant + '&picture_id=' + picture_id + '&data_key=' + data_key
                memcache_time = 3600 * 24
                memcache.set(key=memcache_key,
                             value=file_entry.blob_data,
                             time=memcache_time)
                memcache.set(key=memcache_key2,
                             value=content_type,
                             time=memcache_time)
                memcache.set(key=memcache_key3,
                             value=file_name,
                             time=memcache_time)
                memcache.set(key=memcache_key4,
                             value=str(file_entry.last_upload_date),
                             time=memcache_time)
            else:
                memcache_key = 'tenant_picture?tenant=' + tenant + '&picture_id=' + picture_id + '&designe_type=' + design_type
                memcache_key2 = 'tenant_picture2?tenant=' + tenant + '&picture_id=' + picture_id + '&designe_type=' + design_type
                memcache_key3 = 'tenant_picture3?tenant=' + tenant + '&picture_id=' + picture_id + '&designe_type=' + design_type
                memcache_key4 = 'tenant_picture4?tenant=' + tenant + '&picture_id=' + picture_id + '&designe_type=' + design_type
                memcache_time = 3600 * 24
                memcache.set(key=memcache_key,
                             value=file_entry.blob_data,
                             time=memcache_time)
                memcache.set(key=memcache_key2,
                             value=content_type,
                             time=memcache_time)
                memcache.set(key=memcache_key3,
                             value=file_name,
                             time=memcache_time)
                memcache.set(key=memcache_key4,
                             value=str(file_entry.last_upload_date),
                             time=memcache_time)
                # memcache���X�V
                self.getDeptInfo(is_force_select=True)

            # �I�y���[�V�������O�o��
            operation_log_detail = {}
            operation_log_detail['design_type'] = design_type
            operation_log_detail['picture_id'] = picture_id
            UCFMDLOperationLog.addLog(
                self.getLoginOperatorMailAddress(),
                self.getLoginOperatorUniqueID(), UcfConfig.SCREEN_DASHBOARD,
                UcfConfig.OPERATION_TYPE_ADD_PICTURE, '', '',
                self.getClientIPAddress(),
                json.JSONEncoder().encode(operation_log_detail))

            self._code = 0
            self.responseAjaxResult(ret_value={'data_key': data_key})
Esempio n. 24
0
    def processOfRequest(self, tenant):
        try:
            if not self.isValidTenant(not_redirect=True):
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', self._tenant)
                self.responseAjaxResult()
                return

            if not loginfunc.checkLogin(self, not_redirect=True):
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if not is_select_ok:
                self._code = 403
                self._msg = error_msg
                self.responseAjaxResult()
                return

            if not self.isAdmin():
                self._code = 403
                self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
                self.responseAjaxResult()
                return

            # Javascriptから、パラメータ取得
            req = UcfVoInfo.setRequestToVo(self)

            unique_id = req['unique_id']
            if unique_id == '':
                unique_id = UcfUtil.guid()

            platform = req['platform']
            is_saved = True if req['is_saved'] == '1' else False

            if platform == 'directcloudbox':
                code = req['code']
                uid = req['uid']
                password = req['password']

                check_access_token = directcloudbox_func.checkAccessToken(
                    unique_id, code, uid, password, is_saved)
                if check_access_token == 0:
                    self._code = 401
                    self._msg = self.getMsg(
                        'ERR_DIRECT_CLOUD_BOX_ACCOUNT_INVALID1')
                    self.responseAjaxResult()
                    return
                elif check_access_token == 1:
                    self._code = 500
                    self._msg = self.getMsg('ERR_FAILED_TO_CALL_API')
                    self.responseAjaxResult()
                    return
                elif check_access_token == 2:
                    self._code = 500
                    self._msg = self.getMsg(
                        'ERR_DIRECT_CLOUD_BOX_ACCOUNT_INVALID2')
                    self.responseAjaxResult()
                    return

            operation_log_detail = req
            UCFMDLOperationLog.addLog(
                self.getLoginOperatorMailAddress(),
                self.getLoginOperatorUniqueID(), UcfConfig.SCREEN_DASHBOARD,
                UcfConfig.OPERATION_TYPE_MODIFY_DIRECTCLOUDBOX_CONFIG, '', '',
                self.getClientIPAddress(),
                JSONEncoder().encode(operation_log_detail))

            self._code = 0
            ret_value = {'unique_id': unique_id}
            self.responseAjaxResult(ret_value)

        except BaseException, e:
            self.outputErrorLog(e)
            self._code = 999
            self.responseAjaxResult()
Esempio n. 25
0
    def processOfRequest(self, tenant):

        CSRF_TOKEN_KEY = 'operator'

        try:
            self._approot_path = os.path.dirname(__file__)
            if self.isValidTenant() == False:
                return

            if loginfunc.checkLogin(self) == False:
                return

            # 権限チェック
            if self.isAdmin() == False and self.isOperator(
                    target_function=UcfConfig.DELEGATE_FUNCTION_OPERATOR_CONFIG
            ) == False:
                #				self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')))
                self.redirect('/a/' + tenant + '/personal/')
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self)
            if is_select_ok == False:
                return
            # パスワード次回変更フラグをチェック
            if self.checkForcePasswordChange() == False:
                return

            # Requestからvoにセット
            req = UcfVoInfo.setRequestToVo(self)

            # チェックボックス値補正(TODO 本来はフロントからPOSTするようにExtJsなどで処理すべきが取り急ぎ)
            OperatorUtils.setNotPostValue(self, req)

            # 詳細
            edit_type = UcfUtil.getHashStr(req, UcfConfig.QSTRING_TYPE)
            # ユニークキー
            unique_id = UcfUtil.getHashStr(req, UcfConfig.QSTRING_UNIQUEID)
            if edit_type != UcfConfig.EDIT_TYPE_REFER:
                self.redirectError(
                    UcfMessage.getMessage(self.getMsg('MSG_INVALID_ACCESS')))
                return
            if unique_id == '':
                self.redirectError(
                    UcfMessage.getMessage(self.getMsg('MSG_INVALID_ACCESS')))
                return

            ucfp = UcfTenantParameter(self)
            vo = {}
            entry_vo = {}

            entry = OperatorUtils.getData(self, unique_id)
            if entry is None:
                self.redirectError(
                    UcfMessage.getMessage(self.getMsg('MSG_NOT_EXIST_DATA')))
                return
            vo = entry.exchangeVo(self._timezone)  # 既存データをVoに変換
            OperatorUtils.editVoForSelect(
                self, vo, is_with_parent_group_info=True)  # データ加工(取得用)

            # 委託管理者の場合は自分がアクセスできる管理グループかをチェック
            if self.isOperator(
            ) and not ucffunc.isDelegateTargetManagementGroup(
                    UcfUtil.getHashStr(vo, 'management_group'),
                    UcfUtil.csvToList(
                        self.getLoginOperatorDelegateManagementGroups())):
                self.redirectError(
                    UcfMessage.getMessage(
                        self.getMsg(
                            'MSG_INVALID_ACCESS_BY_DELEGATE_MANAGEMENT_GROUPS')
                    ))
                return

            ucfp.voinfo.setVo(vo, OperatorViewHelper(), None, self)

            # CSRF対策:トークン発行
            ucfp.data['token'] = self.createCSRFToken(CSRF_TOKEN_KEY +
                                                      unique_id)

            ucfp.data['gnaviid'] = _gnaviid
            ucfp.data['leftmenuid'] = _leftmenuid
            ucfp.data['explains'] = [self.getMsg('EXPLAIN_OPERATOR_HEADER')]
            ucfp.data[UcfConfig.QSTRING_TYPE] = UcfUtil.nvl(
                self.getRequest(UcfConfig.QSTRING_TYPE))

            template_vals = {
                'ucfp': ucfp,
                'vcmsg': ucfp.voinfo.validator.msg
                if ucfp.voinfo.validator != None else {},
            }
            self.appendBasicInfoToTemplateVals(template_vals)

            self.render('operator_detail.html', self._design_type,
                        template_vals)
        except BaseException, e:
            self.outputErrorLog(e)
            self.redirectError(
                UcfMessage.getMessage(self.getMsg('MSG_SYSTEM_ERROR'), ()))
            return
Esempio n. 26
0
    def processOfRequest(self, tenant):

        logging.info('**** requests *********************')
        logging.info(self.request)

        try:

            if self.isValidTenant(not_redirect=True) is False:
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', self._tenant)
                self.responseAjaxResult()
                return

            if loginfunc.checkLogin(self, not_redirect=True) is False:
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if is_select_ok is False:
                self._code = 403
                self._msg = error_msg
                self.responseAjaxResult()
                return

            if self.isAdmin() is False:
                self._code = 403
                self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
                self.responseAjaxResult()
                return

            # Requestからvoにセット
            req = UcfVoInfo.setRequestToVo(self)
            logging.info(req)

            # 検索条件
            # sk_keyword = UcfUtil.getHashStr(req, 'sk_keyword').strip()
            # sk_search_type = 'fulltext' if sk_keyword != '' else ''

            bot_no = self.request.get('bot_no')
            # bot_no = 9999

            open_api_id = self.request.get('open_api_id')
            consumer_key = self.request.get('consumer_key')
            server_id = self.request.get('server_id')
            priv_key = self.request.get('priv_key')

            # 入力チェック
            if open_api_id == '' or consumer_key == '' or server_id == '' or priv_key == '':
                self._code = 400
                self._msg = self.getMsg('ERR_EMPTY_LINEWORKSAPIKEYS')
                self.responseAjaxResult()
                return

            result = lineworks_func.callLineWorksAPIBotAction(
                '/message/v1', open_api_id, consumer_key, server_id, priv_key,
                {}, 'GET', bot_no, 'get_bot')
            result_json = json.JSONDecoder().decode(result.content)

            bot_vo = {
                'bot_no': bot_no,
                'bot_name': result_json.get('name', ''),
                'bot_photourl': result_json.get('photoUrl', ''),
                'bot_url': result_json.get('callbackUrl', ''),
                'bot_description': result_json.get('description', ''),
                'bot_manager':
                UcfUtil.listToCsv(result_json.get('managers', []))
            }

            ret_value = {'all_count': 0, 'bot_vo': bot_vo}

            self._code = 0
            self.responseAjaxResult(ret_value)

        except BaseException, e:
            self.outputErrorLog(e)
            self._code = 999
            self.responseAjaxResult()
Esempio n. 27
0
    def processOfRequest(self, tenant):

        CSRF_TOKEN_KEY = 'operator_changeid'

        try:
            self._approot_path = os.path.dirname(__file__)
            if self.isValidTenant() == False:
                return

            if loginfunc.checkLogin(self) == False:
                return

            # 権限チェック
            if self.isAdmin() == False and self.isOperator(
                    target_function=UcfConfig.DELEGATE_FUNCTION_OPERATOR_CONFIG
            ) == False:
                #				self.redirectError(UcfMessage.getMessage(self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')))
                self.redirect('/a/' + tenant + '/personal/')
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self)
            if is_select_ok == False:
                return
            # パスワード次回変更フラグをチェック
            if self.checkForcePasswordChange() == False:
                return

            # Requestからvoにセット
            req = UcfVoInfo.setRequestToVo(self)

            # ユニークキー
            unique_id = UcfUtil.getHashStr(req, UcfConfig.QSTRING_UNIQUEID)
            if unique_id == '':
                self.redirectError(
                    UcfMessage.getMessage(self.getMsg('MSG_INVALID_ACCESS')))
                return

            ucfp = UcfTenantParameter(self)
            entry_vo = {}
            entry = OperatorUtils.getData(self, unique_id)
            if entry is None:
                self.redirectError(
                    UcfMessage.getMessage(self.getMsg('MSG_NOT_EXIST_DATA')))
                return

            entry_vo = entry.exchangeVo(self._timezone)  # 既存データをVoに変換
            OperatorUtils.editVoForSelect(
                self, entry_vo, is_with_parent_group_info=False)  # データ加工(取得用)

            # 委託管理者の場合は自分がアクセスできる管理グループかをチェック
            if self.isOperator(
            ) and not ucffunc.isDelegateTargetManagementGroup(
                    UcfUtil.getHashStr(entry_vo, 'management_group'),
                    UcfUtil.csvToList(
                        self.getLoginOperatorDelegateManagementGroups())):
                self.redirectError(
                    UcfMessage.getMessage(
                        self.getMsg(
                            'MSG_INVALID_ACCESS_BY_DELEGATE_MANAGEMENT_GROUPS')
                    ))
                return

            ucfp.voinfo.setVo(entry_vo, None, None, self)

            # CSRF対策:トークン発行
            ucfp.data['token'] = self.createCSRFToken(CSRF_TOKEN_KEY +
                                                      unique_id)

            ucfp.data['gnaviid'] = _gnaviid
            ucfp.data['leftmenuid'] = _leftmenuid
            ucfp.data['explains'] = [self.getMsg('EXPLAIN_OPERATOR_HEADER')]
            ucfp.data[UcfConfig.QSTRING_TYPE] = UcfUtil.nvl(
                self.getRequest(UcfConfig.QSTRING_TYPE))

            # ドメインリストを作成
            #domain_list = []
            #domain_list.extend(UcfUtil.csvToList(UcfUtil.getHashStr(self.getDeptInfo(), 'federated_domains')))
            #domain_list = sateraito_func.getFederatedDomainList(self._tenant, is_with_cache=True)

            template_vals = {
                'ucfp': ucfp,
                'vcmsg': ucfp.voinfo.validator.msg
                if ucfp.voinfo.validator != None else {},
                #'is_multidomain':True if len(domain_list) > 1 else False,
                #'domain_list':JSONEncoder().encode(domain_list)
            }
            self.appendBasicInfoToTemplateVals(template_vals)

            self.render('operator_changeid.html', self._design_type,
                        template_vals)
        except BaseException, e:
            self.outputErrorLog(e)
            self.redirectError(
                UcfMessage.getMessage(self.getMsg('MSG_SYSTEM_ERROR'), ()))
            return
Esempio n. 28
0
    def processOfRequest(self, tenant):
        try:
            if self.isValidTenant(not_redirect=True) == False:
                self._code = 400
                self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
                self.responseAjaxResult()
                return

            if loginfunc.checkLogin(self, not_redirect=True) == False:
                self._code = 403
                self._msg = self.getMsg('MSG_NOT_LOGINED')
                self.responseAjaxResult()
                return

            # ログイン時の各種情報を取得&チェック
            is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(
                self, not_redirect=True)
            if is_select_ok == False:
                self._code = 403
                self._msg = error_msg
                self.responseAjaxResult()
                return

            if self.isAdmin() == False and self.isOperator() == False:
                self._code = 403
                self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
                self.responseAjaxResult()
                return

            # Requestからvoにセット
            req = UcfVoInfo.setRequestToVo(self)

            start = int(req['start'])
            limit = int(req['limit'])

            data_kind = UcfUtil.getHashStr(req, 'data_kind')

            # 検索
            gql = ''
            wheres = []
            if data_kind != '':
                #wheres.append("data_kind = '" + UcfUtil.escapeGql(data_kind) + "'")
                if data_kind == 'exportaccountcsv':
                    wheres.append("data_kind IN (" + UcfUtil.listToGqlInQuery([
                        'exportaccountcsv', 'exportcontactcsv',
                        'exportworkflowcsv'
                    ]) + ")")
                else:
                    wheres.append("data_kind = '" +
                                  UcfUtil.escapeGql(data_kind) + "'")
            # 委託管理者なら自分が触れるデータのみ対象
            if self.isOperator(
            ) and self.getLoginOperatorDelegateManagementGroups() != '':
                if data_kind == 'exportusercsv' or data_kind == 'exportgroupcsv' or data_kind == 'exportoperatorcsv':
                    wheres.append(
                        "download_operator_unique_id = '" +
                        UcfUtil.escapeGql(self.getLoginOperatorUniqueID()) +
                        "'")
                elif data_kind == 'importusercsv' or data_kind == 'importgroupcsv' or data_kind == 'importoperatorcsv':
                    wheres.append(
                        "upload_operator_unique_id = '" +
                        UcfUtil.escapeGql(self.getLoginOperatorUniqueID()) +
                        "'")

            gql += UcfUtil.getToGqlWhereQuery(wheres)
            models = UCFMDLFile.gql(gql)
            count = 0
            fetch_data = None
            if models:
                count = models.count()
                fetch_data = models.fetch(limit, start)
            result_list = []
            for model in fetch_data:
                vo = model.exchangeVo(self._timezone)
                FileUtils.editVoForSelect(self, vo)
                result_list.append(vo)

            ret_value = {'all_count': str(count), 'records': result_list}

            self._code = 0
            self.responseAjaxResult(ret_value)

        except BaseException, e:
            self.outputErrorLog(e)
            self._code = 999
            self.responseAjaxResult()
Esempio n. 29
0
	def processOfRequest(self, tenant):
		try:
			if self.isValidTenant(not_redirect=True) == False:
				self._code = 400
				self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
				self.responseAjaxResult()
				return

			if loginfunc.checkLogin(self, not_redirect=True) == False:
				self._code = 403
				self._msg = self.getMsg('MSG_NOT_LOGINED')
				self.responseAjaxResult()
				return

			# ���O�C�����̊e������擾���`�F�b�N
			is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(self, not_redirect=True)
			if is_select_ok == False:
				self._code = 403
				self._msg = error_msg
				self.responseAjaxResult()
				return

			if self.isAdmin() == False and self.isOperator(target_function=UcfConfig.DELEGATE_FUNCTION_OPERATOR_CONFIG) == False:
				self._code = 403
				self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
				self.responseAjaxResult()
				return

			# Request����vo�ɃZ�b�g
			req = UcfVoInfo.setRequestToVo(self)

			start = int(req['start'])
			limit = int(req['limit'])

			# ��������
			sk_keyword = UcfUtil.getHashStr(req, 'sk_keyword').strip()
			# �����^�C�v�i���[���A�h���X�A�Ј��ԍ��A�L�[���[�h�j
			sk_search_type = UcfUtil.getHashStr(req, 'sk_search_type')

			# ���[�U�[����
			users_list = []
			count = 0

			# �t���e�L�X�g����
			if sk_search_type == 'fulltext' and sk_keyword != '':
				users_list = OperatorUtils.searchDocsByFullText(self, sk_keyword, limit, offset=start)
				for vo in users_list:
					OperatorUtils.editVoForList(self, vo)

			# �ʏ팟��
			else:
				q = UCFMDLOperator.query()
				# �t���e�L�X�g�����ŃL�[���[�h���Ȃ��ꍇ
				if sk_search_type == 'fulltext':
					pass
				# ���[���A�h���X
				else:
					if sk_keyword != '':
						q = q.filter(UCFMDLOperator.operator_id_lower >= sk_keyword.lower())
						q = q.filter(UCFMDLOperator.operator_id_lower < ''.join(sk_keyword.lower() + u'\uFFE0'))
				# �ϑ��Ǘ��҂Ȃ玩�����G���f�[�^�̂ݑΏ�
				if self.isOperator() and self.getLoginOperatorDelegateManagementGroups() != '':
					q = q.filter(UCFMDLOperator.management_group.IN(UcfUtil.csvToList(self.getLoginOperatorDelegateManagementGroups())))
				q = q.order(UCFMDLOperator.operator_id_lower)			# �L�[�����j�[�NID�ɕύX�����̂� 2017.03.09
				for entry in q.iter(limit=limit, offset=start):
					vo = entry.exchangeVo(self._timezone)
					OperatorUtils.editVoForList(self, vo)
					list_vo = {}
					# �N���C�A���g�Ƀt���œn���̂��Z�L�����e�B�A�p�t�H�[�}���X�I�ɂ悭�Ȃ��̂Ŏg�����ڂ����ɂ���
					for k,v in vo.iteritems():
						#if k in ['unique_id','operator_id','mail_address','employee_id','display_name','federation_identifier','access_authority','account_stop_flag','login_lock_flag','profile_infos']:
						if k in ['unique_id','operator_id','mail_address','display_name','federation_identifier','access_authority','account_stop_flag','login_lock_flag']:
							list_vo[k] = v
					users_list.append(list_vo)

			ret_value = {
				 #'all_count': str(count),
				'all_count': str(1000),
				'records': users_list,
			}

			self._code = 0
			self.responseAjaxResult(ret_value)

		except BaseException, e:
			self.outputErrorLog(e)
			self._code = 999
			self.responseAjaxResult()
Esempio n. 30
0
	def processOfRequest(self, tenant):
		try:
			if self.isValidTenant(not_redirect=True) == False:
				self._code = 400
				self._msg = self.getMsg('MSG_NOT_INSTALLED', (self._tenant))
				self.responseAjaxResult()
				return

			if loginfunc.checkLogin(self, not_redirect=True) == False:
				self._code = 403
				self._msg = self.getMsg('MSG_NOT_LOGINED')
				self.responseAjaxResult()
				return

			# ���O�C�����̊e������擾���`�F�b�N
			is_select_ok, user_vo, profile_vo, error_msg = loginfunc.checkLoginInfo(self, not_redirect=True)
			if is_select_ok == False:
				self._code = 403
				self._msg = error_msg
				self.responseAjaxResult()
				return

			if self.isAdmin() == False and self.isOperator(target_function=UcfConfig.DELEGATE_FUNCTION_OPERATOR_CONFIG) == False:
				self._code = 403
				self._msg = self.getMsg('MSG_INVALID_ACCESS_AUTHORITY')
				self.responseAjaxResult()
				return

			# Request����vo�ɃZ�b�g
			req = UcfVoInfo.setRequestToVo(self)

			start = int(req['start'])
			limit = int(req['limit'])

			# ��������
			sk_keyword = UcfUtil.getHashStr(req, 'sk_keyword').strip()
			# �����^�C�v�i���[���A�h���X�A�Ј��ԍ��A�L�[���[�h�j
			sk_search_type = UcfUtil.getHashStr(req, 'sk_search_type')

			# ���[�U�[����
			users_list = []
			count = 0

			# q = ExcelTemplateFile()
			# q = q.order(-ExcelTemplateFile.created_datetime)

			q = ExcelTemplateFile.query()
			# q = q.filter(UCFMDLOperator.operator_id_lower >= sk_keyword.lower())
			
			for entry in q.iter(limit=limit, offset=start):
				vo = entry.exchangeVo(self._timezone)
				# OperatorUtils.editVoForList(self, vo)
				list_vo = {}
				for k,v in vo.iteritems():
					if k in ['url', 'tenant', 'filename']:
						list_vo[k] = v
				users_list.append(list_vo)
			logging.info(users_list)
			ret_value = {
				 #'all_count': str(count),
				'all_count': str(1000),
				'records': users_list,
			}

			self._code = 0
			self.responseAjaxResult(ret_value)

		except BaseException, e:
			print(e)
			self.outputErrorLog(e)
			self._code = 999
			self.responseAjaxResult()