예제 #1
0
파일: OBM.php 프로젝트: Kervinou/OBM
 function Vcalendar_Writer_OBM($force=false) {
   $this->db = new DB_OBM;
   $this->lazyRead = true;
   if(!$force) {
     $this->rights = array_keys(OBM_Acl::getAllowedEntities($GLOBALS['obm']['uid'], 'calendar', 'write'));
   } else {
     $this->rights = true;
   }
 }
예제 #2
0
파일: AclTest.php 프로젝트: Kervinou/OBM
 public function testPublicRights() {
   OBM_Acl::initialize();
   $this->assertFalse(OBM_Acl::canAccess(2, 'cv', 1));
   $this->assertFalse(OBM_Acl::canRead(2, 'cv', 1));
   $this->assertFalse(OBM_Acl::canWrite(2, 'cv', 1));
   $this->assertFalse(OBM_Acl::canAdmin(2, 'cv', 1));
   OBM_Acl::setPublicRights('cv', 1, array('access' => 1, 'read' => 1, 'write' => 0));
   $this->assertTrue(OBM_Acl::canAccess(2, 'cv', 1));
   $this->assertTrue(OBM_Acl::canRead(2, 'cv', 1));
   $this->assertFalse(OBM_Acl::canWrite(2, 'cv', 1));
   $this->assertFalse(OBM_Acl::canAdmin(2, 'cv', 1));
   OBM_Acl::allow(2, 'cv', 1, 'admin');
   $this->assertTrue(OBM_Acl::canAccess(2, 'cv', 1));
   $this->assertTrue(OBM_Acl::canRead(2, 'cv', 1));
   $this->assertFalse(OBM_Acl::canWrite(2, 'cv', 1));
   $this->assertTrue(OBM_Acl::canAdmin(2, 'cv', 1));
   $this->assertEquals(OBM_Acl::getAllowedEntities(2, 'cv', 'read', null, 'title'), array(1 => 'CV Admin'));
   OBM_Acl::setPublicRights('cv', 1, array('access' => 1, 'read' => 1, 'write' => 0, 'admin' => 1));
   $this->assertTrue(OBM_Acl::canAccess(3, 'cv', 1));
   $this->assertTrue(OBM_Acl::canRead(3, 'cv', 1));
   $this->assertFalse(OBM_Acl::canWrite(3, 'cv', 1));
   $this->assertFalse(OBM_Acl::canAdmin(3, 'cv', 1));
   $this->assertEquals(OBM_Acl::getPublicRights('cv', 1), array(
     'access' => 1, 'read' => 1, 'write' => 0, 'admin' => 0
   ));
 }
예제 #3
0
      $display['detail'] = html_calendar_dis_conflict($params, $conflicts) ;
      $display['detail'] .= dis_calendar_event_form($action, $params, $eve_q, $entities, $current_view);
    } else {
      $display['msg'] .= display_err_msg($err['msg']);
    }
  } else {
    $display['msg'] .= display_err_msg($l_err_reference);
  }

} elseif ($action == 'portlet') {
///////////////////////////////////////////////////////////////////////////////
  $display['head'] = display_head($l_calendar);
  if (isset($params['list'])) {
    $calendar_entity = $current_view->get_entities();
    $writable_entity = OBM_Acl_Utils::expandEntitiesArray(
      OBM_Acl::getAllowedEntities($obm['uid'], 'calendar', 'write')
    );
    $display['detail'] = dis_calendar_day_list($current_view, $calendar_entity, $writable_entity);
  } else if (isset($params['waiting'])) {
    $display['detail'] = dis_calendar_waiting_portlet();
  } else if (isset($params['task'])) {
    $display['detail'] = dis_calendar_task_portlet();
  }else {
    $display['detail'] = dis_calendar_calendar_view($params, $current_view);
  }
  $display['title'] = dis_portlet_navbar($params, $current_view);
  display_page($display);
  exit();

///////////////////////////////////////////////////////////////////////////////
} elseif ($action == 'draw') {
예제 #4
0
 /**
  * Sort recipients (OBM users) between users requiring an invitation (and an ICS) 
  * and users requiring a simple notice (because the event owner has write rights on them)
  * 
  * @param array $recipients 
  * @access private
  * @return array
  */
 private function sortObmUsersRecipients($recipients) {
   $recipients = array_diff($recipients, array($GLOBALS['obm']['uid']));
   $invit_recipients = array_diff($recipients, array_keys(OBM_Acl::getAllowedEntities($GLOBALS['obm']['uid'], 'calendar', 'write')));
   $notice_recipients = array_diff($recipients, $invit_recipients);
   return array($invit_recipients, $notice_recipients);
 }