Logo Search packages:      
Sourcecode: davical version File versions  Download package

CalDAVRequest::IsLocked (  )

Checks whether the resource is locked, returning any lock token, or false

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.
Parameters:
string$dav_nameThe resource which we want to know the lock status for

Find the locks that might apply and load them into an array

Definition at line 397 of file CalDAVRequest.php.

References DoResponse(), and IsInfiniteDepth().

Referenced by FailIfLocked(), and GetLockDetails().

                      {
    if ( !isset($this->_locks_found) ) {
      $this->_locks_found = array();
      /**
      * Find the locks that might apply and load them into an array
      */
      $sql = "SELECT * FROM locks WHERE ?::text ~ ('^'||dav_name||?)::text;";
      $qry = new PgQuery($sql, $this->path, ($this->IsInfiniteDepth() ? '' : '$') );
      if ( $qry->Exec("caldav",__LINE__,__FILE__) ) {
        while( $lock_row = $qry->Fetch() ) {
          $this->_locks_found[$lock_row->opaquelocktoken] = $lock_row;
        }
      }
      else {
        $this->DoResponse(500,translate("Database Error"));
        // Does not return.
      }
    }

    foreach( $this->_locks_found AS $lock_token => $lock_row ) {
      if ( $lock_row->depth == DEPTH_INFINITY || $lock_row->dav_name == $this->path ) {
        return $lock_token;
      }
    }

    return false;  // Nothing matched
  }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index