@register.simple_tag(takes_context=True)
def check_index_permit(context):
    """
    Checks request.user for permission to INDEX in MUI

    In fact he must be in search group in security.
    Set's up context variable 'index_permitted'
    it can be used farther in IF template compassion.
    """
    # Do nothing if context variable has already been set
    if context in 'index_permitted':
        return ''
    user = context['request'].user
    permission = False
    if not user.is_superuser:
        groups = user.groups.all()
        for group in groups:
            if group.name == SEC_GROUP_NAMES['index']:
                permission = True
    else:
        permission = True
    context['index_permitted'] = permission
    return ''
dataset/ETHPy150Open adlibre/Adlibre-DMS/adlibre_dms/apps/mdtui/templatetags/mui_permissions.py/check_index_permit/swapped operands of `in`