public function indexAction($network_domain, $name) { $user = $this->get('security.context')->getToken()->getUser(); if ($user->state_id == '3') { // 已注销 return $this->redirect($this->generateUrl('JustsyBaseBundle_register', array('type' => 0, 'mail' => $user->getUserName()))); } //判断是否第一次进入wefafa,显示圈子默认页面 if (empty($user->prev_login_date) || "0000-00-00 00:00:00" == $user->prev_login_date) { $sql = "update we_staff set prev_login_date=now() where login_account=?"; $da = $this->get("we_data_access"); $da->ExecSQL($sql, array((string) $user->getUserName())); $UserProvider = new \Justsy\BaseBundle\Login\UserProvider($this->container); $UserProvider->refreshUser($user); return $this->redirect($this->generateUrl('JustsyBaseBundle_enterprise', array('network_domain' => 9999))); } $para = array('this' => $this, 'curr_network_domain' => $network_domain, "publish" => true, "trend" => true, "group_c" => $user->IsExistsFunction("GROUP_C"), "group_s" => $user->IsExistsFunction("GROUP_S")); //if ( $network_domain != $user->edomain && !in_array($network_domain, $user->network_domains)) { // $para= $this->getRole($para); // return $this->redirect($this->generateUrl('JustsyBaseBundle_enterprise_home', $para)); //} //企业圈子ID $en_circle_id = $user->get_circle_id($user->edomain); //取出当前圈子的群组 $circle_id = $user->get_circle_id($network_domain); $this->getGroupByCircle($circle_id, $user->getUserName()); if ($circle_id == "10000") { //we广场也需要限制 $para["publish"] = $user->IsExistsFunction("PUBLISH_WE"); $para["trend"] = $user->IsExistsFunction("TREND_WE"); $para["view"] = $user->IsExistsFunction("TREND_VIEW_WE"); $para["group_c"] = $user->IsExistsFunction("GROUP_C_WE"); $template_twig = "JustsyBaseBundle:EnterpriseHome:index_10000.html.twig"; } else { if ($circle_id == "9999") { //人脉 $para["group_c"] = true; //不限制 $template_twig = "JustsyBaseBundle:FriendCircle:index_9999.html.twig"; } else { if ($circle_id != $en_circle_id) { //外部圈子 $para["publish"] = $user->IsExistsFunction("CIRCLE_PUBLISH_TREND"); $para["trend"] = $user->IsExistsFunction("CIRCLE_REPLY_TREND"); $para["view"] = $user->IsExistsFunction("CIRCLE_VIEW_TREND"); $para["group_c"] = $user->IsExistsFunction("GROUP_C"); $template_twig = "JustsyBaseBundle:EnterpriseHome:index.html.twig"; } else { //企业 $para["publish"] = $user->IsExistsFunction("PUBLISH_EN"); $para["trend"] = $user->IsExistsFunction("EN_TREND"); $para["view"] = $user->IsExistsFunction("EN_CIRCLE_VIEW"); $para["group_c"] = $user->IsExistsFunction("GROUP_C_EN"); $template_twig = "JustsyBaseBundle:EnterpriseHome:index.html.twig"; } } } return $this->render($template_twig, $para); }
public function loginAndRefAction() { $request = $this->get("request"); $des = $request->get("auth"); $url = $request->get("redirect"); if (empty($des) || empty($url)) { return $this->render('JustsyBaseBundle:Login:default.html.twig', array()); } $des = explode(',', $des); $login_account = $des[0]; $pwd = $des[1]; $Obj = new \Justsy\BaseBundle\Login\UserProvider($this->container); $user = $Obj->loadUserByUsername($login_account, ""); $token = new \Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken($user, $user->getPassword(), "secured_area", $user->getRoles()); $this->get("security.context")->setToken($token); $session = $request->getSession()->set('_security_' . 'secured_area', serialize($token)); $event = new \Symfony\Component\Security\Http\Event\InteractiveLoginEvent($request, $token); $this->get("event_dispatcher")->dispatch("security.interactive_login", $event); return $this->redirect($url); }