/**
  * Test method isAllowedToEditEvent()
  */
 public function testIsAllowedToEditEvent()
 {
     $authManager = new RecruitmentAuthManager();
     $app = JobApplication::getJobApplication(1);
     $app5 = JobApplication::getJobApplication(5);
     // Different users
     $admin = new authorize(null, authorize::YES);
     $hiring = new authorize('011', authorize::NO);
     $first = new authorize(13, authorize::NO);
     $second = new authorize(14, authorize::NO);
     $manager = new authorize(15, authorize::NO);
     $nonManager = new authorize(16, authorize::NO);
     $director = new authorize(17, authorize::NO);
     $otherDirector = new authorize(18, authorize::NO);
     // Admin, Hiring Manager and interviewer(owner) allowed to edit event
     $event = $app->getEventOfType(JobApplicationEvent::EVENT_SCHEDULE_FIRST_INTERVIEW);
     $this->assertTrue($authManager->isAllowedToEditEvent($admin, $event));
     $this->assertTrue($authManager->isAllowedToEditEvent($hiring, $event));
     $this->assertTrue($authManager->isAllowedToEditEvent($first, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($second, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($manager, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($nonManager, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($director, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($otherDirector, $event));
     $event = $app->getEventOfType(JobApplicationEvent::EVENT_SCHEDULE_SECOND_INTERVIEW);
     $this->assertTrue($authManager->isAllowedToEditEvent($admin, $event));
     $this->assertTrue($authManager->isAllowedToEditEvent($hiring, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($first, $event));
     $this->assertTrue($authManager->isAllowedToEditEvent($second, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($manager, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($nonManager, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($director, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($otherDirector, $event));
     $event = $app5->getEventOfType(JobApplicationEvent::EVENT_SEEK_APPROVAL);
     $this->assertFalse($authManager->isAllowedToEditEvent($director, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($otherDirector, $event));
     $this->assertTrue($authManager->isAllowedToEditEvent($admin, $event));
     $this->assertTrue($authManager->isAllowedToEditEvent($hiring, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($first, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($second, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($manager, $event));
     $this->assertFalse($authManager->isAllowedToEditEvent($nonManager, $event));
 }
예제 #2
0
echo $lang_Recruit_JobApplicationDetails_Status;
?>
</div>
        <div class="txtValue" style="white-space:nowrap;">
            <?php 
echo $statusList[$application->getStatus()];
?>
</div><br/>

        <?php 
$authManager = new RecruitmentAuthManager();
$auth = new authorize($_SESSION['empID'], $_SESSION['isAdmin']);
$role = $authManager->getRoleForApplication($auth, $application);
$eventCount = 0;
foreach ($events as $event) {
    $allowEdit = $authManager->isAllowedToEditEvent($auth, $event);
    $allowStatusChange = $authManager->isAllowedToChangeEventStatus($auth, $event);
    $title = $eventTitles[$event->getEventType()];
    if ($event->getEventType() == JobApplicationEvent::EVENT_SCHEDULE_FIRST_INTERVIEW || $event->getEventType() == JobApplicationEvent::EVENT_SCHEDULE_SECOND_INTERVIEW) {
        $showEventDate = true;
        $evenDateLabel = $lang_Recruit_JobApplicationHistory_InterviewTime;
        $showStatus = true;
        $showOwner = true;
        $creatorLabel = $lang_Recruit_JobApplicationHistory_ScheduledBy;
    } else {
        $eventDateLabel = '';
        $showEventDate = false;
        $showStatus = false;
        $showOwner = false;
        $creatorLabel = $lang_Recruit_JobApplicationHistory_By;
    }