protected function canUserChangeStatus($user)
 {
     if ($user->is('guest')) {
         return false;
     }
     return $this->status > 0 && $this->project->canUser('@control', $user);
 }
 protected function _canUser($user)
 {
     return $this->owner->canUser('modifyRegistrationFields', $user);
 }
 protected function canUserView($user)
 {
     if ($this->status === self::STATUS_ENABLED) {
         return true;
     } else {
         if ($this->status === self::STATUS_DRAFT) {
             return $this->canUser('@control', $user) || $this->project && $this->project->canUser('@control', $user);
         }
     }
     return false;
 }
Example #4
0
 function addProjectToJs(Entities\Project $entity)
 {
     $this->jsObject['entity']['useRegistrations'] = $entity->useRegistrations;
     $this->jsObject['entity']['registrationFileConfigurations'] = $entity->registrationFileConfigurations ? $entity->registrationFileConfigurations->toArray() : array();
     usort($this->jsObject['entity']['registrationFileConfigurations'], function ($a, $b) {
         if ($a->title > $b->title) {
             return 1;
         } else {
             if ($a->title < $b->title) {
             } else {
                 return 0;
             }
         }
     });
     $this->jsObject['entity']['registrationCategories'] = $entity->registrationCategories;
     $this->jsObject['entity']['published'] = $entity->publishedRegistrations;
     $this->jsObject['entity']['registrations'] = $entity->sentRegistrations ? $entity->sentRegistrations : array();
     $this->jsObject['entity']['registrationRulesFile'] = $entity->getFile('rules');
     $this->jsObject['entity']['canUserModifyRegistrationFields'] = $entity->canUser('modifyRegistrationFields');
     $this->jsObject['projectRegistrationsEnabled'] = App::i()->config['app.enableProjectRegistration'];
 }
Example #5
0
 protected function validateProject()
 {
     if ($this->project && $this->_projectChanged) {
         return $this->project->canUser('modify');
     } else {
         return true;
     }
 }
Example #6
0
 function canUser($action, $userOrAgent = null)
 {
     return $this->owner->canUser($action, $userOrAgent);
 }