-
-
Notifications
You must be signed in to change notification settings - Fork 722
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix site setup access check by using @actions endpoint to validate pe…
…rmissions.
- Loading branch information
Showing
5 changed files
with
226 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix site setup access check by using @actions endpoint to validate permissions. @Faakhir30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,14 @@ describe('Toolbar Personal Tools component', () => { | |
theToolbar={{ | ||
current: { getBoundingClientRect: () => ({ width: '320' }) }, | ||
}} | ||
actions={{ | ||
user: [ | ||
{ | ||
id: 'plone_setup', | ||
title: 'Site Setup', | ||
}, | ||
], | ||
}} | ||
/> | ||
</MemoryRouter> | ||
</PluggablesProvider> | ||
|
@@ -84,6 +92,14 @@ describe('Toolbar Personal Tools component', () => { | |
theToolbar={{ | ||
current: { getBoundingClientRect: () => ({ width: '320' }) }, | ||
}} | ||
actions={{ | ||
user: [ | ||
{ | ||
id: 'plone_setup', | ||
title: 'Site Setup', | ||
}, | ||
], | ||
}} | ||
/> | ||
</MemoryRouter> | ||
</PluggablesProvider> | ||
|
@@ -126,6 +142,58 @@ describe('Toolbar Personal Tools component', () => { | |
theToolbar={{ | ||
current: { getBoundingClientRect: () => ({ width: '320' }) }, | ||
}} | ||
actions={{ | ||
user: [ | ||
{ | ||
id: 'plone_setup', | ||
title: 'Site Setup', | ||
}, | ||
], | ||
}} | ||
/> | ||
</MemoryRouter> | ||
</PluggablesProvider> | ||
</Provider>, | ||
); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders an Toolbar Personal Tools component without Site Setup access', () => { | ||
const store = mockStore({ | ||
users: { | ||
user: { | ||
fullname: 'regular_user', | ||
email: '[email protected]', | ||
roles: ['Member'], | ||
}, | ||
}, | ||
userSession: { | ||
token: jwt.sign({ sub: 'regular_user' }, 'secret'), | ||
}, | ||
content: { | ||
data: { | ||
'@type': 'Folder', | ||
is_folderish: true, | ||
}, | ||
}, | ||
intl: { | ||
locale: 'en', | ||
messages: {}, | ||
}, | ||
}); | ||
const component = renderer.create( | ||
<Provider store={store}> | ||
<PluggablesProvider> | ||
<MemoryRouter> | ||
<PersonalTools | ||
loadComponent={() => {}} | ||
theToolbar={{ | ||
current: { getBoundingClientRect: () => ({ width: '320' }) }, | ||
}} | ||
actions={{ | ||
user: [], | ||
}} | ||
/> | ||
</MemoryRouter> | ||
</PluggablesProvider> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters