Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🛂 Hide some menus depending on member permissions #3886

Merged
merged 9 commits into from
Jan 15, 2025

Conversation

josemigallas
Copy link
Contributor

@josemigallas josemigallas commented Sep 10, 2024

Fixes:

Updated UI:

Member with zero permissions will see:

  • empty Dashboard
  • empty Context selector
  • Products and Backend APIs (index, new, etc) will raise 403

Screenshot 2024-09-17 at 12 54 55

Member with Access & query analytics will see:

  • Dashboard with Products and Backends widgets, only those accessible
  • Context selector without Audience
  • Product only shows Analytics
  • Backend API shows Overview (not editable) and Analytics

Screenshot 2024-09-17 at 13 01 19

Screenshot 2024-09-17 at 13 03 21

Screenshot 2024-09-17 at 13 03 03

Member with Create, read, update and delete attributes, metrics, mapping rules, etc. will see:

  • Dashboard without analytics
  • Context selector without Audience
  • Product shows Edit, Application (Plans), ActiveDocs, Integration

Screenshot 2024-09-17 at 13 28 27

Screenshot 2024-09-17 at 13 31 11

Member with Create, read, update and delete accounts / applications will see:

  • Dashboard without "potential upgrades" widget and no Backend APIs widget
  • Context selector with everything but Backends
  • Product shows Application (Plans)
  • Backend raises 403

Screenshot 2024-09-17 at 16 36 34

Screenshot 2024-09-17 at 16 40 45

Member with settings will see:

  • Empty dashboard
  • Context selector with Audience and Settings

Screenshot 2024-09-17 at 16 44 23

Screenshot 2024-09-17 at 16 43 36

Member with customer billing will see:

  • Empty dashboard
  • Context selector with Audience and settings
  • Audience > Billing

Screenshot 2024-09-17 at 17 12 35

Screenshot 2024-09-17 at 17 12 24

Member with developer portal will see:

  • Empty dashboard
  • Context selector with Audience and settings
  • Audience > Dev portal

Screenshot 2024-09-17 at 17 14 48

Screenshot 2024-09-17 at 17 14 11

@josemigallas josemigallas self-assigned this Sep 10, 2024
Copy link
Contributor

@jlledom jlledom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this branch come from bye_bye_webpacker? couldn't this be done over master or ruby-3.1

Also, could you please add a description to the PR?

@josemigallas josemigallas force-pushed the THREESCALE-11237_dashboard_backends_persmission branch from e649177 to fb51af4 Compare September 16, 2024 09:26
@josemigallas josemigallas changed the title 🛂 Hide some menus from members 🚧🛂 Hide some menus from members Sep 16, 2024
@josemigallas josemigallas force-pushed the THREESCALE-11237_dashboard_backends_persmission branch from fb51af4 to 27c0e3a Compare September 16, 2024 09:57
@josemigallas josemigallas marked this pull request as draft September 16, 2024 12:42
@josemigallas josemigallas changed the title 🚧🛂 Hide some menus from members 🛂 Hide some menus from Dashboard depending on member permissions Sep 18, 2024
@josemigallas josemigallas marked this pull request as ready for review September 18, 2024 08:16
@josemigallas josemigallas force-pushed the bye_bye_webpacker branch 6 times, most recently from bdde485 to 68ca266 Compare October 4, 2024 11:05
Base automatically changed from bye_bye_webpacker to master October 4, 2024 11:05
An error occurred while trying to automatically change base from bye_bye_webpacker to master October 4, 2024 11:05
@josemigallas josemigallas force-pushed the THREESCALE-11237_dashboard_backends_persmission branch 2 times, most recently from f5a85af to 3e149ee Compare October 7, 2024 07:34
Copy link
Contributor

@jlledom jlledom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried this locally, these are my findings:

  • https://issues.redhat.com/browse/THREESCALE-11237
    • Scenario:
      • Member with Access & query analytics
      • Two Products, two backends
      • The first product has two backends, the second product has no backends
    • Result
      • Giving it access to any product will show the dashboard tab for all backends
      • Giving it access to no product will hide the backend widget
      • In no case I can see only the backend widget with no product widget
      • This behaves exactly the same in master and in this PR
  • https://issues.redhat.com/browse/THREESCALE-11357
    • Scenario:
      • Same permissions as in the issue (check)
      • Two Products, two backends
      • The first product has two backends, the second product has no backends
    • Result
      • "Create" buttons appearing in the dashboard
        • I reproduced it in master, but can't reproduce it in this PR, so it's fixed 👍
      • Product -> Integration -> Backend can attempt to create a backend
        • I reproduced this in master but also in this PR, so it's not fixed
  • Tests
    • I don't know whether we have tests for all the scenarios described in the Jira issues. I guess not, otherwise they would have failed. It would be good to add such tests

@github-actions github-actions bot added the Stale label Nov 15, 2024
@github-actions github-actions bot closed this Dec 1, 2024
@josemigallas josemigallas removed the Stale label Jan 7, 2025
@josemigallas josemigallas reopened this Jan 7, 2025
@3scale 3scale deleted a comment from github-actions bot Jan 7, 2025
@jlledom
Copy link
Contributor

jlledom commented Jan 7, 2025

From my previous comment:

* https://issues.redhat.com/browse/THREESCALE-11357
  
  * Scenario:
    
    * Same permissions as in the issue ([check](https://issues.redhat.com/secure/attachment/13265014/member-user-permissions.png))
    * Two Products, two backends
    * The first product has two backends, the second product has no backends
  * Result
    
    * "Create" buttons appearing in the dashboard
      
      * I reproduced it in master, but can't reproduce it in this PR, so it's fixed 👍
    * Product -> Integration -> Backend can attempt to create a backend
      
      * I reproduced this in master but also in this PR, so it's not fixed

I tried this again and got the same results.

@josemigallas josemigallas changed the title 🛂 Hide some menus from Dashboard depending on member permissions 🛂 Hide some menus depending on member permissions Jan 8, 2025
@josemigallas josemigallas force-pushed the THREESCALE-11237_dashboard_backends_persmission branch from 3e149ee to c11367d Compare January 8, 2025 11:54
@josemigallas
Copy link
Contributor Author

josemigallas commented Jan 8, 2025

UPDATES:

  • Now "Access and query analytics" for backends only will hide the products widget in the dashboard:
    Screenshot 2025-01-08 at 09 18 33

  • In Product > Integration > Backends, adding a backend now won't show an option to create a backend without permission:
    Screenshot 2025-01-08 at 09 18 33

@jlledom
Copy link
Contributor

jlledom commented Jan 9, 2025

I tried this again:

* Now "Access and query analytics" for backends only will hide the products widget in the dashboard:

Works for me 👍

* In Product > Integration > Backends, adding a backend now won't show an option to create a backend without permission:

This still fails for me:

  • For a product with no backends, "Product > Integration > Backends" looks like this:

image

There's an "Add a backend button", when clicking it, the screens to create backends auto-complete for existing backends:

image

And I can create the backend correctly.

I think it would be better to just not show the "Add a backend button" at all. Also, even if the screen loads and the existing backends are auto-completed, trying to create a backend should fail

@josemigallas josemigallas force-pushed the THREESCALE-11237_dashboard_backends_persmission branch from d38f086 to 7f7450d Compare January 9, 2025 12:48
@josemigallas
Copy link
Contributor Author

This still fails for me:

  • For a product with no backends, "Product > Integration > Backends" looks like this:

image
There's an "Add a backend button", when clicking it, the screens to create backends auto-complete for existing backends:
image
And I can create the backend correctly.
I think it would be better to just not show the "Add a backend button" at all. Also, even if the screen loads and the existing backends are auto-completed, trying to create a backend should fail

@jlledom However, this is not creating a new backend. It is simply adding an existing backend to a product.

@jlledom
Copy link
Contributor

jlledom commented Jan 10, 2025

@jlledom However, this is not creating a new backend. It is simply adding an existing backend to a product.

Is that supposed to be allowed? In that case, OK

jlledom
jlledom previously approved these changes Jan 10, 2025
@josemigallas
Copy link
Contributor Author

UPDATE:

A member without access to a Product won't see it in its backend Overview page:
Screenshot 2025-01-13 at 10 27 53

@josemigallas josemigallas force-pushed the THREESCALE-11237_dashboard_backends_persmission branch from 9a7b89b to 3cc09fc Compare January 13, 2025 10:35
mayorova
mayorova previously approved these changes Jan 14, 2025
Copy link
Contributor

@mayorova mayorova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't review the code itself carefully enough, but I think the behavior is now reasonable and fixes the three related JIRAs.

@josemigallas josemigallas merged commit b2462b3 into master Jan 15, 2025
17 of 21 checks passed
@josemigallas josemigallas deleted the THREESCALE-11237_dashboard_backends_persmission branch January 15, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants