fix(dashboard): don't show report modal for anonymous user (#17106)
* Added sunburst echart * fix(dashboard):Hide reports modal for anonymous users * Address comments * Make prettier happy Co-authored-by: Mayur <mayurp@kpmg.com>
This commit is contained in:
parent
45480f7ae5
commit
8756c9089e
|
|
@ -465,4 +465,31 @@ describe('Email Report Modal', () => {
|
|||
// BLOCKER: I cannot get report to populate, as its data is handled through redux
|
||||
expect.anything();
|
||||
});
|
||||
|
||||
it('Should render report header', async () => {
|
||||
const mockedProps = createProps();
|
||||
render(setup(mockedProps));
|
||||
expect(
|
||||
screen.getByRole('button', { name: 'Schedule email report' }),
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('Should not render report header even with menu access for anonymous user', async () => {
|
||||
const mockedProps = createProps();
|
||||
const anonymousUserProps = {
|
||||
...mockedProps,
|
||||
user: {
|
||||
roles: {
|
||||
Public: [['menu_access', 'Manage']],
|
||||
},
|
||||
permissions: {
|
||||
datasource_access: ['[examples].[birth_names](id:2)'],
|
||||
},
|
||||
},
|
||||
};
|
||||
render(setup(anonymousUserProps));
|
||||
expect(
|
||||
screen.queryByRole('button', { name: 'Schedule email report' }),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -435,7 +435,7 @@ class Header extends React.PureComponent {
|
|||
return false;
|
||||
}
|
||||
const { user } = this.props;
|
||||
if (!user) {
|
||||
if (!user?.userId) {
|
||||
// this is in the case that there is an anonymous user.
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ export class ExploreChartHeader extends React.PureComponent {
|
|||
return false;
|
||||
}
|
||||
const { user } = this.props;
|
||||
if (!user) {
|
||||
if (!user?.userId) {
|
||||
// this is in the case that there is an anonymous user.
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue