mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-30 18:37:12 +00:00
Add support for publicly readable calendars.
This commit is contained in:
parent
c14181484f
commit
f65770b7f1
@ -358,7 +358,9 @@ EOSQL;
|
||||
return;
|
||||
}
|
||||
|
||||
$permissions = array();
|
||||
$this->permissions = array();
|
||||
|
||||
if ( $this->IsPublic() ) $this->permissions['read'] = 'read';
|
||||
|
||||
/**
|
||||
* In other cases we need to query the database for permissions
|
||||
@ -366,7 +368,6 @@ EOSQL;
|
||||
$qry = new PgQuery( "SELECT get_permissions( ?, ? ) AS perm;", $session->user_no, $this->user_no);
|
||||
if ( $qry->Exec("caldav") && $permission_result = $qry->Fetch() ) {
|
||||
$permission_result = "!".$permission_result->perm; // We prepend something to ensure we get a non-zero position.
|
||||
$this->permissions = array();
|
||||
if ( strpos($permission_result,"A") )
|
||||
$this->permissions['all'] = 'all';
|
||||
else {
|
||||
@ -391,8 +392,6 @@ EOSQL;
|
||||
* @todo This logic does not catch all locking scenarios. For example an infinite
|
||||
* depth request should check the permissions for all collections and resources within
|
||||
* that. At present we only maintain permissions on a per-collection basis though.
|
||||
*
|
||||
* @param string $dav_name The resource which we want to know the lock status for
|
||||
*/
|
||||
function IsLocked() {
|
||||
if ( !isset($this->_locks_found) ) {
|
||||
@ -423,6 +422,17 @@ EOSQL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether the collection is public
|
||||
*/
|
||||
function IsPublic() {
|
||||
if ( isset($this->collection) && isset($this->collection->publicly_readable) && $this->collection->publicly_readable == 't' ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the name for this depth: 0, 1, infinity
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user