zen.php 1014 B

123456789101112131415161718192021
  1. <?php
  2. class testsuiteZen extends testsuite
  3. {
  4. /**
  5. * 检查当前登陆用户是否有访问testsuite的权限。
  6. * Check whether the current logged in user has permission to access tesusuite..
  7. *
  8. * @param int $suiteID
  9. * @param int $userID
  10. * @access public
  11. * @return object
  12. */
  13. public function checkTestsuiteAccess($suiteID)
  14. {
  15. if(!$suiteID) return $this->send(array('result' => 'fail', 'load' => array('alert' => $this->lang->notFound, 'locate' => inlink('browse'))));
  16. $suite = $this->testsuite->getById($suiteID, true);
  17. if(!$suite) return $this->send(array('result' => 'fail', 'load' => array('alert' => $this->lang->notFound, 'locate' => inlink('browse'))));
  18. if($suite->type == 'private' && $suite->addedBy != $this->app->user->account && !$this->app->user->admin) return $this->send(array('result' => 'fail', 'load' => array('alert' => $this->lang->notFound, 'locate' => inlink('browse'))));
  19. return $suite;
  20. }
  21. }