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

feat(rbac): add rbac dynamic plugin #937

Conversation

ciiay
Copy link
Contributor

@ciiay ciiay commented Jan 30, 2024

Description

By this change, the RBAC dynamic plugin is included in the backstage-showcase container image, disabled by default.

Which issue(s) does this PR fix

  • This is for RHIDP-1050: Add/enable RBAC UI plugin to showcase/RHDH and test the RBAC UI flow

Requires

janus-idp/backstage-plugins#1133

PR acceptance criteria

Please make sure that the following steps are complete:

  • GitHub Actions are completed and successful
  • Unit Tests are updated and passing
  • E2E Tests are updated and passing
  • Documentation is updated if necessary (requirement for new features)
  • Add a screenshot if the change is UX/UI related

How to test changes / Special notes to the reviewer

  1. Enable authentication and login with a non-guest user.
  2. In your local backstage-plugins/plugins/rbac directory, run yarn export-dynamic to export RBAC plugin UI as a dynamic plugin
  3. In your local backstage-showcase/dynamic-plugins-root/ directory, run the below command to install RBAC plugin UI
pkg=<local/path/to/backstage-plugins/plugins/rbac/>
archive=$(npm pack $pkg)
tar -xzf "$archive" && rm "$archive"
mv package $(echo $archive | sed -e 's:\.tgz$::')
  1. In your local backstage-showcase/app-config.local.yaml file, add the below changes
...
# Add this to enable RBAC
permission:
  enabled: true
  rbac:
    policies-csv-file: ../../rbac-policy.csv
    # In ../../rbac-policy.csv add the following line to test RBAC backend installation:
    # p, role:default/team_a, catalog-entity, read, allow

    # g, user:default/<USERNAME>, role:default/team_a

    # p, role:default/team_a, catalog-entity, read, allow
    # p, role:default/team_a, catalog.entity.create, create, allow
    # p, role:default/team_a, catalog.location.create, create, allow
    # p, role:default/team_a, catalog.location.read, read, allow
    admin:
      users:
        - name: user:default/ciiay
# End of RBAC config

# Add this to enable Dynamic Plugins
dynamicPlugins:
  rootDirectory: dynamic-plugins-root
  frontend:
    janus-idp.backstage-plugin-rbac:
      appIcons:
        - name: AdminPanelSettingsOutlinedIcon
          module: RbacPlugin
          importName: AdminPanelSettingsOutlinedIcon
      dynamicRoutes:
        - path: /rbac
          importName: RbacPage
          module: RbacPlugin
          menuItem:
            icon: AdminPanelSettingsOutlinedIcon
            text: Administration
# End of Dynamic Plugins enablement config
  1. In dynamic-plugins.default.yaml file Line 503, change disabled value to disabled: false to enable RBAC plugin UI.
  2. Start Backend-showcase app, and observe that Administration button shows on the left side menu.

Screen recording of test:

rhidp_1050_test_rbac.mov

@ciiay ciiay requested a review from a team as a code owner January 30, 2024 16:30
Copy link

changeset-bot bot commented Jan 30, 2024

🦋 Changeset detected

Latest commit: 0d6528c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
dynamic-plugins-imports Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

The image is available at: quay.io/janus-idp/backstage-showcase:pr-937!

Copy link

janus-idp bot commented Jan 30, 2024

backstage-showcase Tests on commit 801a904 finished with errors.
View test log

@yuvalgalanti
Copy link

A few questions I have:

  1. why the row height in the rolls list/table is so big can we reduce that?
  2. I think that the administration section should be located above the "settings" area

@parvathyvr
Copy link

Agree with @yuvalgalanti on point 2- as per our design and earlier implementations i have seen- Administration is placed above Settings in the left navigation.

@invincibleJai
Copy link
Member

Agree with @yuvalgalanti on point 2- as per our design and earlier implementations i have seen- Administration is placed above Settings in the left navigation.

for point 2: yeah Administration will be above settings and that would be handled with #932

cc @gashcrumb

for point 1: would recommend log an issue as this PRs scope is to enable plugin into showcase and point can can be handled as at plugins level

cc @divyanshiGupta @debsmita1

@invincibleJai
Copy link
Member

/cc @PatAKnight

@gashcrumb
Copy link
Member

Just confirming that once #932 is available we can rework how the tab is configured for the rbac plugin to move it where it needs to be. If this is merged sooner I can probably do it as part of #941

@ciiay ciiay force-pushed the rhidp-1050-enable-rbac-plugin-on-showcase branch from a682650 to 8a1529a Compare February 1, 2024 14:12
Copy link
Contributor

github-actions bot commented Feb 1, 2024

The image is available at: quay.io/janus-idp/backstage-showcase:pr-937!

Copy link
Member

@gashcrumb gashcrumb left a comment

Choose a reason for hiding this comment

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

I think the version needs to be bumped, otherwise it's looking good! I'll do a bit more testing with a local change just to verify that.

dynamic-plugins/imports/package.json Outdated Show resolved Hide resolved
@ciiay ciiay requested a review from gashcrumb February 1, 2024 20:28
Copy link
Contributor

github-actions bot commented Feb 1, 2024

The image is available at: quay.io/janus-idp/backstage-showcase:pr-937!

Copy link
Member

@gashcrumb gashcrumb left a comment

Choose a reason for hiding this comment

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

have it working locally now too, looks great!

@openshift-ci openshift-ci bot added the lgtm label Feb 2, 2024
@openshift-ci openshift-ci bot removed the lgtm label Feb 2, 2024
Copy link

sonarcloud bot commented Feb 2, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@openshift-ci openshift-ci bot added the lgtm label Feb 2, 2024
Copy link
Contributor

github-actions bot commented Feb 2, 2024

The image is available at: quay.io/janus-idp/backstage-showcase:pr-937!

@debsmita1
Copy link
Member

Was able to test it locally. Thanks @ciiay

Screenshot 2024-02-05 at 3 04 34 PM

/lgtm

@debsmita1
Copy link
Member

/lgtm

@invincibleJai
Copy link
Member

/approve

Copy link

openshift-ci bot commented Feb 5, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: debsmita1, gashcrumb, invincibleJai

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Feb 5, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit 312ac0b into janus-idp:main Feb 5, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants