# Path: cydra/component.py
# class Interface(object):
#     """Marker base class for extension point interfaces.
# 
#     Behavior of the ExtensionPoints for an interface can be customized with
#     _iface_XY class attributes. These behaviors are specified in the interface
#     in order to establish common ground rules in accessing the components for
#     an interface."""
# 
#     _iface_single_extension = False
#     """Only allow one active component for this interface"""
# 
#     _iface_attribute_proxy = None
#     """Callable to use for attribute access
# 
#     The callable will receive the paramenters interface, components and name (in this order)"""
# 
#     _iface_disable_extension_cache = False
#     """Disable the cache for the active extensions"""
# 
# class FallbackAttributeProxy(object):
#     """Proxy for use in interfaces
# 
#     Tries one extension after the other until something not None is returned"""
# 
#     def __init__(self):
#         pass
# 
#     def __call__(self, interface, components, name):
#         def call_all_components(*args, **kwargs):
#             for o in components:
#                 ret = getattr(o, name)(*args, **kwargs)
#                 if ret is not None:
#                     return ret
# 
#         if callable(getattr(interface, name)):
#             return call_all_components
#         else:
#             for o in components:
#                 ret = getattr(o, name)
#                 if ret is not None:
#                     return ret
#             return None


from functools import partial
from cydra.component import Interface, FallbackAttributeProxy

class IUserStore(Interface):
    """Used to create/modify users"""

    _iface_single_extension = True

    def create_user(self, **kwargs):
        """Create a user with the given attributes

        If no id was given and the store supports automatic generation
        (or in case the store *requires* automatic generation) the store
        should generate an id.

        If arguments have been given that cannot be fulfilled, eg:
          * illegal characters in username
          * no support for passwords but a password was given
          * userid given but ids are assigned by the backend

        A ValueError should be raised

        :param username: Desired username
        :param password: Desired password
        :returns: UserID if user generation was successful
        """
        pass


class IUserAuthenticator(Interface):
    """Authenticate users"""


# Path: cydra/component.py
# class Interface(object):
#     """Marker base class for extension point interfaces.
# 
#     Behavior of the ExtensionPoints for an interface can be customized with
#     _iface_XY class attributes. These behaviors are specified in the interface
#     in order to establish common ground rules in accessing the components for
#     an interface."""
# 
#     _iface_single_extension = False
#     """Only allow one active component for this interface"""
# 
#     _iface_attribute_proxy = None
#     """Callable to use for attribute access
# 
#     The callable will receive the paramenters interface, components and name (in this order)"""
# 
#     _iface_disable_extension_cache = False
#     """Disable the cache for the active extensions"""
# 
# class FallbackAttributeProxy(object):
#     """Proxy for use in interfaces
# 
#     Tries one extension after the other until something not None is returned"""
# 
#     def __init__(self):
#         pass
# 
#     def __call__(self, interface, components, name):
#         def call_all_components(*args, **kwargs):
#             for o in components:
#                 ret = getattr(o, name)(*args, **kwargs)
#                 if ret is not None:
#                     return ret
# 
#         if callable(getattr(interface, name)):
#             return call_all_components
#         else:
#             for o in components:
#                 ret = getattr(o, name)
#                 if ret is not None:
#                     return ret
#             return None


# Path: cydra/permission/interfaces.py
from functools import partial
from cydra.component import Interface, FallbackAttributeProxy


class IUserStore(Interface):
    """Used to create/modify users"""

    _iface_single_extension = True

    def create_user(self, **kwargs):
        """Create a user with the given attributes

        If no id was given and the store supports automatic generation
        (or in case the store *requires* automatic generation) the store
        should generate an id.

        If arguments have been given that cannot be fulfilled, eg:
          * illegal characters in username
          * no support for passwords but a password was given
          * userid given but ids are assigned by the backend

        A ValueError should be raised

        :param username: Desired username
        :param password: Desired password
        :returns: UserID if user generation was successful
        """
        pass


class IUserAuthenticator(Interface):
    """Authenticate users"""


    _iface_attribute_proxy = FallbackAttributeProxy()