Exemplo n.º 1
0
def check_machinery(user, permission, obj):
    if not MACHINE_TRANSLATION_SERVICES.exists():
        return False
    if (isinstance(obj, Translation) and obj.is_source
            and not obj.component.intermediate):
        return False
    return check_contribute(user, permission, obj)
Exemplo n.º 2
0
def check_machinery(user, permission, obj):
    # No permission in case there are no machinery services enabled
    if not MACHINE_TRANSLATION_SERVICES.exists():
        return False

    # No machinery for source without intermediate language
    if (isinstance(obj, Translation) and obj.is_source
            and not obj.component.intermediate):
        return False

    # Check the actual machinery.view permission
    if not check_permission(user, permission, obj):
        return False

    # Only show machinery to users allowed to translate or suggest
    return check_edit_approved(user, "unit.edit", obj) or check_suggestion_add(
        user, "suggestion.add", obj)
Exemplo n.º 3
0
def check_machinery(user, permission, obj):
    if not MACHINE_TRANSLATION_SERVICES.exists():
        return False
    if isinstance(obj, Translation) and obj.is_template:
        return False
    return check_contribute(user, permission, obj)
Exemplo n.º 4
0
def check_machinery(user, permission, obj):
    if not MACHINE_TRANSLATION_SERVICES.exists():
        return False
    return check_contribute(user, permission, obj)
Exemplo n.º 5
0
def check_machinery(user, permission, obj):
    if not MACHINE_TRANSLATION_SERVICES.exists():
        return False
    return check_contribute(user, permission, obj)
Exemplo n.º 6
0
def check_machinery(user, permission, obj):
    if not MACHINE_TRANSLATION_SERVICES.exists():
        return False
    if isinstance(obj, Translation) and obj.is_template:
        return False
    return check_contribute(user, permission, obj)