Add ROOM as a principal type

This hopefully resolves #282.
This commit is contained in:
Andrew Ruthven committed 2024-01-21 19:12:42 +13:00
1 parent bc33199083
commit 1ca8284bdc
25 files changed
+251 -33

No files matched your search

+6 -3
View File
@@ -207,12 +207,15 @@ initialise_regression() {
drop_database ${DBNAME}
TEST="Create-Database"
../dba/create-database.sh ${DBNAME} 'nimda' >"${RESULTS}/${TEST}" 2>&1
../dba/create-database.sh ${DBNAME} 'nimda' \
| sed -r 's/is version [.0-9]+/is version XX/' 2>&1 \
> "${RESULTS}/${TEST}"
check_result "${TEST}"
TEST="Upgrade-Database"
../dba/update-davical-database ${DBAOPTS} --dbname=${DBNAME} --nopatch --appuser davical_app --owner davical_dba >"${RESULTS}/${TEST}" \
| sed -r 's/is version [.0-9]+/is version XX/'2>&1
../dba/update-davical-database ${DBAOPTS} --dbname=${DBNAME} --nopatch --appuser davical_app --owner davical_dba \
| sed -r 's/is version [.0-9]+/is version XX/' 2>&1 \
> "${RESULTS}/${TEST}"
check_result "${TEST}"
if [ -f "${REGRESSION}/sample-data.sql" ]; then
@@ -1,5 +1,13 @@
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
The database is version XX currently at revision 1.3.5.
Applying patch 1.3.6.sql ... succeeded.
Successfully applied 1 patches.
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
@@ -1,4 +1,4 @@
The database is version XX currently at revision 1.3.5.
The database is version XX currently at revision 1.3.6.
No patches were applied.
Supported locales updated.
Updated view: dav_principal.sql applied.
@@ -1,5 +1,13 @@
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
The database is version XX currently at revision 1.3.5.
Applying patch 1.3.6.sql ... succeeded.
Successfully applied 1 patches.
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
@@ -1,4 +1,4 @@
The database is version XX currently at revision 1.3.5.
The database is version XX currently at revision 1.3.6.
No patches were applied.
Supported locales updated.
Updated view: dav_principal.sql applied.
+14
View File
@@ -0,0 +1,14 @@
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
NOTE
====
* The password for the 'admin' user has been set to 'nimda'
Thanks for trying DAViCal! Check the configuration in /etc/davical/config.php.
For help, look at our website and wiki, or visit #davical on irc.oftc.net.
@@ -0,0 +1,7 @@
The database is version XX currently at revision 1.3.3.
No patches were applied.
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
@@ -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: "ae8aac5229a8a5d9ee7c86100322162d"
ETag: "37368bb270ff51917cca6373cacd5681"
Content-Length: 28703
Content-Type: text/xml; charset="utf-8"
@@ -443,7 +443,7 @@ Content-Type: text/xml; charset="utf-8"
<href>/caldav.php/user1/</href>
</owner>
<resource-id>
<href>/caldav.php/.resources/1523</href>
<href>/caldav.php/.resources/1525</href>
</resource-id>
<resourcetype>
<collection/>
@@ -592,7 +592,7 @@ Content-Type: text/xml; charset="utf-8"
<href>/caldav.php/user1/</href>
</owner>
<resource-id>
<href>/caldav.php/.resources/1541</href>
<href>/caldav.php/.resources/1543</href>
</resource-id>
<resourcetype>
<collection/>
@@ -726,7 +726,7 @@ Content-Type: text/xml; charset="utf-8"
<href>/caldav.php/user1/</href>
</owner>
<resource-id>
<href>/caldav.php/.resources/1542</href>
<href>/caldav.php/.resources/1544</href>
</resource-id>
<resourcetype>
<collection/>
@@ -852,7 +852,7 @@ Content-Type: text/xml; charset="utf-8"
<href>/caldav.php/user1/</href>
</owner>
<resource-id>
<href>/caldav.php/.resources/1547</href>
<href>/caldav.php/.resources/1549</href>
</resource-id>
<resourcetype>
<collection/>
@@ -0,0 +1,55 @@
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: "ba0504f201a1e6dcd1ff676796726780"
Content-Length: 1237
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
<multistatus xmlns="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav" xmlns:C1="http://calendarserver.org/ns/">
<response>
<href>/caldav.php/room1/</href>
<propstat>
<prop>
<C:calendar-user-address-set>
<href>mailto:room1@example.net</href>
<href>/caldav.php/room1/</href>
</C:calendar-user-address-set>
<principal-URL>
<href>/caldav.php/room1/</href>
</principal-URL>
<C:calendar-user-type>ROOM</C:calendar-user-type>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
<propstat>
<prop>
<C1:record-type/>
</prop>
<status>HTTP/1.1 404 Not Found</status>
</propstat>
</response>
<response>
<href>/caldav.php/room2/</href>
<propstat>
<prop>
<C:calendar-user-address-set>
<href>mailto:room2@example.net</href>
<href>/caldav.php/room2/</href>
</C:calendar-user-address-set>
<principal-URL>
<href>/caldav.php/room2/</href>
</principal-URL>
<C:calendar-user-type>ROOM</C:calendar-user-type>
</prop>
<status>HTTP/1.1 200 OK</status>
</propstat>
<propstat>
<prop>
<C1:record-type/>
</prop>
<status>HTTP/1.1 404 Not Found</status>
</propstat>
</response>
</multistatus>
@@ -0,0 +1,24 @@
#
# Query from Calendar on macOS >= Ventura
#
# Should only report principals that match ROOM
#
TYPE=REPORT
URL=http://regression.host/caldav.php/user1/home/
HEADER=User-Agent: DAViCal/RegressionTest
HEADER=Content-Type: text/xml
HEADER=Depth: 0
HEAD
BEGINDATA
<?xml version="1.0" encoding="UTF-8"?>
<A:principal-property-search xmlns:A="DAV:" type="ROOM" test="anyof">
<A:prop>
<B:calendar-user-address-set xmlns:B="urn:ietf:params:xml:ns:caldav"/>
<A:principal-URL/>
<B:calendar-user-type xmlns:B="urn:ietf:params:xml:ns:caldav"/>
<C:record-type xmlns:C="http://calendarserver.org/ns/"/>
</A:prop>
</A:principal-property-search>
ENDDATA
@@ -1,5 +1,13 @@
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
The database is version XX currently at revision 1.3.5.
Applying patch 1.3.6.sql ... succeeded.
Successfully applied 1 patches.
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
@@ -1,4 +1,4 @@
The database is version XX currently at revision 1.3.5.
The database is version XX currently at revision 1.3.6.
No patches were applied.
Supported locales updated.
Updated view: dav_principal.sql applied.
@@ -5,7 +5,7 @@
setval
--------
1013
1015
(1 row)
setval
@@ -105,7 +105,7 @@
setval
--------
1
4
(1 row)
setval
@@ -33,6 +33,13 @@ INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullna
VALUES( 101, TRUE, current_date, current_date, 'resource2', '*salt*unpossible', 'Resource 2', 'resource2@example.net' );
INSERT INTO role_member (user_no, role_no) VALUES( 101, 4);
INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullname, email )
VALUES( 150, TRUE, current_date, current_date, 'room1', '*salt*unpossible', 'Room 1', 'room1@example.net' );
INSERT INTO role_member (user_no, role_no) VALUES( 150, 5);
INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullname, email )
VALUES( 151, TRUE, current_date, current_date, 'room2', '*salt*unpossible', 'Room 2', 'room2@example.net' );
INSERT INTO role_member (user_no, role_no) VALUES( 151, 5);
INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullname, email )
VALUES( 200, TRUE, current_date, current_date, 'resmgr1', '*salt*unpossible', 'Resource Managers', 'resource-managers@example.net' );
INSERT INTO role_member (user_no, role_no) VALUES( 200, 2);
@@ -41,6 +48,7 @@ INSERT INTO usr ( user_no, active, email_ok, updated, username, password, fullna
VALUES( 300, TRUE, current_date, current_date, 'teamclient1', '*salt*unpossible', 'Team for Client1', 'team-client1@example.net' );
INSERT INTO role_member (user_no, role_no) VALUES( 300, 2);
SELECT setval('usr_user_no_seq', 1000);
SELECT setval('dav_id_seq', 1000);
@@ -67,6 +75,7 @@ INSERT INTO principal (type_id, user_no, displayname, default_privileges)
SELECT 1, user_no, fullname, privilege_to_bits(ARRAY['read-free-busy','schedule-send','schedule-deliver']) FROM usr
WHERE NOT EXISTS(SELECT 1 FROM role_member JOIN roles USING(role_no) WHERE role_name = 'Group' AND role_member.user_no = usr.user_no)
AND NOT EXISTS(SELECT 1 FROM role_member JOIN roles USING(role_no) WHERE role_name = 'Resource' AND role_member.user_no = usr.user_no)
AND NOT EXISTS(SELECT 1 FROM role_member JOIN roles USING(role_no) WHERE role_name = 'Room' AND role_member.user_no = usr.user_no)
AND NOT EXISTS(SELECT 1 FROM principal WHERE principal.user_no = usr.user_no) ORDER BY user_no;
INSERT INTO principal (type_id, user_no, displayname, default_privileges)
@@ -79,6 +88,11 @@ INSERT INTO principal (type_id, user_no, displayname, default_privileges)
WHERE EXISTS(SELECT 1 FROM role_member JOIN roles USING(role_no) WHERE role_name = 'Group' AND role_member.user_no = usr.user_no)
AND NOT EXISTS(SELECT 1 FROM principal WHERE principal.user_no = usr.user_no) ORDER BY user_no;
INSERT INTO principal (type_id, user_no, displayname, default_privileges)
SELECT 4, user_no, fullname, privilege_to_bits(ARRAY['read-free-busy','schedule-send','schedule-deliver']) FROM usr
WHERE EXISTS(SELECT 1 FROM role_member JOIN roles USING(role_no) WHERE role_name = 'Room' AND role_member.user_no = usr.user_no)
AND NOT EXISTS(SELECT 1 FROM principal WHERE principal.user_no = usr.user_no) ORDER BY user_no;
-- Set the insert sequence to the next number, with a minimum of 1000
SELECT setval('relationship_type_rt_id_seq', (SELECT 10 UNION SELECT rt_id FROM relationship_type ORDER BY 1 DESC LIMIT 1) );
@@ -1,5 +1,13 @@
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
The database is version XX currently at revision 1.3.5.
Applying patch 1.3.6.sql ... succeeded.
Successfully applied 1 patches.
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
@@ -1,4 +1,4 @@
The database is version XX currently at revision 1.3.5.
The database is version XX currently at revision 1.3.6.
No patches were applied.
Supported locales updated.
Updated view: dav_principal.sql applied.
@@ -1,5 +1,13 @@
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
RRULE functions updated.
Database permissions updated.
The database is version XX currently at revision 1.3.5.
Applying patch 1.3.6.sql ... succeeded.
Successfully applied 1 patches.
Supported locales updated.
Updated view: dav_principal.sql applied.
CalDAV functions updated.
@@ -1,4 +1,4 @@
The database is version XX currently at revision 1.3.5.
The database is version XX currently at revision 1.3.6.
No patches were applied.
Supported locales updated.
Updated view: dav_principal.sql applied.