예제 #1
0
  exit();

} elseif ($action == 'share_reinit') {
///////////////////////////////////////////////////////////////////////////////
  if(OBM_Acl::areAllowed($obm['uid'], 'calendar',array($params['entity_id']), 'admin' ) || check_calendar_update_rights($params)) {
    run_query_calendar_delete_token($params['entity_id'],$params['entity_type'],$params['type']);
    json_ok_msg("$l_share_calendar : $l_reinit_ok");
  } else {
    json_error_msg("$l_rights : $l_of_right_err_user");
  }
  echo "({".$display['json'].",$msg})";
  exit();

} elseif ($action == 'send_url') {
///////////////////////////////////////////////////////////////////////////////
  if(OBM_Acl::areAllowed($obm['uid'], 'calendar',array($params['entity_id']), 'admin' ) || check_calendar_update_rights($params)) {
    $format = $params['format'];
    $params['others_attendees'][]=$params['mail'];
    $entity = get_user_info($params['entity_id']);
    $entity['token'] = get_calendar_entity_share($params['entity_id'],$params['entity_type'],$params['type']);
    run_query_insert_others_attendees($params);
    $sharemail = new shareCalendarMailer();
    $sharemail->addRecipient($params['mail']);
    $sharemail->send("userShare$format",array($entity));
    json_ok_msg("$l_share_calendar : $l_mail_ok");
  } else {
    json_error_msg("$l_rights : $l_of_right_err_user");
  }
  echo "({".$display['json'].",$msg})";
  exit();
예제 #2
0
파일: AclTest.php 프로젝트: Kervinou/OBM
 public function testBasics() {
   OBM_Acl::initialize();
   $this->assertFalse(OBM_Acl::isAllowed(2, 'cv', 1, 'read'));
   $this->assertFalse(OBM_Acl::hasAllowedEntities(2, 'cv', 'read'));
   OBM_Acl::allow(2, 'cv', 1, 'read');
   $this->assertTrue(OBM_Acl::isAllowed(2, 'cv', 1, 'read'));
   $this->assertTrue(OBM_Acl::hasAllowedEntities(2, 'cv', 'read'));
   $this->assertFalse(OBM_Acl::isAllowed(2, 'cv', 1, 'write'));
   OBM_Acl::allow(2, 'cv', 1, 'write');
   $this->assertTrue(OBM_Acl::isAllowed(2, 'cv', 1, 'read'));
   $this->assertTrue(OBM_Acl::isAllowed(2, 'cv', 1, 'write'));
   $this->assertTrue(OBM_Acl::canRead(2, 'cv', 1));
   $this->assertTrue(OBM_Acl::canWrite(2, 'cv', 1));
   $this->assertFalse(OBM_Acl::canAdmin(2, 'cv', 1));
   OBM_Acl::deny(2, 'cv', 1, 'write');
   $this->assertTrue(OBM_Acl::canRead(2, 'cv', 1));
   $this->assertFalse(OBM_Acl::canWrite(2, 'cv', 1));
   
   OBM_Acl::allow(2, 'cv', 1, 'write');
   $this->assertTrue(OBM_Acl::areSomeAllowed(2, 'cv', array(1, 2), 'write'));
   $this->assertTrue(OBM_Acl::hasAllowedEntities(2, 'cv', 'write'));
   $this->assertFalse(OBM_Acl::areAllowed(2, 'cv', array(1, 2), 'write'));
   OBM_Acl::allow(2, 'cv', 2, 'write');
   $this->assertTrue(OBM_Acl::areSomeAllowed(2, 'cv', array(1, 2), 'write'));
   $this->assertTrue(OBM_Acl::areAllowed(2, 'cv', array(1, 2), 'write'));
   $this->assertTrue(OBM_Acl::hasAllowedEntities(2, 'cv', 'write'));
   
   OBM_Acl::denyAll('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));
   
   // special entities
   $this->addCalendar(2);
   $this->addCalendar(3);
   $this->assertTrue(OBM_Acl::isAllowed(2, 'calendar', 2, 'read'));
   $this->assertTrue(OBM_Acl::isAllowed(2, 'calendar', 2, 'write'));
   $this->assertTrue(OBM_Acl::canRead(2, 'calendar', 2));
   $this->assertTrue(OBM_Acl::canWrite(2, 'calendar', 2));
   $this->assertTrue(OBM_Acl::canAdmin(2, 'calendar', 2));
   
   $this->assertTrue(OBM_Acl::areSomeAllowed(2, 'calendar', array(2, 3), 'write'));
   $this->assertFalse(OBM_Acl::areAllowed(2, 'calendar', array(2, 3), 'write'));
   $this->assertFalse(OBM_Acl::hasAllowedEntities(2, 'calendar', 'write'));
   OBM_Acl::allow(2, 'calendar', 3, 'write');
   $this->assertTrue(OBM_Acl::areSomeAllowed(2, 'calendar', array(2, 3), 'write'));
   $this->assertTrue(OBM_Acl::areAllowed(2, 'calendar', array(2, 3), 'write'));
   $this->assertTrue(OBM_Acl::hasAllowedEntities(2, 'calendar', 'write'));
 }