Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-40629

RH Cloud Scalprum component props should contain permissions

XMLWordPrintable

    • sat-proton
    • 1
    • True
    • Proton Sprint 7
    • None

      When Satellite loads an insights frontend component via scalprum, satellite should be able to send permissions info to the scalprum component so that the front end component can disable/enable UI actions appropriately. Example usage

        

      // Find whatever file has our ScalprumProvider
      
      import { providerOptions } from '../common/ScalprumModule/ScalprumContext'; 
      
      // Reimplement getUserPermissions from chrome: https://github.com/RedHatInsights/frontend-components/blob/master/docs/chrome/chrome-api.md#getuserpermissions
      
      const getUserPermissions = () => {
       // function that takes Satellite user's permissions and translates them to Insights permissions
       // see https://github.com/RedHatInsights/vulnerability-ui/blob/f89271ed530d0c587274d44d2803f4d5efc63ac0/src/Helpers/constants.js#L1091-L1101
       
       // getUserPermissions should return a Promise that resolves to an array of the translated values.
       // This is an array of objects with keys 'permissions' and 'resourceDefinitions'
      // note that each object has a 'permissions' key that lists one permission
       // The array will look like: [{permissions: 'foo:bar:baz', resourceDefinitions: []}, ... ]
       
      
      ...
      
      const modifiedProviderOptions = { 
      ...providerOptions,
      api: {
        chrome: {
          ...providerOptions.api.chrome,
          getUserPermissions, // Pass in our modified getUserPermissions
         }
      }
      
      return (
      <ScalprumProvider {...modifiedproviderOptions} />
      )

       

       

              rh-ee-nalfassi Nofar Alfassi
              rhn-engineering-paji Partha Aji
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: