diff options
author | Thomas Citharel <tcit@tcit.fr> | 2016-07-07 16:28:30 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-09-26 11:55:35 +0200 |
commit | 8da2100e7d5cc7819624a803e10b18f53ccacd9d (patch) | |
tree | fe357a238130b9096c88e3ff3724a57083c778db /apps/dav/lib/CalDAV/CalDavBackend.php | |
parent | bd0aae8636b846cb43a844838ae42d4203dc693a (diff) | |
download | nextcloud-server-8da2100e7d5cc7819624a803e10b18f53ccacd9d.tar.gz nextcloud-server-8da2100e7d5cc7819624a803e10b18f53ccacd9d.zip |
Start work on returning CalDAV published calendars
Diffstat (limited to 'apps/dav/lib/CalDAV/CalDavBackend.php')
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 8c651251106..b1d85e09808 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -1514,6 +1514,34 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription } /** + * @param string $token + * @param string secret + * @return int | boolean + * + * Function to get the ressource we're insteressed in. Most probably to put somewhere else. + */ + public function getResourceIdFromToken($token, $secret) { + $query = $this->db->getQueryBuilder(); + $result = $query->select('resourceid') + ->from('dav_shares') + ->where($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))) + ->execute(); + + $publications = []; + while($row = $result->fetch()) { + $publications[] = $row['resourceid']; + } + + $i = 0; + $found = false; + while ($i < count($publications) && !$found) { + $found = md5($secret.$publications[$i]) === $token; + if (!$found) $i++; + } + return ($found) ? $publications[$i] : false; + } + + /** * @param int $resourceId * @param array $acl * @return array |