Пример #1
0
    public function before($context) 
    {
        $session = SessionDefault::singleton();
        //for debug
        //$session->UserId = 1013705;

        $auditors = AuditorClient::getInstance()->getByUserIds(array($session->UserId));
        $auditor = isset($auditors[$session->UserId])?$auditors[$session->UserId]:false;
        if (false == $auditor || false==$this->checkAuth($auditor->role, $context->controller, $context->action))
            throw new BizException('你没有权限访问');

        $context->response->auditor = $auditor;
        $context->response->user = $auditor->user;
    }
Пример #2
0
 public function edit($request, $response)
 {
     /*{{{*/
     $args = array();
     foreach (array('id', 'name', 'note', 'cateIds', 'leaderId', 'enableCaseGroup') as $param) {
         $args[$param] = $request->{$param};
     }
     DBC::requireFalse(0 == $args['leaderId'], '必须要选中一名组长');
     if (false == is_array($args['cateIds'])) {
         $args['cateIds'] = array();
     }
     if ($args['id']) {
         $id = AuditorClient::getInstance()->updateGroup($this->auditor, $args);
     } else {
         $leader = DAL::get()->find('auditor', $args['leaderId']);
         $args['id'] = AuditorClient::getInstance()->addGroup($this->auditor, $args['name'], $args['cateIds'], $leader, $args['note'], $args['enableCaseGroup']);
     }
     $this->genJS();
     $url = $response->router->urlfor('group/show', array('id' => $args['id']));
     $response->setRedirect($url);
 }