(domain, couch_user, as_user_obj)
This function determines if the couch_user is permitted to restore
    for the domain and/or as_user_obj
    :param domain: Domain of restore
    :param couch_user: The couch user attempting authentication
    :param as_user_obj: The user that the couch_user is attempting to get
        a restore for. If None will get restore of the couch_user.
    :returns: a tuple - first a boolean if the user is permitted,
        secondly a message explaining why a user was rejected if not permitted
This function determines if the couch_user is permitted to restore
    for the domain and/or as_user_obj
    :param domain: Domain of restore
    :param couch_user: The couch user attempting authentication
    :param as_user_obj: The user that the couch_user is attempting to get
        a restore for. If None will get restore of the couch_user.
    :returns: a tuple - first a boolean if the user is permitted,
        secondly a message explaining why a user was rejected if not permitted
This function determines if the couch_user is permitted to restore for the domain and / or as_user_obj : param domain : Domain of restore : param couch_user : The couch user attempting authentication : param as_user_obj : The user that the couch_user is attempting to get a restore for . If None will get restore of the couch_user . : returns : a tuple - first a boolean if the user is permitted secondly a message explaining why a user was rejected if not permitted
def is_permitted_to_restore(domain, couch_user, as_user_obj):
    """
    This function determines if the couch_user is permitted to restore
    for the domain and/or as_user_obj
    :param domain: Domain of restore
    :param couch_user: The couch user attempting authentication
    :param as_user_obj: The user that the couch_user is attempting to get
        a restore for. If None will get restore of the couch_user.
    :returns: a tuple - first a boolean if the user is permitted,
        secondly a message explaining why a user was rejected if not permitted
    """
    try:
        _ensure_valid_domain(domain, couch_user)
        if as_user_obj is not None and not _restoring_as_yourself(couch_user, as_user_obj):
            _ensure_valid_restore_as_user(domain, couch_user, as_user_obj)
            _ensure_accessible_location(domain, couch_user, as_user_obj)
            _ensure_edit_data_permission(domain, couch_user)
    except RestorePermissionDenied as e:
        return False, str(e)
    else:
        return True, None
def is_permitted_to_restore ( domain , couch_user , as_user_obj ) : try : _ensure_valid_domain ( domain , couch_user ) if as_user_obj is not None and not _restoring_as_yourself ( couch_user , as_user_obj ) : _ensure_valid_restore_as_user ( domain , couch_user , as_user_obj ) _ensure_accessible_location ( domain , couch_user , as_user_obj ) _ensure_edit_data_permission ( domain , couch_user ) except RestorePermissionDenied as e : return False , str ( e ) else : return True , None