mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-11-29 08:56:03 +00:00
1 parent
bc33199083
commit
1ca8284bdc
25 files changed
+251
-33
No files matched your search
+2
-14
@@ -560,20 +560,8 @@ class DAVPrincipal extends Principal
|
||||
* and https://tools.ietf.org/html/rfc5545#section-3.2.3
|
||||
*/
|
||||
$type = 'UNKNOWN';
|
||||
if ( isset($this->type_id) ) {
|
||||
switch ( $this->type_id ) {
|
||||
case 1:
|
||||
$type = 'INDIVIDUAL';
|
||||
break;
|
||||
case 2:
|
||||
$type = 'RESOURCE';
|
||||
break;
|
||||
case 3:
|
||||
$type = 'GROUP';
|
||||
break;
|
||||
// 'ROOM' type is not supported yet
|
||||
}
|
||||
}
|
||||
if ( isset($this->type_label) )
|
||||
$type = $this->type_label;
|
||||
$reply->CalDAVElement($prop, 'calendar-user-type', $type);
|
||||
break;
|
||||
|
||||
|
||||
+3
-2
@@ -60,6 +60,7 @@ class Principal {
|
||||
public $date_format_type;
|
||||
public $locale;
|
||||
public $type_id;
|
||||
public $type_label;
|
||||
public $displayname;
|
||||
public $default_privileges;
|
||||
public $is_principal;
|
||||
@@ -193,7 +194,7 @@ class Principal {
|
||||
}
|
||||
}
|
||||
|
||||
$sql = 'SELECT *, ';
|
||||
$sql = 'SELECT dav_principal.*, principal_type.label AS type_label, ';
|
||||
if ( isset($session->principal_id) && $session->principal_id !== false ) {
|
||||
$sql .= 'pprivs(:session_principal::int8,principal_id,:scan_depth::int) AS privileges ';
|
||||
$params = array( ':session_principal' => $session->principal_id, ':scan_depth' => $c->permission_scan_depth );
|
||||
@@ -202,7 +203,7 @@ class Principal {
|
||||
$sql .= '0::BIT(24) AS privileges ';
|
||||
$params = array( );
|
||||
}
|
||||
$sql .= 'FROM dav_principal WHERE ';
|
||||
$sql .= 'FROM dav_principal LEFT JOIN principal_type ON (type_id = principal_type_id) WHERE ';
|
||||
switch ( $type ) {
|
||||
case 'username':
|
||||
$sql .= 'lower(username)=lower(text(:param))';
|
||||
|
||||
@@ -102,6 +102,8 @@ function CreateHomeCollections( $username, $default_timezone = null ) {
|
||||
'name' => $c->home_in_calendar_name,
|
||||
'displayname_suffix' => ' Inbox'
|
||||
);
|
||||
|
||||
// XXX Should we not do this for ROOMS?
|
||||
if( !empty($c->home_addressbook_name) )
|
||||
$c->default_collections[] = array(
|
||||
'type' => 'addressbook',
|
||||
|
||||
@@ -16,8 +16,24 @@ if ( isset($CS_search_test) && $CS_search_test == 'anyof' ) {
|
||||
$clause_joiner = " OR ";
|
||||
}
|
||||
|
||||
# Calendar on macOS searches for the principal type as an attribute.
|
||||
$principal_type = $xmltree->GetAttribute('type');
|
||||
|
||||
$params = array();
|
||||
$typewhere = "";
|
||||
$where = "";
|
||||
$join = "";
|
||||
|
||||
dbg_error_log("SEARCH", "type: '%s'", $principal_type );
|
||||
|
||||
// This is ugly, but macOS specifies the calendar type as an attribute
|
||||
if (isset($principal_type)) {
|
||||
$typewhere = 'principal_type.label = :principal_type';
|
||||
$params[':principal_type'] = $principal_type;
|
||||
|
||||
$join = 'LEFT JOIN principal_type ON (type_id = principal_type_id)';
|
||||
}
|
||||
|
||||
foreach( $searches AS $k => $search ) {
|
||||
$qry_props = $search->GetPath('/DAV::property-search/DAV::prop/*'); // There may be many
|
||||
$match = $search->GetPath('/DAV::property-search/DAV::match'); // There may only be one
|
||||
@@ -61,8 +77,16 @@ foreach( $searches AS $k => $search ) {
|
||||
$where .= sprintf( "%s(%s)", ($where == "" ? "" : $clause_joiner), $subwhere );
|
||||
}
|
||||
}
|
||||
if ( $where != "" ) $where = "WHERE $where";
|
||||
$sql = "SELECT * FROM dav_principal $where ORDER BY principal_id LIMIT 100";
|
||||
|
||||
if ( $where != "" && $typewhere != "" ) {
|
||||
$where = "WHERE $typewhere AND $where";
|
||||
} elseif ( $where != "" ) {
|
||||
$where = "WHERE $where";
|
||||
} elseif ( $typewhere != "" ) {
|
||||
$where = "WHERE $typewhere";
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM dav_principal $join $where ORDER BY principal_id LIMIT 100";
|
||||
$qry = new AwlQuery($sql, $params);
|
||||
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ $user_menu->AddOption(translate('View My Details'),$c->base_url.'/admin.php?acti
|
||||
$user_menu->AddOption(translate('List Users'),$c->base_url.'/admin.php?action=browse&t=principal&type=1');
|
||||
$user_menu->AddOption(translate('List Resources'),$c->base_url.'/admin.php?action=browse&t=principal&type=2');
|
||||
$user_menu->AddOption(translate('List Groups'),$c->base_url.'/admin.php?action=browse&t=principal&type=3');
|
||||
$user_menu->AddOption(translate('List Rooms'),$c->base_url.'/admin.php?action=browse&t=principal&type=4');
|
||||
|
||||
$admin_menu = new MenuSet('submenu', 'submenu', 'submenu_active');
|
||||
if ( $session->AllowedTo('Admin' )) {
|
||||
|
||||
Reference in new issue
Block a user