Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-2624

Export request logs a exception for missing permissions

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Undefined Undefined
    • 2024-06-24 - API
    • None
    • None
    • None

      If the user with not enough permission for the resource attempts to send a export request for the resource. An exception occurs in the logs 

      [level=ERROR] [category=org.candlepin.subscriptions.export.ExportSubscriptionListener] - Error thrown for event: 'f8c5fae4-6ebc-417d-a494-13fc6eeb604e' sending ErrorRequest: 'Insufficient permission'

      This card is to modify the exception to return true or false

      With discussion with jcarvaja@redhat.com suggestion was to change the current from,

          checkRbac(request);
                        uploadData(exporterService, request);
      
                        log.info(
                            "Event processed: '{}' from application: '{}'",
                            request.getId(),
                            request.getSource()); 

      to 

                        if (checkRbac(request)) {
                          uploadData(exporterService, request);
      
                          log.info(
                                  "Event processed: '{}' from application: '{}'",
                                  request.getId(),
                                  request.getSource());
                        } else {
                          exportApi.downloadExportError(
                                  request.getExportRequestUUID(),
                                  request.getApplication(),
                                  request.getRequest().getUUID(),
                                  new DownloadExportErrorRequest().error(xxx).message("missing permissions or something like this"));
                        } 

      Related discussion: https://redhat-internal.slack.com/archives/C04K9MVQ9R9/p1718088910363549

              jcarvaja@redhat.com Jose Carvajal Hilario
              sjagtap@redhat.com Sanket Jagtap
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: