我们有一个共享日历,其中包含大量事件。但问题是所有用户都应对每个事件拥有不同的访问权限。
因此,在一个日历的范围内,每个用户都应该参加不同的活动。那些没有用户参加的人应该对他完全不可见。
现在我们遇到一个事件被标记为私人,并且没有邀请用户的情况 - 他的日历上有一个标记busy
,没有事件详细信息。但是,当他没有参加时,我们不需要用户日历中的任何标记。
这是我们为日历设置规则的方式
$rule = new Google_Service_Calendar_AclRule();
$scope = new Google_Service_Calendar_AclRuleScope();
$scope->setType( 'user' );
$scope->setValue( 'mail@gmail.com' );
$rule->setScope( $scope );
$rule->setRole( 'reader' );
//$rule->setRole( 'freeBusyReader' );
$createdRule = $service->acl->insert( $createdCalendar->getId(), $rule );
这就是我们创建活动的方式
$event = new Google_Service_Calendar_Event( array(
'summary' => 'Google I/O 2015',
'location' => '800 Howard St., San Francisco, CA 94103',
'description' => 'A chance to hear more about Google\'s developer products.',
'visibility' => 'private',
'start' => array(
'dateTime' => '2018-02-15T09:00:00-07:00',
'timeZone' => 'America/Los_Angeles',
),
'end' => array(
'dateTime' => '2018-02-15T17:00:00-07:00',
'timeZone' => 'America/Los_Angeles',
),
'recurrence' => array(
'RRULE:FREQ=DAILY;COUNT=2'
),
'attendees' => array(
array( 'email' => 'mail2@gmail.com' ),
//array( 'email' => 'mail@gmail.com' ),
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => 10),
),
),
));
$event = $service->events->insert( $calendarId, $event );
所以我们需要像ACL角色none
(https://developers.google.com/google-apps/calendar/v3/reference/acl)这样的东西,但是在每个事件范围内,而不是整个日历。
有没有办法实现这个目标?
答案 0 :(得分:0)
"透明度"事件的参数应设置为"透明"
$event = new Google_Service_Calendar_Event( array(
'summary' => 'Google I/O 2015',
'location' => '800 Howard St., San Francisco, CA 94103',
'description' => 'A chance to hear more about Google\'s developer products.',
'visibility' => 'private',
'transparency' => 'transparent',
'start' => array(
'dateTime' => '2018-02-15T09:00:00-07:00',
'timeZone' => 'America/Los_Angeles',
),
'end' => array(
'dateTime' => '2018-02-15T17:00:00-07:00',
'timeZone' => 'America/Los_Angeles',
),
'recurrence' => array(
'RRULE:FREQ=DAILY;COUNT=2'
),
'attendees' => array(
array( 'email' => 'mail2@gmail.com' ),
//array( 'email' => 'mail@gmail.com' ),
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => 10),
),
),
));
$event = $service->events->insert( $calendarId, $event );