function execute() { $context = $this->getContext(); $controller = $context->getController(); $request = $context->getRequest(); $user = $context->getUser(); $acs_user_info_row = $user->getAttribute('acs_user_info_row'); $user_id = $user->getAttribute('login_user_id'); if ($user_id == null || $user_id == "") { if (ACSSystem::check_connect_outside() != "0") { // LDAP接続エラーの場合、処理終了 $this->setError($controller, $request, $user, 'login_input', ACSMsg::get_msg('Common', 'GlobalSecureAction.class.php', 'M002')); } else { if ($_POST['userid'] != NULL && $_POST['userid'] != "") { // エラーの場合、処理終了 $this->setError($controller, $request, $user, 'login_input', ACSMsg::get_msg('Common', 'GlobalSecureAction.class.php', 'M001')); } } return View::INPUT; } if ($acs_user_info_row['is_acs_user']) { // ログ登録: ログイン ACSLog::set_log($acs_user_info_row, 'Login', true, "[UserID:" . $acs_user_info_row['user_id'] . "]"); // ラストログイン登録 ACSUser::set_last_login($acs_user_info_row); header("Location: ./" . $_SERVER['REQUEST_URI']); } }
/** * ユーザ情報(プロフィール)をセットする * * @param $acs_user_info_row * @param ユーザ情報(プロフィール) * @return 成功(true) / 失敗(false) */ static function set_user_profile($acs_user_info_row, $form) { $user_community_id = $form['id']; $contents_type_master_array = ACSDB::get_master_array('contents_type'); $contents_type_code_array['self'] = array_search(ACSMsg::get_mst('contents_type_master', 'D00'), $contents_type_master_array); $contents_type_code_array['user_name'] = array_search(ACSMsg::get_mst('contents_type_master', 'D01'), $contents_type_master_array); $contents_type_code_array['mail_addr'] = array_search(ACSMsg::get_mst('contents_type_master', 'D02'), $contents_type_master_array); $contents_type_code_array['belonging'] = array_search(ACSMsg::get_mst('contents_type_master', 'D03'), $contents_type_master_array); $contents_type_code_array['speciality'] = array_search(ACSMsg::get_mst('contents_type_master', 'D04'), $contents_type_master_array); $contents_type_code_array['birthplace'] = array_search(ACSMsg::get_mst('contents_type_master', 'D05'), $contents_type_master_array); $contents_type_code_array['birthday'] = array_search(ACSMsg::get_mst('contents_type_master', 'D06'), $contents_type_master_array); $contents_type_code_array['community_profile'] = array_search(ACSMsg::get_mst('contents_type_master', 'D07'), $contents_type_master_array); $contents_type_code_array['community_profile_login'] = array_search(ACSMsg::get_mst('contents_type_master', 'D08'), $contents_type_master_array); $contents_type_code_array['community_profile_friend'] = array_search(ACSMsg::get_mst('contents_type_master', 'D09'), $contents_type_master_array); $contents_type_code_array['friends_list'] = array_search(ACSMsg::get_mst('contents_type_master', 'D11'), $contents_type_master_array); $contents_type_code_array['mail_lang'] = array_search(ACSMsg::get_mst('contents_type_master', 'D51'), $contents_type_master_array); // コミュニティ種別マスタ $community_type_master_array = ACSDB::get_master_array('community_type'); // コミュニティ種別コード $user_community_type_code = array_search(ACSMsg::get_mst('community_type_master', 'D10'), $community_type_master_array); $friends_community_type_code = array_search(ACSMsg::get_mst('community_type_master', 'D20'), $community_type_master_array); // 公開レベルマスタ $open_level_master_array = ACSDB::get_master_array('open_level'); // BEGIN ACSDB::_do_query("BEGIN"); // user_infoが未登録のLDAPユーザの場合は基本情報を登録する if (!$acs_user_info_row['is_acs_user'] && $acs_user_info_row['is_ldap_user']) { // 新コミュニティID $user_community_id_seq = ACSDB::get_next_seq('community_id_seq'); $user_community_id = $user_community_id_seq; // (1) ユーザコミュニティ (community) $sql = "INSERT INTO community"; $sql .= " (community_id, community_name, community_type_code)"; $sql .= " VALUES ({$user_community_id_seq}, null, '{$user_community_type_code}')"; $ret = ACSDB::_do_query($sql); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } // (2) ユーザ情報 (user_info) $sql = "INSERT INTO user_info"; $sql .= " (user_id, user_community_id, administrator_flag)"; $sql .= " VALUES ('{$form['user_id']}', '{$user_community_id_seq}', 'f')"; $ret = ACSDB::_do_query($sql); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } // (3) マイフレンズ $contents_form = array(); $contents_form['community_id'] = $user_community_id_seq; $contents_form['contents_type_code'] = array_search(ACSMsg::get_mst('contents_type_master', 'D11'), $contents_type_master_array); $contents_form['contents_value'] = ''; $contents_form['open_level_code'] = ACSAccessControl::get_default_open_level_code(ACSMsg::get_mst('community_type_master', 'D10'), ACSMsg::get_mst('contents_type_master', 'D11')); $ret = ACSCommunity::set_contents($contents_form); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } // (4) マイフレンズコミュニティ (community) $friends_community_id_seq = ACSDB::get_next_seq('community_id_seq'); $sql = "INSERT INTO community"; $sql .= " (community_id, community_type_code)"; $sql .= " VALUES ('{$friends_community_id_seq}', '{$friends_community_type_code}')"; $ret = ACSDB::_do_query($sql); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } // (5) マイフレンズコミュニティをユーザコミュニティのサブコミュニティとする (sub_community) $sql = "INSERT INTO sub_community"; $sql .= " (community_id, sub_community_id)"; $sql .= " VALUES ('{$user_community_id_seq}', '{$friends_community_id_seq}')"; $ret = ACSDB::_do_query($sql); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } $is_ldap_user_login_flag = 1; // ユーザ基本情報ここまで } // ニックネーム $ret = ACSCommunity::set_community_name($user_community_id, $form['community_name']); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } // コンテンツ: 氏名, メールアドレス, 所属, 専攻, 出身, 生年月日, プロフィールは3種 foreach (array('user_name', 'mail_addr', 'belonging', 'speciality', 'birthplace', 'birthday', 'community_profile', 'community_profile_login', 'community_profile_friend', 'friends_list', 'mail_lang') as $contents_key) { $contents_form = array('community_id' => $user_community_id, 'contents_type_code' => $contents_type_code_array[$contents_key], 'contents_value' => $form[$contents_key], 'open_level_code' => $form['open_level_code_array'][$contents_key]); $ret = ACSCommunity::set_contents($contents_form); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } } // コンテンツ: ページ全体 = 一般公開とする $contents_form = array('community_id' => $user_community_id, 'contents_type_code' => $contents_type_code_array['self'], 'contents_value' => '', 'open_level_code' => array_search(ACSMsg::get_mst('open_level_master', 'D01'), $open_level_master_array)); $ret = ACSCommunity::set_contents($contents_form); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } // 信頼済みコミュニティ: 出身, 生年月日 foreach (array('birthplace', 'birthday') as $contents_key) { if ($form['trusted_community_flag'][$contents_key]) { // マイフレンズグループ $trusted_community_id_array = explode(',', $form['trusted_community_id_csv_array'][$contents_key]); foreach ($trusted_community_id_array as $trusted_community_id) { if ($trusted_community_id == '') { continue; } $contents_trusted_community_form = array('community_id' => $user_community_id, 'contents_type_code' => $contents_type_code_array[$contents_key], 'open_level_code' => $form['open_level_code_array'][$contents_key], 'trusted_community_id' => $trusted_community_id); $ret = ACSCommunity::set_contents_trusted_community($contents_trusted_community_form); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } } } else { // マイフレンズ $trusted_community_id = ACSUser::get_friends_community_id($user_community_id); // フレンズコミュニティID $contents_trusted_community_form = array('community_id' => $user_community_id, 'contents_type_code' => $contents_type_code_array[$contents_key], 'open_level_code' => $form['open_level_code_array'][$contents_key], 'trusted_community_id' => $trusted_community_id); $ret = ACSCommunity::set_contents_trusted_community($contents_trusted_community_form); if (!$ret) { ACSDB::_do_query("ROLLBACK"); return $ret; } } } // COMMIT ACSDB::_do_query("COMMIT"); if ($is_ldap_user_login_flag) { $acs_user_info_row = ACSUser::get_user_info_row_by_user_id($form['user_id']); // ログ登録: LDAPユーザ新規登録 ACSLog::set_log($acs_user_info_row, 'New LDAP User Registration', $ret, "[UserID:{$form['user_id']}]"); // ラストログイン登録 ACSUser::set_last_login($acs_user_info_row); } return $ret; }