## $Id: webservices.py 11954 2014-11-13 16:54:17Z henrik $
##
## Copyright (C) 2012 Uli Fouquet & Henrik Bettermann
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##

import grok
from zope.component import getUtility
from zope.catalog.interfaces import ICatalog
from waeup.ikoba.interfaces import ICompany, application_sessions_vocab

class XMLRPCPermission(grok.Permission):
    """Permission for using XMLRPC functions.
    """
    grok.name('waeup.xmlrpc')

class XMLRPCUsers1(grok.Role):
    """Usergroup 1
    """
    grok.name('waeup.xmlrpcusers1')
    grok.title('XMLRPC Users Group 1')
    grok.permissions('waeup.xmlrpc',)

class CompanyXMLRPC(grok.XMLRPC):
    """XMLRPC webservices for Ikoba portals.

    Please note, that XMLRPC does not support real keyword arguments
    but positional arguments only.
    """
    grok.context(ICompany)

    @grok.require('waeup.Public')
    def xmlrpc_api_version(self):
        """Return the current API version for XMLRPC clients.
        """
        return u'0.1'
