Ejemplo n.º 1
0
 /**
  * Only for non-authenticated
  * @param string $controller
  * @param string $action
  * @param \Jazzee\Entity\User $user
  * @param \Jazzee\Entity\Program $program
  * @return bool
  */
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     if ($action == 'index') {
         return !(bool) $user;
     }
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }
Ejemplo n.º 2
0
 /**
  * Only allow access for users with API keys
  * These keys are generated in the Manage Users menu
  * @param string $controller
  * @param string $action
  * @param \Jazzee\Entity\User $user
  * @param \Jazzee\Entity\Program $program
  * @return bool
  */
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     if (in_array($action, array('index', 'updateKey')) and $user and $user->getApiKey()) {
         return true;
     }
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }
Ejemplo n.º 3
0
 /**
  * Don't allow users who don't have a program and a cycle
  * @param string $controller
  * @param string $action
  * @param \Jazzee\Entity\User $user
  * @param \Jazzee\Entity\Program $program
  * @param \Jazzee\Entity\Application $application
  * @return boolean
  */
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     if (!$program) {
         return false;
     }
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }
Ejemplo n.º 4
0
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     //several views are controller by the complete action
     if (in_array($action, array('saveDisplay', 'deleteDisplay'))) {
         $action = 'getRoleDisplay';
     }
     if ($action == 'getRoleDisplay' and !$application) {
         return false;
     }
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }
Ejemplo n.º 5
0
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     //all action authorizations are controlled by the index action
     $action = 'index';
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }
Ejemplo n.º 6
0
 /**
  * Any user can access
  * @param string $controller
  * @param string $action
  * @param \Jazzee\Entity\User $user
  * @param \Jazzee\Entity\Program $program
  * @return bool
  */
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     if (in_array($action, array('saveDisplay', 'new', 'deleteDisplay')) and $user) {
         return true;
     }
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }
Ejemplo n.º 7
0
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     //several views are controller by the complete action
     if (in_array($action, array('refreshTags', 'refreshPage', 'refreshSirPage'))) {
         $action = 'index';
     }
     if (in_array($action, array('do', 'doAction', 'pageDo', 'doPageAction'))) {
         $action = 'editAnswer';
     }
     if (in_array($action, array('pdf', 'pdftemplate'))) {
         $action = 'pdf';
     }
     //require a working ApplicantPDF class
     if (in_array($action, array('pdf'))) {
         if (!\Jazzee\ApplicantPDF::isAvailable()) {
             return false;
         }
     }
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }
Ejemplo n.º 8
0
 /**
  * Use the index action to controll acccess
  * require a published application
  * @param type $controller
  * @param string $action
  * @param \Jazzee\Entity\User $user
  * @param \Jazzee\Entity\Program $program
  * @param \Jazzee\Entity\Application $application
  * @return type
  */
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     if (!$application || !$application->isPublished()) {
         return false;
     }
     //several views are controller by the index action
     if (in_array($action, array('bulk', 'sampleFile'))) {
         $action = 'index';
     }
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }
Ejemplo n.º 9
0
 /**
  * Only allow change program if the user is in at least one program
  * At this top level always return false so nothing is allowed by default
  * @param string $controller
  * @param string $action
  * @param \Jazzee\Entity\User $user
  * @param \Jazzee\Entity\Program $program
  * @return bool
  */
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     //Several actions are allowed as long as the user is in at least one program
     $specialActions = array('index', 'getAllowedPrograms', 'changeTo');
     if ($user and in_array($action, $specialActions)) {
         $userPrograms = $user->getPrograms();
         return parent::isAllowed($controller, 'anyprogram', $user) or !empty($userPrograms);
     }
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }
Ejemplo n.º 10
0
 /**
  * Any user can access
  * @param string $controller
  * @param string $action
  * @param \Jazzee\Entity\User $user
  * @param \Jazzee\Entity\Program $program
  * @return bool
  */
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     if (in_array($action, array('index', 'savePreferences', 'getPreferences')) and $user) {
         return true;
     }
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }
Ejemplo n.º 11
0
 /**
  * Controll actions with the index action
  * @param string $controller
  * @param string $action
  * @param \Jazzee\Entity\User $user
  * @param \Jazzee\Entity\Program $program
  * @return bool
  */
 public static function isAllowed($controller, $action, \Jazzee\Entity\User $user = null, \Jazzee\Entity\Program $program = null, \Jazzee\Entity\Application $application = null)
 {
     if (in_array($action, array('getApplicants', 'listApplicants', 'describeDisplay'))) {
         $action = 'index';
     }
     return parent::isAllowed($controller, $action, $user, $program, $application);
 }