mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-04-28 15:40:14 +00:00
group-member-set and group-membership queries on proxy resources should be handled in DAVResource
Otherwise we cannot be sure if the resource we are looking at is a proxy. Looking at the request as we did in DAVPrincipal is wrong, as one request can result in several resources to be examined, only some of which may be proxies. BTW looking at the regression test changes, I'm not sure having calendar-proxy-read-for on proxy principals is correct, but caldav-proxy seems to have nothing to say on that so we leave it for now.
This commit is contained in:
parent
6687bdcf03
commit
17c2022122
@ -451,7 +451,7 @@ class DAVPrincipal extends Principal
|
||||
* Returns properties which are specific to this principal
|
||||
*/
|
||||
function PrincipalProperty( $tag, $prop, &$reply, &$denied ) {
|
||||
global $c, $request;
|
||||
global $c;
|
||||
|
||||
dbg_error_log('principal',':PrincipalProperty: Principal Property "%s"', $tag );
|
||||
switch( $tag ) {
|
||||
@ -488,26 +488,13 @@ class DAVPrincipal extends Principal
|
||||
|
||||
case 'http://calendarserver.org/ns/:group-member-set':
|
||||
case 'DAV::group-member-set':
|
||||
if ( $request->IsProxyRequest() ) {
|
||||
/** calendar-proxy-{read,write} pseudo-principal, see caldav-proxy 3.2 */
|
||||
if ($request->proxy_type == 'read') {
|
||||
$reply->DAVElement( $prop, 'group-member-set', $reply->href($this->ReadProxyGroup()) );
|
||||
} else {
|
||||
$reply->DAVElement( $prop, 'group-member-set', $reply->href($this->WriteProxyGroup()) );
|
||||
}
|
||||
} else {
|
||||
/** regular group principal */
|
||||
if ( ! $this->_is_group ) return false;
|
||||
$reply->DAVElement( $prop, 'group-member-set', $reply->href($this->group_member_set) );
|
||||
}
|
||||
/** regular group principal, the calendar-proxy pseudo-principal is handled in DAVResource */
|
||||
if ( ! $this->_is_group ) return false;
|
||||
$reply->DAVElement( $prop, 'group-member-set', $reply->href($this->group_member_set) );
|
||||
break;
|
||||
|
||||
case 'http://calendarserver.org/ns/:group-membership':
|
||||
case 'DAV::group-membership':
|
||||
if ( $request->IsProxyRequest() ) {
|
||||
/* the calendar-proxy-{read,write} pseudo-principal should not be a member of any group */
|
||||
return false;
|
||||
}
|
||||
$reply->DAVElement( $prop, 'group-membership', $reply->href($this->GroupMembership()) );
|
||||
break;
|
||||
|
||||
|
||||
@ -113,6 +113,11 @@ class DAVResource
|
||||
*/
|
||||
private $_is_proxy_request;
|
||||
|
||||
/**
|
||||
* @var The type of proxy collection this resource is or is in: read or write
|
||||
*/
|
||||
private $proxy_type;
|
||||
|
||||
/**
|
||||
* @var An array of the methods we support on this resource.
|
||||
*/
|
||||
@ -1709,6 +1714,30 @@ EOQRY;
|
||||
$reply->CalendarserverElement($prop, 'calendar-proxy-'.$proxy_type.'-for', $reply->href( $this->principal->ProxyFor($proxy_type) ) );
|
||||
break;
|
||||
|
||||
case 'http://calendarserver.org/ns/:group-member-set':
|
||||
case 'DAV::group-member-set':
|
||||
if ( $this->_is_proxy_request ) {
|
||||
$this->FetchPrincipal();
|
||||
if ( $this->proxy_type == 'read' ) {
|
||||
$reply->DAVElement( $prop, 'group-member-set', $reply->href( $this->principal->ReadProxyGroup() ) );
|
||||
} else {
|
||||
$reply->DAVElement( $prop, 'group-member-set', $reply->href( $this->principal->WriteProxyGroup() ) );
|
||||
}
|
||||
} else {
|
||||
return false; // leave this to DAVPrincipal
|
||||
}
|
||||
break;
|
||||
|
||||
case 'http://calendarserver.org/ns/:group-membership':
|
||||
case 'DAV::group-membership':
|
||||
if ( $this->_is_proxy_request ) {
|
||||
/* the calendar-proxy-{read,write} pseudo-principal should not be a member of any group */
|
||||
$reply->NSElement($prop, $tag );
|
||||
} else {
|
||||
return false; // leave this to DAVPrincipal
|
||||
}
|
||||
break;
|
||||
|
||||
case 'DAV::current-user-privilege-set':
|
||||
if ( $this->HavePrivilegeTo('DAV::read-current-user-privilege-set') ) {
|
||||
$reply->NSElement($prop, $tag, $this->BuildPrivileges() );
|
||||
|
||||
@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status
|
||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
|
||||
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
|
||||
ETag: "12c268350747ee0076940f61be140827"
|
||||
Content-Length: 6090
|
||||
ETag: "e8e214ead69e04c9895f54796a53e3ab"
|
||||
Content-Length: 5449
|
||||
Content-Type: text/xml; charset="utf-8"
|
||||
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
@ -130,15 +130,10 @@ Content-Type: text/xml; charset="utf-8"
|
||||
<collection/>
|
||||
<C:calendar-proxy-read/>
|
||||
</resourcetype>
|
||||
<group-membership>
|
||||
<href>/caldav.php/assistant1/</href>
|
||||
<group-member-set>
|
||||
<href>/caldav.php/teamclient1/</href>
|
||||
<href>/caldav.php/user1/</href>
|
||||
<href>/caldav.php/user1/calendar-proxy-read/</href>
|
||||
<href>/caldav.php/assistant1/calendar-proxy-read/</href>
|
||||
<href>/caldav.php/resource1/calendar-proxy-read/</href>
|
||||
<href>/caldav.php/resource2/calendar-proxy-read/</href>
|
||||
</group-membership>
|
||||
</group-member-set>
|
||||
<group-membership/>
|
||||
<C:calendar-proxy-read-for>
|
||||
<href>/caldav.php/user1/</href>
|
||||
<href>/caldav.php/assistant1/</href>
|
||||
@ -152,7 +147,6 @@ Content-Type: text/xml; charset="utf-8"
|
||||
<propstat>
|
||||
<prop>
|
||||
<C1:calendar-description/>
|
||||
<group-member-set/>
|
||||
</prop>
|
||||
<status>HTTP/1.1 404 Not Found</status>
|
||||
</propstat>
|
||||
@ -168,15 +162,10 @@ Content-Type: text/xml; charset="utf-8"
|
||||
<collection/>
|
||||
<C:calendar-proxy-write/>
|
||||
</resourcetype>
|
||||
<group-membership>
|
||||
<group-member-set>
|
||||
<href>/caldav.php/assistant1/</href>
|
||||
<href>/caldav.php/teamclient1/</href>
|
||||
<href>/caldav.php/user1/</href>
|
||||
<href>/caldav.php/user1/calendar-proxy-read/</href>
|
||||
<href>/caldav.php/assistant1/calendar-proxy-read/</href>
|
||||
<href>/caldav.php/resource1/calendar-proxy-read/</href>
|
||||
<href>/caldav.php/resource2/calendar-proxy-read/</href>
|
||||
</group-membership>
|
||||
</group-member-set>
|
||||
<group-membership/>
|
||||
<C:calendar-proxy-read-for>
|
||||
<href>/caldav.php/user1/</href>
|
||||
<href>/caldav.php/assistant1/</href>
|
||||
@ -190,7 +179,6 @@ Content-Type: text/xml; charset="utf-8"
|
||||
<propstat>
|
||||
<prop>
|
||||
<C1:calendar-description/>
|
||||
<group-member-set/>
|
||||
</prop>
|
||||
<status>HTTP/1.1 404 Not Found</status>
|
||||
</propstat>
|
||||
|
||||
@ -2,7 +2,7 @@ HTTP/1.1 207 Multi-Status
|
||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
|
||||
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
|
||||
ETag: "6fd0a85fe582ad2af132724a7566be48"
|
||||
ETag: "68b03f180d5f9046907a86251de16246"
|
||||
Content-Length: 1055
|
||||
Content-Type: text/xml; charset="utf-8"
|
||||
|
||||
@ -22,6 +22,7 @@ Content-Type: text/xml; charset="utf-8"
|
||||
<group-member-set>
|
||||
<href>/caldav.php/teamclient1/</href>
|
||||
</group-member-set>
|
||||
<group-membership/>
|
||||
<C:calendar-proxy-read-for>
|
||||
<href>/caldav.php/user1/</href>
|
||||
<href>/caldav.php/assistant1/</href>
|
||||
@ -35,7 +36,6 @@ Content-Type: text/xml; charset="utf-8"
|
||||
<propstat>
|
||||
<prop>
|
||||
<C1:calendar-description/>
|
||||
<group-membership/>
|
||||
</prop>
|
||||
<status>HTTP/1.1 404 Not Found</status>
|
||||
</propstat>
|
||||
|
||||
@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status
|
||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
|
||||
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
|
||||
ETag: "01b056983b4d191d66f3286a33260b0c"
|
||||
Content-Length: 1718
|
||||
ETag: "3c65d6bec2a0e4b4b1585376514d6ac4"
|
||||
Content-Length: 1424
|
||||
Content-Type: text/xml; charset="utf-8"
|
||||
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
@ -48,10 +48,7 @@ Content-Type: text/xml; charset="utf-8"
|
||||
<href>/caldav.php/resmgr1/calendar-proxy-read/</href>
|
||||
<propstat>
|
||||
<prop>
|
||||
<group-membership>
|
||||
<href>/caldav.php/resource1/calendar-proxy-write/</href>
|
||||
<href>/caldav.php/resource2/calendar-proxy-write/</href>
|
||||
</group-membership>
|
||||
<group-membership/>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
@ -60,10 +57,7 @@ Content-Type: text/xml; charset="utf-8"
|
||||
<href>/caldav.php/resmgr1/calendar-proxy-write/</href>
|
||||
<propstat>
|
||||
<prop>
|
||||
<group-membership>
|
||||
<href>/caldav.php/resource1/calendar-proxy-write/</href>
|
||||
<href>/caldav.php/resource2/calendar-proxy-write/</href>
|
||||
</group-membership>
|
||||
<group-membership/>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
|
||||
@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status
|
||||
Date: Dow, 01 Jan 2000 00:00:00 GMT
|
||||
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
|
||||
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
|
||||
ETag: "01b056983b4d191d66f3286a33260b0c"
|
||||
Content-Length: 1718
|
||||
ETag: "3c65d6bec2a0e4b4b1585376514d6ac4"
|
||||
Content-Length: 1424
|
||||
Content-Type: text/xml; charset="utf-8"
|
||||
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
@ -48,10 +48,7 @@ Content-Type: text/xml; charset="utf-8"
|
||||
<href>/caldav.php/resmgr1/calendar-proxy-read/</href>
|
||||
<propstat>
|
||||
<prop>
|
||||
<group-membership>
|
||||
<href>/caldav.php/resource1/calendar-proxy-write/</href>
|
||||
<href>/caldav.php/resource2/calendar-proxy-write/</href>
|
||||
</group-membership>
|
||||
<group-membership/>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
@ -60,10 +57,7 @@ Content-Type: text/xml; charset="utf-8"
|
||||
<href>/caldav.php/resmgr1/calendar-proxy-write/</href>
|
||||
<propstat>
|
||||
<prop>
|
||||
<group-membership>
|
||||
<href>/caldav.php/resource1/calendar-proxy-write/</href>
|
||||
<href>/caldav.php/resource2/calendar-proxy-write/</href>
|
||||
</group-membership>
|
||||
<group-membership/>
|
||||
</prop>
|
||||
<status>HTTP/1.1 200 OK</status>
|
||||
</propstat>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user