Skip to content

Commit

Permalink
Merge branch 'nav-change' of github.com:derek-ho/security-dashboards-…
Browse files Browse the repository at this point in the history
…plugin into nav-change
  • Loading branch information
derek-ho committed Jul 18, 2024
2 parents c813452 + d45a296 commit ceb0f43
Show file tree
Hide file tree
Showing 23 changed files with 427 additions and 816 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/cypress-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:
SPEC: 'cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js,'
PLUGIN_NAME: opensearch-security
OPENSEARCH_INITIAL_ADMIN_PASSWORD: myStrongPassword123!
CYPRESS_NO_COMMAND_LOG: 1

jobs:
cypress-tests:
Expand Down Expand Up @@ -84,3 +85,15 @@ jobs:
yarn cypress:run-with-security-and-aggregation-view --browser chrome --spec "cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js"
yarn cypress:run-with-security --browser chrome --spec "cypress/integration/plugins/security-dashboards-plugin/multi_tenancy.js"
yarn cypress:run-with-security --browser chrome --spec "cypress/integration/plugins/security-dashboards-plugin/default_tenant.js"
- name: Configure and Run OpenSearch Dashboards with Cypress Test Cases Release Tests
run: |
cd ./OpenSearch-Dashboards
cd opensearch-dashboards-functional-test
yarn cypress:run-with-security --browser chrome --spec "cypress/integration/plugins/security/audit_log_spec.js"
yarn cypress:run-with-security --browser chrome --spec "cypress/integration/plugins/security/auth_spec.js"
yarn cypress:run-with-security --browser chrome --spec "cypress/integration/plugins/security/get_started_spec.js"
yarn cypress:run-with-security --browser chrome --spec "cypress/integration/plugins/security/internalusers_spec.js"
yarn cypress:run-with-security --browser chrome --spec "cypress/integration/plugins/security/permissions_spec.js"
yarn cypress:run-with-security --browser chrome --spec "cypress/integration/plugins/security/roles_spec.js"
yarn cypress:run-with-security --browser chrome --spec "cypress/integration/plugins/security/tenants_spec.js"
8 changes: 5 additions & 3 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ Next, go to the base directory (`cd ../..`) and run `yarn osd bootstrap` to inst
From the base directory, run `yarn start`. This should start dashboard UI successfully. `Cmd+click` the url in the console output (It should look something like `http://0:5601/omf`). Once the page loads, you should be able to log in with user `admin` and password `admin`.
## Integration Tests
## Testing
To run selenium based integration tests, download and export the firefox web-driver to your PATH. Also, run `node scripts/build_opensearch_dashboards_platform_plugins.js` or `yarn start` before running the tests. This is essential to generate the bundles.
The security-dashboards-plugin project uses Jest for unit and integration tests and Cypress for end to end tests. To run frontend unit tests run `yarn test:jest_ui`. To run Cypress tests that live in this repo either use `yarn cypress:run` or `yarn cypress:open`. To run the Cypress tests that live in the [OpenSearch Dashboards Functional Test]( https://github.com/opensearch-project/opensearch-dashboards-functional-test) project first make sure you have OpenSearch and OpenSearch Dashboards running with the Security Plugin and that you can log in to it using a web browser. Then clone [OpenSearch Dashboards Functional Test]( https://github.com/opensearch-project/opensearch-dashboards-functional-test) in your local machine and follow the instructions in its DEVELOPER_GUIDE.md
The integration tests take advantage of [npm "pre" scripts](https://docs.npmjs.com/cli/v9/using-npm/scripts) to run a node based SAML IdP for integration tests related to SAML authentication. This will run a background process that listens on port 7000.
### Integration Tests
The integration tests take advantage of [npm "pre" scripts](https://docs.npmjs.com/cli/v9/using-npm/scripts) to run a node based SAML IdP for integration tests related to SAML authentication. This will run a background process that listens on port 7000. Then run `yarn test:jest_server`.
## Submitting Changes
Expand Down
1 change: 0 additions & 1 deletion common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export enum AuthType {
export enum ResourceType {
roles = 'roles',
users = 'users',
serviceAccounts = 'serviceAccounts',
permissions = 'permissions',
tenants = 'tenants',
tenantsManageTab = 'tenantsManageTab',
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@
"@hapi/cryptiles": "5.0.0",
"@hapi/wreck": "^17.1.0",
"html-entities": "1.3.1",
"proxy-agent": "^6.4.0",
"zxcvbn": "^4.4.2"
},
"resolutions": {
"selenium-webdriver": "4.10.0",
"glob-parent": "^5.1.2",
"debug": "^4.3.4",
"ejs": "^3.1.10",
"express": "^4.19.2"
"express": "^4.19.2",
"braces": "^3.0.3"
}
}
}
17 changes: 1 addition & 16 deletions public/apps/configuration/app-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ import { RoleEditMappedUser } from './panels/role-mapping/role-edit-mapped-user'
import { RoleView } from './panels/role-view/role-view';
import { TenantList } from './panels/tenant-list/tenant-list';
import { UserList } from './panels/user-list';
import { ServiceAccountList } from './panels/service-account-list';
import { Action, RouteItem, SubAction } from './types';
import { ResourceType } from '../../../common';
import { buildHashUrl, buildUrl } from './utils/url-builder';
import { CrossPageToast } from './cross-page-toast';
import { getDataSourceFromUrl } from '../../utils/datasource-utils';
import { getDataSourceFromUrl, LocalCluster } from '../../utils/datasource-utils';

const LANDING_PAGE_URL = '/getstarted';

Expand All @@ -58,10 +57,6 @@ export const ROUTE_MAP: { [key: string]: RouteItem } = {
name: 'Internal users',
href: buildUrl(ResourceType.users),
},
[ResourceType.serviceAccounts]: {
name: 'Service Accounts',
href: buildUrl(ResourceType.serviceAccounts),
},
[ResourceType.permissions]: {
name: 'Permissions',
href: buildUrl(ResourceType.permissions),
Expand Down Expand Up @@ -90,7 +85,6 @@ const getRouteList = (multitenancyEnabled: boolean) => {
ROUTE_MAP[ResourceType.auth],
ROUTE_MAP[ResourceType.roles],
ROUTE_MAP[ResourceType.users],
ROUTE_MAP[ResourceType.serviceAccounts],
ROUTE_MAP[ResourceType.permissions],
...(multitenancyEnabled ? [ROUTE_MAP[ResourceType.tenants]] : []),
ROUTE_MAP[ResourceType.auditLogging],
Expand Down Expand Up @@ -151,8 +145,6 @@ export interface DataSourceContextType {
setDataSource: React.Dispatch<React.SetStateAction<DataSourceOption>>;
}

export const LocalCluster = { label: 'Local cluster', id: '' };

export const DataSourceContext = createContext<DataSourceContextType | null>(null);

export function AppRouter(props: AppDependencies) {
Expand Down Expand Up @@ -235,13 +227,6 @@ export function AppRouter(props: AppDependencies) {
return <UserList {...props} />;
}}
/>
<Route
path={ROUTE_MAP.serviceAccounts.href}
render={() => {
setGlobalBreadcrumbs(ResourceType.serviceAccounts);
return <ServiceAccountList {...props} />;
}}
/>
<Route
path={buildUrl(ResourceType.auditLogging) + SUB_URL_FOR_GENERAL_SETTINGS_EDIT}
render={() => {
Expand Down
2 changes: 0 additions & 2 deletions public/apps/configuration/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ export const API_ENDPOINT_MULTITENANCY = API_PREFIX + '/multitenancy/tenant';
export const API_ENDPOINT_TENANCY_CONFIGS = API_ENDPOINT + '/tenancy/config';
export const API_ENDPOINT_SECURITYCONFIG = API_ENDPOINT + '/securityconfig';
export const API_ENDPOINT_INTERNALUSERS = API_ENDPOINT + '/internalusers';
export const API_ENDPOINT_INTERNALACCOUNTS = API_ENDPOINT + '/internalaccounts';
export const API_ENDPOINT_SERVICEACCOUNTS = API_ENDPOINT + '/serviceaccounts';
export const API_ENDPOINT_AUDITLOGGING = API_ENDPOINT + '/audit';
export const API_ENDPOINT_AUDITLOGGING_UPDATE = API_ENDPOINT_AUDITLOGGING + '/config';
export const API_ENDPOINT_PERMISSIONS_INFO = API_PREFIX + '/restapiinfo';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ export function RoleEditMappedUser(props: RoleEditMappedUserProps) {
React.useEffect(() => {
const fetchInternalUserNames = async () => {
try {
setUserNames(
await fetchUserNameList(props.coreStart.http, ResourceType.users, dataSource.id)
);
setUserNames(await fetchUserNameList(props.coreStart.http, dataSource.id));
} catch (e) {
addToast(createUnknownErrorToast('fetchInternalUserNames', 'load data'));
console.error(e);
Expand Down
248 changes: 0 additions & 248 deletions public/apps/configuration/panels/service-account-list.tsx

This file was deleted.

Loading

0 comments on commit ceb0f43

Please sign in to comment.