@method_decorator(logged_in_or_basicauth(AUTH_REALM))
    @method_decorator(group_required(API_GROUP_NAME))  # FIXME: Should be more granular permissions
    def get(self, request, id_rule):
        """RulesDetailHandler READ method for GET requests

        @param request: is a django request object
        @param id_rule: is an id (PK) of a document type rule we are trying to return
        """
        operator = PluginsOperator()
        try:
            mapping = operator.get_plugin_mapping_by_docrule_id(id_rule)
        except DmsException:
            log.error('RulesDetailHandler.read DmsException: Rule not found. 404')
            if settings.DEBUG:
                raise
            else:
                return Response(status=status.HTTP_400_BAD_REQUEST)
        # Removing mapping key that is not json serializable.
        resp_data = dict(
            active=mapping.active,
            doccode_id=mapping.doccode_id,
            id=mapping.id,
            doccode=mapping.doccode.title,
            before_retrieval_plugins=[plugin.name for plugin in mapping.before_retrieval_plugins.all()],
            storage_plugins=[plugin.name for plugin in mapping.storage_plugins.all()],
            database_storage_plugins=[plugin.name for plugin in mapping.database_storage_plugins.all()],
            before_removal_plugins=[plugin.name for plugin in mapping.before_removal_plugins.all()],
            before_storage_plugins=[plugin.name for plugin in mapping.before_storage_plugins.all()],
        )
        log.info('RulesDetailHandler.read request fulfilled for rule %s' % id_rule)
        return Response(json.dumps(resp_data), status=status.HTTP_200_OK)
dataset/ETHPy150Open adlibre/Adlibre-DMS/adlibre_dms/apps/api/views.py/RulesDetailHandler.get/original