예제 #1
0
 public function DeleteStaffRoleAction()
 {
     $request = $this->getRequest();
     $conn = $this->get("we_data_access");
     $conn_im = $this->get("we_data_access_im");
     $currUser = $this->get('security.context')->getToken();
     if (!empty($currUser)) {
         $currUser = $currUser->getUser();
     } else {
         //当应用通过api接口调用时,不用登录,只能通过openid获取人员信息
         $baseinfoCtl = new Staff($conn, null, $request->get("openid"), $this->get("logger"));
         $currUser = $baseinfoCtl->getSessionUser();
     }
     $rolecode = $request->get("rolecode");
     $staffRole = new StaffRole($conn, $conn_im, $this->get("logger"));
     $re = $staffRole->DeleteStaffRoleByCode($currUser->getUsername(), $rolecode, $currUser->getEno());
     $response = new Response($request->get('jsoncallback') ? $request->get('jsoncallback') . "(" . json_encode($re) . ");" : json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
예제 #2
0
파일: Role.php 프로젝트: 3116246/haolinju
 public function deleteRole($roleid)
 {
     $staffRole = new StaffRole($this->conn, $this->conn_im, null);
     $ds = $this->conn->GetData("t", "SELECT  a.staff,b.fafa_jid,b.eno FROM we_staff_role a,we_staff b where a.staff=b.login_account and a.roleid=?", array((string) $roleid));
     $sql = array();
     $paras = array();
     $sql[] = "delete from we_role where id=?";
     $paras[] = array((string) $roleid);
     for ($i = 0; $i < count($ds["t"]["rows"]); $i++) {
         $row = $ds["t"]["rows"][$i];
         $staffRole->DeleteStaffRole($row["staff"], $roleid, $row["eno"]);
     }
     $this->conn->ExecSQLs($sql, $paras);
     //Cache_Enterprise::delete(Cache_Enterprise::$EN_ROLE,$eno);
     return true;
 }
 public function setRoleStaffAction($network_domain)
 {
     $request = $this->get("request");
     $user = $this->get('security.context')->getToken()->getUser();
     $da = $this->get("we_data_access");
     $da_im = $this->get('we_data_access_im');
     $re = array('s' => '1', 'm' => '');
     $login_account = $request->get("login_account");
     $roles = $request->get("roles");
     $StaffRole = new StaffRole($da, $da_im);
     if (!$StaffRole->setRoleStaff($login_account, empty($roles) ? array() : explode(',', $roles), $user->eno)) {
         $re = array('s' => '0', 'm' => '角色授权失败');
     }
     $response = new Response(json_encode($re));
     $response->headers->set('Content-Type', 'text/json');
     return $response;
 }
예제 #4
0
 public function getCommentAction()
 {
     $StaffRole = new \Justsy\BaseBundle\Rbac\StaffRole($this->get('we_data_access'), $this->get('we_data_access_im'), $this->get("logger"));
     $user = $this->get('security.context')->getToken()->getUser();
     $al = $user->auth_level;
     $el = (int) $user->vip_level;
     $up = "";
     $cur = "";
     if ($al == "J") {
         $up = "N1";
         $cur = "J1";
         if ($el > 0) {
             $up = "V" . $el;
             $cur = "J" . $el;
         } else {
             if ($el < 0) {
                 $up = "N" . abs($el);
                 $cur = "J" . abs($el);
             }
         }
     } else {
         if ($al == "N") {
             $up = "V1";
             $cur = "N1";
             if ($el != 0) {
                 $up = "V" . abs($el);
                 $cur = "N" . abs($el);
             }
         } else {
             $up = "V" . ($el + 1);
             $cur = "V" . $el;
         }
     }
     $myfunc = $StaffRole->getFunctionCodes($el > 0 ? $cur : substr($cur, 0, 1) . "1");
     //对于未认证的等级角色,固定取N1/J1的功能点
     $upfunc = $StaffRole->getFunctionCodes($el > 0 ? $up : substr($up, 0, 1) . "1");
     //对于未认证的等级角色,固定取N1/J1的功能点
     return $this->render("JustsyBaseBundle:IdentifyAuth:auth_info_help.html.twig", array("up" => $up, "curFunc" => $myfunc, "upFunc" => $upfunc));
 }
예제 #5
0
 public function UserAgreeAction()
 {
     $da = $this->get('we_data_access');
     $da_im = $this->get('we_data_access_im');
     $logger = $this->get('logger');
     $request = $this->getRequest();
     $apply_id = $request->get('apply_id');
     $re = $request->get('re');
     $user = $this->get('security.context')->getToken()->getUser();
     $r = array('s' => 1, 'm' => '');
     try {
         //验证是否能审核
         $sql = "select result,is_valid from we_apply where id=?";
         $params = array($apply_id);
         $ds = $da->Getdata('info', $sql, $params);
         if ($ds['info']['recordcount'] == 0) {
             $r = array('s' => 0, 'm' => '该条审核记录已失效');
         } else {
             if ($ds['info']['rows'][0]['is_valid'] == '0') {
                 $r = array('s' => 0, 'm' => '你已经审核过了!');
             }
         }
         if ($r['s'] == '1') {
             //同意人数
             $sql = "select a.content,a.account,b.openid,b.fafa_jid from we_apply a left join we_staff b on b.login_account=a.account where a.id=?";
             $params = array($apply_id);
             $ds = $da->Getdata('content', $sql, $params);
             if ($ds['content']['recordcount'] > 0) {
                 $content = $ds['content']['rows'][0]['content'];
                 $account = $ds['content']['rows'][0]['account'];
                 $acc_openid = $ds['content']['rows'][0]['openid'];
                 $acc_jid = $ds['content']['rows'][0]['fafa_jid'];
                 $num = (int) $content;
                 $sql2[] = "select 1 from we_apply where account=? and recv_type='p' and result='1'";
                 $sql2[] = "select distinct recv_id from we_apply where account=? and recv_type='p' and result='0'";
                 $sql2[] = "select distinct recv_id from we_apply where account=? and recv_type='p'";
                 $params2[] = array($account);
                 $params2[] = array($account);
                 $params2[] = array($account);
                 $ds = $da->GetDatas(array('agreenum', 'confictnum', 'allnum'), $sql2, $params2);
                 $n = $ds['agreenum']['recordcount'];
                 $m = $ds['confictnum']['recordcount'];
                 $allnum = $ds['allnum']['recordcount'];
                 if ($re == '1') {
                     $n++;
                 }
                 if ($re == '0') {
                     $m++;
                 }
                 //更新审核结果
                 $sql1[] = "update we_apply set result=?,is_valid='0' where id=? and (result is null or result='') and is_valid='1'";
                 $params1[] = array($re, $apply_id);
                 if ($num <= $n) {
                     $sql1[] = "update we_staff set auth_level=? where login_account=?";
                     $params1[] = array($user->eno_level, $account);
                     if ($user->edomain == $user->eno) {
                         $sql = "select 1 from we_public_domain where LOCATE(domain_name,?)=0 and not exists(select 1 from we_enterprise where edomain=?)";
                         $params = array($account, $this->getSubDomain($account));
                         $ds = $da->Getdata('acc', $sql, $params);
                         if ($ds['acc']['recordcount'] > 0) {
                             $sql1[] = "update we_enterprise set edomain=? where eno=?";
                             $params1[] = array($this->getSubDomain($account), $user->eno);
                             $sql1[] = "update we_enterprise_stored set eno_mail=? where enoname=?";
                             $params1[] = array($account, $user->ename);
                             $sql1[] = "update we_circle set network_domain=? where enterprise_no=?";
                             $params1[] = array($this->getSubDomain($account), $user->eno);
                         }
                     }
                     //写入消息
                     $msg_id = SysSeq::GetSeqNextValue($da, "we_message", "msg_id");
                     $msg = "您已通过身份认证,现在就可以正常使用Wefafa平台了!";
                     $sql1[] = "insert into we_message (msg_id,sender,recver,title,content,send_date) values(?,?,?,?,?,now())";
                     $params1[] = array($msg_id, '*****@*****.**', $account, '用户认证协助审核', $msg);
                 }
                 if ($allnum - $m < $num) {
                     //写入消息
                     $msg_id = SysSeq::GetSeqNextValue($da, "we_message", "msg_id");
                     $msg = "您的身份认证申请未通过审核。";
                     $sql1[] = "insert into we_message (msg_id,sender,recver,title,content,send_date) values(?,?,?,?,?,now())";
                     $params1[] = array($msg_id, '*****@*****.**', $account, '用户认证协助审核', $msg);
                 }
                 if (!$da->ExecSQLs($sql1, $params1)) {
                     $r = array('s' => 0, 'm' => '系统错误');
                 }
                 if ($r['s'] == '1') {
                     //通知申请人审核结果
                     //Utils::sendImMessage($user->openid,$acc_openid,"用户身份认证",$user->nick_name.($re=='1'?"通过了您的加入请求。":"拒绝了您的加入请求。"),$this->container,"","",true,Utils::$systemmessage_code);
                     if ($num <= $n) {
                         //同步权限到Rbac
                         $staffRole = new StaffRole($da, $da_im, $this->get('logger'));
                         /*
                         if($user->vip_level!='0')
                         	$staffRole->UpdateStaffRoleByCode($account,(Identify::$SIdent).($user->vip_level),(Identify::$BIdent).($user->vip_level),$user->eno);
                         else
                         	$staffRole->UpdateStaffRoleByCode($account,(Identify::$SIdent).($user->vip_level),(Identify::$MIdent).($user->vip_level),$user->eno);
                         */
                         $staffRole->UpdateStaffRoleByCode($account, Identify::$SIdent . $user->vip_level, $user->eno_level . $user->vip_level, $user->eno);
                         //通知申请人权限已通过
                         Utils::sendImMessage('', $acc_openid, "用户身份认证", "您的身份认证申请已被审核通过。", $this->container, "", "", true, Utils::$systemmessage_code);
                         //发送出席
                         Utils::sendImPresence('', $acc_jid, "用户身份认证", "您的身份认证申请已被审核通过。", $this->container, "", "", false, Utils::$eno_identify_auth);
                     } else {
                         if ($allnum - $m < $num) {
                             //通知申请人权限已通过
                             Utils::sendImMessage('', $acc_openid, "用户身份认证", "您的身份认证申请未通过审核。", $this->container, "", "", true, Utils::$systemmessage_code);
                         }
                     }
                 }
             }
         }
     } catch (\Exception $e) {
         $this->get('logger')->err($e);
         $r = array('s' => 0, 'm' => '审核出现错误');
     }
     $desc = "";
     $title = "";
     if ($r['s'] == '0') {
         $title = "提交失败";
         $desc = $r['m'];
     } else {
         $title = "提交成功";
         $desc = "您的审核结果已经提交成功,谢谢你的配合。";
     }
     $home = $this->container->getParameter('open_api_url');
     return $this->render("JustsyBaseBundle:IdentifyAuth:verify_success.html.twig", array('desc' => $desc, 'home' => $home, 'title' => $title));
 }