Skip to content

Commit

Permalink
Merge branch 'main' into RHIDP-4498
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavolira authored Nov 14, 2024
2 parents fa55420 + a61a0f1 commit f338585
Show file tree
Hide file tree
Showing 23 changed files with 176 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ global:
disabled: true
- package: ./dynamic-plugins/dist/backstage-plugin-catalog-backend-module-msgraph-dynamic
disabled: true
- package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-rbac
- package: ./dynamic-plugins/dist/backstage-community-plugin-rbac
disabled: true
upstream:
backstage:
Expand Down
6 changes: 3 additions & 3 deletions .ibm/pipelines/value_files/values_showcase-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ global:
# Enable tech-radar plugin.
- package: ./dynamic-plugins/dist/backstage-community-plugin-tech-radar
disabled: false
- package: ./dynamic-plugins/dist/backstage-community-plugin-tech-radar-backend-dynamic
disabled: true
- package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-rbac
- package: ./dynamic-plugins/dist/backstage-community-plugin-tech-radar-backend-dynamic
disabled: true
- package: ./dynamic-plugins/dist/backstage-community-plugin-rbac
disabled: false
- package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-analytics-provider-segment
disabled: true
Expand Down
2 changes: 1 addition & 1 deletion .rhdh/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-scaffo
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-scaffolder-backend-module-quay-dynamic/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-scaffolder-backend-module-quay-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-scaffolder-backend-module-quay-dynamic/dist-dynamic/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-scaffolder-backend-module-quay-dynamic/dist-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-plugin-tekton/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-plugin-tekton/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-plugin-rbac/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-plugin-rbac/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-plugin-quay/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-plugin-quay/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-plugin-analytics-provider-segment/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-plugin-analytics-provider-segment/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-plugin-aap-backend-dynamic/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-plugin-aap-backend-dynamic/package.json
Expand Down Expand Up @@ -143,6 +142,7 @@ COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-scaffolder-backend-module-servicenow-dynamic/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-scaffolder-backend-module-servicenow-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-scaffolder-backend-module-servicenow-dynamic/dist-dynamic/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-scaffolder-backend-module-servicenow-dynamic/dist-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-redhat-argocd/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-redhat-argocd/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-rbac/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-rbac/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-ocm/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-ocm/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-ocm-backend-dynamic/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-ocm-backend-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-ocm-backend-dynamic/dist-dynamic/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-ocm-backend-dynamic/dist-dynamic/package.json
Expand Down
2 changes: 1 addition & 1 deletion app-config.dynamic-plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ dynamicPlugins:
janus-idp.backstage-plugin-analytics-provider-segment:
apiFactories:
- importName: SegmentAnalyticsApi
janus-idp.backstage-plugin-rbac:
backstage-community.plugin-rbac:
appIcons:
- name: rbacIcon
importName: RbacIcon
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-scaffo
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-scaffolder-backend-module-quay-dynamic/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-scaffolder-backend-module-quay-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-scaffolder-backend-module-quay-dynamic/dist-dynamic/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-scaffolder-backend-module-quay-dynamic/dist-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-plugin-tekton/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-plugin-tekton/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-plugin-rbac/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-plugin-rbac/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-plugin-quay/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-plugin-quay/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-plugin-analytics-provider-segment/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-plugin-analytics-provider-segment/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/janus-idp-backstage-plugin-aap-backend-dynamic/package.json ./dynamic-plugins/wrappers/janus-idp-backstage-plugin-aap-backend-dynamic/package.json
Expand Down Expand Up @@ -144,6 +143,7 @@ COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-scaffolder-backend-module-servicenow-dynamic/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-scaffolder-backend-module-servicenow-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-scaffolder-backend-module-servicenow-dynamic/dist-dynamic/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-scaffolder-backend-module-servicenow-dynamic/dist-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-redhat-argocd/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-redhat-argocd/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-rbac/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-rbac/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-ocm/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-ocm/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-ocm-backend-dynamic/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-ocm-backend-dynamic/package.json
COPY $EXTERNAL_SOURCE_NESTED/dynamic-plugins/wrappers/backstage-community-plugin-ocm-backend-dynamic/dist-dynamic/package.json ./dynamic-plugins/wrappers/backstage-community-plugin-ocm-backend-dynamic/dist-dynamic/package.json
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ The easiest and fastest method for getting started: Backstage Showcase app, runn

- Setup the RBAC plugin

- This [URL](https://github.com/janus-idp/backstage-plugins/tree/main/plugins/rbac-backend) explains how to use the RBAC Backend Plugin.
- This [URL](https://github.com/backstage/community-plugins/tree/main/workspaces/rbac/plugins/rbac-backend) explains how to use the RBAC Backend Plugin.

- Requires the use of an identity provider. This plugin will not work with guest accounts.

Expand Down
4 changes: 2 additions & 2 deletions dynamic-plugins.default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -584,12 +584,12 @@ plugins:
- package: ./dynamic-plugins/dist/janus-idp-backstage-scaffolder-backend-module-regex-dynamic
disabled: false

- package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-rbac
- package: ./dynamic-plugins/dist/backstage-community-plugin-rbac
disabled: true
pluginConfig:
dynamicPlugins:
frontend:
janus-idp.backstage-plugin-rbac:
backstage-community.plugin-rbac:
appIcons:
- name: rbacIcon
importName: RbacIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"tasks": {
"tsc": {
"outputs": [
"../../../dynamic-plugins/wrappers/backstage-community-plugin-ocm/**"
"../../../dist-types/dynamic-plugins/wrappers/backstage-community-plugin-ocm/**"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "janus-idp-backstage-plugin-rbac",
"version": "1.32.0",
"name": "backstage-community-plugin-rbac",
"version": "1.32.3",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
Expand All @@ -11,10 +11,10 @@
},
"backstage": {
"role": "frontend-plugin",
"supported-versions": "1.32.4",
"supported-versions": "1.32.5",
"pluginId": "rbac",
"pluginPackages": [
"janus-idp-backstage-plugin-rbac"
"backstage-community-plugin-rbac"
]
},
"sideEffects": false,
Expand All @@ -28,26 +28,27 @@
"export-dynamic:clean": "janus-cli package export-dynamic-plugin --in-place --clean"
},
"dependencies": {
"@janus-idp/backstage-plugin-rbac": "1.32.0"
"@backstage-community/plugin-rbac": "1.32.3"
},
"devDependencies": {
"@backstage/cli": "0.28.2",
"@janus-idp/cli": "1.17.0"
"@janus-idp/cli": "1.17.0",
"typescript": "^5.6.3"
},
"files": [
"dist",
"dist-scalprum"
],
"scalprum": {
"name": "janus-idp.backstage-plugin-rbac",
"name": "backstage-community.plugin-rbac",
"exposedModules": {
"PluginRoot": "./src/index.ts"
}
},
"repository": {
"type": "git",
"url": "https://github.com/janus-idp/backstage-showcase",
"directory": "dynamic-plugins/wrappers/janus-idp-backstage-plugin-rbac"
"directory": "dynamic-plugins/wrappers/backstage-community-plugin-rbac"
},
"maintainers": [
"@janus-idp/maintainers-showcase"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from '@backstage-community/plugin-rbac';
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"include": ["src", "dev", "migrations"],
"exclude": ["node_modules"],
"compilerOptions": {
"outDir": "../../../dist-types/dynamic-plugins/wrappers/janus-idp-backstage-plugin-rbac",
"outDir": "../../../dist-types/dynamic-plugins/wrappers/backstage-community-plugin-rbac",
"rootDir": "."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["//"],
"tasks": {
"tsc": {
"outputs": [
"../../../dist-types/dynamic-plugins/wrappers/backstage-community-plugin-rbac/**"
]
}
}
}

This file was deleted.

This file was deleted.

32 changes: 26 additions & 6 deletions e2e-tests/playwright/utils/Common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { test, Browser, expect, Page, TestInfo } from "@playwright/test";
import { SettingsPagePO } from "../support/pageObjects/page-obj";
import { waitsObjs } from "../support/pageObjects/global-obj";
import path from "path";
import fs from "fs";

export class Common {
page: Page;
uiHelper: UIhelper;
private readonly authStateFileName = "authState.json";

constructor(page: Page) {
this.page = page;
Expand Down Expand Up @@ -80,12 +82,30 @@ export class Common {
}

async loginAsGithubUser(userid: string = process.env.GH_USER_ID) {
await this.logintoGithub(userid);
await this.page.goto("/");
await this.waitForLoad(240000);
await this.uiHelper.clickButton("Sign In");
await this.checkAndReauthorizeGithubApp();
await this.uiHelper.waitForSideBarVisible();
const sessionFileName = `authState_${userid}.json`;

// Check if a session file for this specific user already exists
if (fs.existsSync(sessionFileName)) {
// Load and reuse existing authentication state
const cookies = JSON.parse(
fs.readFileSync(sessionFileName, "utf-8"),
).cookies;
await this.page.context().addCookies(cookies);
console.log(`Reusing existing authentication state for user: ${userid}`);
await this.page.goto("/");
await this.waitForLoad(12000);
await this.uiHelper.clickButton("Sign In");
} else {
// Perform login if no session file exists, then save the state
await this.logintoGithub(userid);
await this.page.goto("/");
await this.waitForLoad(240000);
await this.uiHelper.clickButton("Sign In");
await this.checkAndReauthorizeGithubApp();
await this.uiHelper.waitForSideBarVisible();
await this.page.context().storageState({ path: sessionFileName });
console.log(`Authentication state saved for user: ${userid}`);
}
}

async checkAndReauthorizeGithubApp() {
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"prettier:fix": "prettier --ignore-unknown --write ."
},
"dependencies": {
"@backstage-community/plugin-rbac-backend": "5.2.4",
"@backstage-community/plugin-rbac-node": "1.8.2",
"@backstage/backend-app-api": "1.0.1",
"@backstage/backend-defaults": "0.5.2",
"@backstage/backend-dynamic-feature-service": "0.4.3",
Expand Down Expand Up @@ -46,8 +48,6 @@
"@internal/plugin-licensed-users-info-backend": "*",
"@internal/plugin-scalprum-backend": "*",
"@janus-idp/backstage-plugin-audit-log-node": "1.7.0",
"@janus-idp/backstage-plugin-rbac-backend": "5.2.1",
"@janus-idp/backstage-plugin-rbac-node": "1.8.0",
"@janus-idp/backstage-scaffolder-backend-module-annotator": "2.2.0",
"app": "*",
"express-prom-bundle": "6.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ backend.add(import('@backstage/plugin-search-backend-module-catalog'));
// TODO: We should test it more deeply. The structure is not exactly the same as the old backend implementation
backend.add(import('@backstage/plugin-events-backend'));

backend.add(import('@janus-idp/backstage-plugin-rbac-backend'));
backend.add(import('@backstage-community/plugin-rbac-backend'));
backend.add(import('@janus-idp/backstage-scaffolder-backend-module-annotator'));
backend.add(pluginIDProviderService);
backend.add(rbacDynamicPluginsProvider);
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/modules/rbacDynamicPluginsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
createServiceRef,
} from '@backstage/backend-plugin-api';

import { PluginIdProvider } from '@janus-idp/backstage-plugin-rbac-backend';
import { pluginIdProviderExtensionPoint } from '@janus-idp/backstage-plugin-rbac-node';
import { PluginIdProvider } from '@backstage-community/plugin-rbac-backend';
import { pluginIdProviderExtensionPoint } from '@backstage-community/plugin-rbac-node';

const pluginIDProviderServiceRef = createServiceRef<PluginIdProvider>({
id: 'pluginIDProvider',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export const InternalPluginsMap: Record<string, string> = {
'./dynamic-plugins/dist/janus-idp-backstage-scaffolder-backend-module-quay-dynamic',
'janus-idp-backstage-scaffolder-backend-module-regex-dynamic':
'./dynamic-plugins/dist/janus-idp-backstage-scaffolder-backend-module-regex-dynamic',
'janus-idp-backstage-plugin-rbac':
'./dynamic-plugins/dist/janus-idp-backstage-plugin-rbac',
'backstage-community-plugin-rbac':
'./dynamic-plugins/dist/backstage-community-plugin-rbac',
'backstage-community-plugin-scaffolder-backend-module-servicenow-dynamic':
'./dynamic-plugins/dist/backstage-community-plugin-scaffolder-backend-module-servicenow-dynamic',
'backstage-community-scaffolder-backend-module-sonarqube-dynamic':
Expand Down
2 changes: 1 addition & 1 deletion plugins/licensed-users-info-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"prettier:fix": "prettier --ignore-unknown --write ."
},
"dependencies": {
"@backstage-community/plugin-rbac-common": "1.12.2",
"@backstage/backend-defaults": "0.5.2",
"@backstage/backend-plugin-api": "1.0.1",
"@backstage/catalog-client": "1.7.1",
Expand All @@ -40,7 +41,6 @@
"@backstage/plugin-auth-backend": "0.23.1",
"@backstage/plugin-permission-common": "0.8.1",
"@backstage/types": "1.1.1",
"@janus-idp/backstage-plugin-rbac-common": "1.12.0",
"express": "4.21.0",
"express-promise-router": "4.1.1",
"json-2-csv": "5.5.5",
Expand Down
3 changes: 1 addition & 2 deletions plugins/licensed-users-info-backend/src/service/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ import { CatalogClient } from '@backstage/catalog-client';
import { NotAllowedError } from '@backstage/errors';
import { AuthorizeResult } from '@backstage/plugin-permission-common';

import { policyEntityReadPermission } from '@backstage-community/plugin-rbac-common';
import express from 'express';
import Router from 'express-promise-router';
import { json2csv } from 'json-2-csv';
import { DateTime } from 'luxon';

import { policyEntityReadPermission } from '@janus-idp/backstage-plugin-rbac-common';

import {
DatabaseUserInfoStore,
UserInfoRow,
Expand Down
4 changes: 2 additions & 2 deletions scripts/rhdh-openshift-setup/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ global:
props:
width: 1500
height: 800
- package: ./dynamic-plugins/dist/janus-idp-backstage-plugin-rbac
- package: ./dynamic-plugins/dist/backstage-community-plugin-rbac
disabled: false
pluginConfig:
dynamicPlugins:
frontend:
janus-idp.backstage-plugin-rbac:
backstage-community.plugin-rbac:
mountPoints:
- mountPoint: admin.page.rbac/cards
importName: RbacPage
Expand Down
Loading

0 comments on commit f338585

Please sign in to comment.