# 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 IUserTranslator(Interface):
    """Translates IDs and Names to Users resp. their Groups

    A user translator is used to get from an identifying ID or username
    to a User instance. Since you might want to integrate user/group
    backends that do not support write access, this is distinct to
    IUserStore. An example for this would by a read-only LDAP backend.
    """

    _iface_attribute_proxy = FallbackAttributeProxy()

    def username_to_user(self, username):
        """Given a username (what a user can use to log in) find the user

        :returns: a User object on success, None on failure"""
        pass

    def userid_to_user(self, userid):
        """Given a userid find the user

        A translator should construct a guest user if the userid is '*'."""
        pass

    def groupid_to_group(self, userid):
        """Given a groupid find the group

        :returns: a Group object on success, None on failure"""
        pass



# 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 IUserTranslator(Interface):
    """Translates IDs and Names to Users resp. their Groups

    A user translator is used to get from an identifying ID or username
    to a User instance. Since you might want to integrate user/group
    backends that do not support write access, this is distinct to
    IUserStore. An example for this would by a read-only LDAP backend.
    """

    _iface_attribute_proxy = FallbackAttributeProxy()

    def username_to_user(self, username):
        """Given a username (what a user can use to log in) find the user

        :returns: a User object on success, None on failure"""
        pass

    def userid_to_user(self, userid):
        """Given a userid find the user

        A translator should construct a guest user if the userid is '*'."""
        pass

    def groupid_to_group(self, userid):
        """Given a groupid find the group

        :returns: a Group object on success, None on failure"""
        pass



class IUserStore(Interface):