diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2018-07-10 16:04:27 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-07-11 20:21:23 +0200 |
commit | 83d228436865d8d12abb039e264737ca59c5ed1a (patch) | |
tree | 174dc5ca4d715d79da8e8961b86ac0a256da2e03 /server/sonar-web/src/main/js/apps/organizations | |
parent | 8b864fda418e5d8ba1a9385559ca8340203d680e (diff) | |
download | sonarqube-83d228436865d8d12abb039e264737ca59c5ed1a.tar.gz sonarqube-83d228436865d8d12abb039e264737ca59c5ed1a.zip |
SONAR-11012 Remove front end access checks on QP, QG and members page
Diffstat (limited to 'server/sonar-web/src/main/js/apps/organizations')
7 files changed, 30 insertions, 72 deletions
diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx index 4cef029f3df..53941adef8a 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationAccessContainer.tsx @@ -20,20 +20,13 @@ import * as React from 'react'; import { connect } from 'react-redux'; import { RouterState } from 'react-router'; -import { - getCurrentUser, - getMyOrganizations, - getOrganizationByKey -} from '../../../store/rootReducer'; +import { getCurrentUser, getOrganizationByKey } from '../../../store/rootReducer'; import handleRequiredAuthorization from '../../../app/utils/handleRequiredAuthorization'; import { Organization, CurrentUser, isLoggedIn } from '../../../app/types'; -import { isCurrentUserMemberOf, hasPrivateAccess } from '../../../helpers/organizations'; -import {} from '../../../store/organizations/duck'; interface StateToProps { currentUser: CurrentUser; organization?: Organization; - userOrganizations: Organization[]; } interface OwnProps extends RouterState { @@ -72,36 +65,13 @@ export class OrganizationAccess extends React.PureComponent<Props> { const mapStateToProps = (state: any, ownProps: OwnProps) => ({ currentUser: getCurrentUser(state), - organization: getOrganizationByKey(state, ownProps.params.organizationKey), - userOrganizations: getMyOrganizations(state) + organization: getOrganizationByKey(state, ownProps.params.organizationKey) }); const OrganizationAccessContainer = connect<StateToProps, {}, OwnProps>(mapStateToProps)( OrganizationAccess ); -export function OrganizationPrivateAccess(props: OwnProps) { - return ( - <OrganizationAccessContainer - hasAccess={({ currentUser, organization, userOrganizations }: StateToProps) => - hasPrivateAccess(currentUser, organization, userOrganizations) - } - {...props} - /> - ); -} - -export function OrganizationMembersAccess(props: OwnProps) { - return ( - <OrganizationAccessContainer - hasAccess={({ currentUser, organization, userOrganizations }: StateToProps) => - isCurrentUserMemberOf(currentUser, organization, userOrganizations) - } - {...props} - /> - ); -} - export function hasAdminAccess({ currentUser, organization diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx index ce7ebfdaad9..4625032fcdd 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationDelete.tsx @@ -104,12 +104,12 @@ export class OrganizationDelete extends React.PureComponent<Props, State> { isDestructive={true} modalBody={ <div> - {translate('organization.delete.question')} {hasPaidPlan && ( - <p className="alert alert-warn big-spacer-top"> + <div className="alert alert-warning modal-alert"> {translate('organization.delete.sonarcloud.paid_plan_info')} - </p> + </div> )} + <p>{translate('organization.delete.question')}</p> </div> } modalHeader={translate('organization.delete')} diff --git a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx index 8d135c8fede..44daa37abea 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/OrganizationPage.tsx @@ -90,7 +90,7 @@ export class OrganizationPage extends React.PureComponent<Props, State> { if (this.state.loading) { return null; } else { - return <NotFound />; + return <NotFound withContainer={false} />; } } diff --git a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationAccessContainer-test.tsx b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationAccessContainer-test.tsx index 8fcb64c11f3..17b1fd80bb1 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationAccessContainer-test.tsx +++ b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/OrganizationAccessContainer-test.tsx @@ -55,8 +55,7 @@ describe('component', () => { currentUser={loggedInUser} hasAccess={() => true} location={locationMock} - organization={adminOrganization} - userOrganizations={[]}> + organization={adminOrganization}> <div>hello</div> </OrganizationAccess> ) @@ -70,8 +69,7 @@ describe('component', () => { currentUser={loggedInUser} hasAccess={() => false} location={locationMock} - organization={adminOrganization} - userOrganizations={[]}> + organization={adminOrganization}> <div>hello</div> </OrganizationAccess> ).type() diff --git a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationDelete-test.tsx.snap b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationDelete-test.tsx.snap index 62ab31e51d2..a9184671428 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationDelete-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationDelete-test.tsx.snap @@ -31,11 +31,13 @@ exports[`should show a info message for paying organization 1`] = ` isDestructive={true} modalBody={ <div> - organization.delete.question - <p - className="alert alert-warn big-spacer-top" + <div + className="alert alert-warning modal-alert" > organization.delete.sonarcloud.paid_plan_info + </div> + <p> + organization.delete.question </p> </div> } @@ -77,7 +79,9 @@ exports[`smoke test 1`] = ` isDestructive={true} modalBody={ <div> - organization.delete.question + <p> + organization.delete.question + </p> </div> } modalHeader="organization.delete" diff --git a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationPage-test.tsx.snap b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationPage-test.tsx.snap index c6b612738c1..7c58c886214 100644 --- a/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationPage-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/organizations/components/__tests__/__snapshots__/OrganizationPage-test.tsx.snap @@ -1,6 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`not found 1`] = `<NotFound />`; +exports[`not found 1`] = ` +<NotFound + withContainer={false} +/> +`; exports[`should correctly update when the organization changes 1`] = ` Array [ diff --git a/server/sonar-web/src/main/js/apps/organizations/routes.ts b/server/sonar-web/src/main/js/apps/organizations/routes.ts index 24cd7999dcd..b6fa1ef378e 100644 --- a/server/sonar-web/src/main/js/apps/organizations/routes.ts +++ b/server/sonar-web/src/main/js/apps/organizations/routes.ts @@ -59,35 +59,17 @@ const routes = [ childRoutes: codingRulesRoutes }, { - component: lazyLoad(() => - import('./components/OrganizationAccessContainer').then(lib => ({ - default: lib.OrganizationMembersAccess - })) - ), - childRoutes: [ - { - path: 'members', - component: lazyLoad(() => import('./components/OrganizationMembersContainer')) - } - ] + path: 'members', + component: lazyLoad(() => import('./components/OrganizationMembersContainer')) }, { - component: lazyLoad(() => - import('./components/OrganizationAccessContainer').then(lib => ({ - default: lib.OrganizationPrivateAccess - })) - ), - childRoutes: [ - { - path: 'quality_profiles', - childRoutes: qualityProfilesRoutes - }, - { - path: 'quality_gates', - component: OrganizationContainer, - childRoutes: qualityGatesRoutes - } - ] + path: 'quality_profiles', + childRoutes: qualityProfilesRoutes + }, + { + path: 'quality_gates', + component: OrganizationContainer, + childRoutes: qualityGatesRoutes }, { component: lazyLoad(() => |