Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
"""CardDAV support.
https://tools.ietf.org/html/rfc6352
"""
from xandikos import (
collation as _mod_collation,
davcommon,
webdav,
)
ET = webdav.ET
WELLKNOWN_CARDDAV_PATH = "/.well-known/carddav"
NAMESPACE = 'urn:ietf:params:xml:ns:carddav'
ADDRESSBOOK_RESOURCE_TYPE = '{%s}addressbook' % NAMESPACE
# Feature to advertise presence of CardDAV support
FEATURE = 'addressbook'
class AddressbookHomeSetProperty(webdav.Property):
"""addressbook-home-set property
See https://tools.ietf.org/html/rfc6352, section 7.1.1
"""
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
"""Server info.
See https://www.ietf.org/archive/id/draft-douglass-server-info-03.txt
"""
import hashlib
from xandikos import version_string
from xandikos import webdav
ET = webdav.ET
# Feature to advertise server-info support.
FEATURE = 'server-info'
SERVER_INFO_MIME_TYPE = 'application/server-info+xml'
class ServerInfo(object):
"""Server info."""
def __init__(self):
self._token = None
self._features = []
self._applications = []
def add_feature(self, feature):
self._features.append(feature)
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
"""Common functions for DAV implementations."""
from xandikos import webdav
ET = webdav.ET
class SubbedProperty(webdav.Property):
"""Property with sub-components that can be queried."""
async def get_value_ext(self, href, resource, el, environ, requested):
"""Get the value of a data property.
:param href: Resource href
:param resource: Resource to get value for
:param el: Element to fill in
:param environ: WSGI environ dict
:param requested: Requested property (including subelements)
"""
raise NotImplementedError(self.get_value_ext)
https://tools.ietf.org/html/rfc4791
"""
import datetime
import itertools
import pytz
from .icalendar import (
apply_time_range_vevent,
as_tz_aware_ts,
)
from icalendar.cal import component_factory, Calendar as ICalendar, FreeBusy
from icalendar.prop import vDDDTypes, vPeriod, LocalTimezone
from xandikos import davcommon, webdav
ET = webdav.ET
PRODID = '-//Jelmer Vernooij//Xandikos//EN'
WELLKNOWN_CALDAV_PATH = "/.well-known/caldav"
EXTENDED_MKCOL_FEATURE = 'extended-mkcol'
NAMESPACE = 'urn:ietf:params:xml:ns:caldav'
# https://tools.ietf.org/html/rfc4791, section 4.2
CALENDAR_RESOURCE_TYPE = '{%s}calendar' % NAMESPACE
SUBSCRIPTION_RESOURCE_TYPE = '{http://calendarserver.org/ns/}subscribed'
# TODO(jelmer): These resource types belong in scheduling.py
SCHEDULE_INBOX_RESOURCE_TYPE = '{%s}schedule-inbox' % NAMESPACE
SCHEDULE_OUTBOX_RESOURCE_TYPE = '{%s}schedule-outbox' % NAMESPACE
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
"""Access control.
See http://www.webdav.org/specs/rfc3744.html
"""
from xandikos import webdav
ET = webdav.ET
# Feature to advertise access control support.
FEATURE = 'access-control'
class CurrentUserPrivilegeSetProperty(webdav.Property):
"""current-user-privilege-set property
See http://www.webdav.org/specs/rfc3744.html, section 3.7
"""
name = '{DAV:}current-user-privilege-set'
in_allprops = False
live = True
def get_value(self, href, resource, el, environ):
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
"""Calendar synchronisation.
See https://tools.ietf.org/html/rfc6578
"""
import itertools
import urllib.parse
from xandikos import webdav
ET = webdav.ET
FEATURE = 'sync-collection'
class SyncToken(object):
"""A sync token wrapper."""
def __init__(self, token):
self.token = token
def aselement(self):
ret = ET.Element('{DAV:}sync-token')
ret.text = self.token
return ret