forked from HHS/Head-Start-TTADP
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit d1c5786 Merge: 44eeeb8 059425c Author: Ryan Ahearn <[email protected]> Date: Tue Feb 9 17:10:20 2021 -0500 Merge pull request #157 from HHS/user-last-login Allow filtering users by last login and access permissions commit 059425c Author: Ryan Ahearn <[email protected]> Date: Tue Feb 9 15:25:09 2021 -0500 Make eslint happy commit 09e906f Author: Ryan Ahearn <[email protected]> Date: Tue Feb 9 14:46:50 2021 -0500 Refactor user filtering to match access control SOP rules directly commit facfee4 Author: Ryan Ahearn <[email protected]> Date: Tue Feb 9 14:03:29 2021 -0500 Allow filtering by only showing users who do have SITE_ACCESS commit b5b93f0 Author: Ryan Ahearn <[email protected]> Date: Tue Feb 9 13:40:44 2021 -0500 Allow filtering by last login > 60 or 180 days ago Options to match process here: https://github.com/HHS/Head-Start-TTADP/wiki/Access-Control-&-Account-Management-SOP#account-review-frequency-and-process commit 1d08788 Author: Ryan Ahearn <[email protected]> Date: Tue Feb 9 12:18:39 2021 -0500 Display lastLogin on admin user details commit 31883dd Author: Ryan Ahearn <[email protected]> Date: Tue Feb 9 11:12:00 2021 -0500 Add lastLogin to user api response commit 60bbefd Author: Ryan Ahearn <[email protected]> Date: Tue Feb 9 10:20:03 2021 -0500 Add lastLogin value to user model & update on login commit 1a2dd2c Author: Ryan Ahearn <[email protected]> Date: Tue Feb 9 09:36:09 2021 -0500 Prevent validation issues if HSES email updates commit 7554928 Merge: 875f5e2 44eeeb8 Author: Ryan Ahearn <[email protected]> Date: Tue Feb 9 14:15:51 2021 -0500 Merge pull request #286 from adhocteam/main Fix cucumber test on CI commit 875f5e2 Merge: 4bd8566 9f5bb95 Author: Ryan Ahearn <[email protected]> Date: Fri Feb 5 16:31:48 2021 -0500 Merge pull request #284 from adhocteam/main Filter locked users from admin list commit 4bd8566 Merge: 17f9d7f f327246 Author: Ryan Ahearn <[email protected]> Date: Fri Feb 5 16:05:29 2021 -0500 Merge pull request #281 from adhocteam/main Case insensitive admin search, testing updates and manager setting of notes and report status commit 17f9d7f Merge: 16d54e2 8e5d3ef Author: Ryan Ahearn <[email protected]> Date: Wed Feb 3 16:09:21 2021 -0500 Merge pull request #279 from adhocteam/main add frontend for file upload commit 16d54e2 Merge: 541640a e27e7df Author: Ryan Ahearn <[email protected]> Date: Tue Feb 2 15:33:25 2021 -0500 Merge pull request #275 from adhocteam/main Add goal component to frontend commit 541640a Merge: 790ca05 4c3a436 Author: Ryan Ahearn <[email protected]> Date: Fri Jan 29 15:47:13 2021 -0500 Merge pull request #272 from adhocteam/main Save collaborators to report commit 790ca05 Merge: 4948bd3 3cff2f4 Author: Ryan Ahearn <[email protected]> Date: Wed Jan 27 12:04:04 2021 -0500 Merge pull request #267 from adhocteam/main Add file upload api
- Loading branch information
Chuck McAndrew
committed
Feb 10, 2021
1 parent
fb3478a
commit d941b03
Showing
15 changed files
with
203 additions
and
38 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
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
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
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ import userEvent from '@testing-library/user-event'; | |
import { createMemoryHistory } from 'history'; | ||
import fetchMock from 'fetch-mock'; | ||
import join from 'url-join'; | ||
import moment from 'moment'; | ||
|
||
import Admin from '../index'; | ||
import { SCOPE_IDS } from '../../../Constants'; | ||
|
@@ -34,20 +35,39 @@ describe('Admin Page', () => { | |
name: undefined, | ||
homeRegionId: 1, | ||
role: 'Grantee Specialist', | ||
permissions: [], | ||
lastLogin: moment().subtract(65, 'days').toISOString(), | ||
permissions: [{ | ||
userId: 2, | ||
scopeId: SCOPE_IDS.SITE_ACCESS, | ||
regionId: 14, | ||
}], | ||
}, | ||
{ | ||
id: 3, | ||
email: '[email protected]', | ||
name: 'Harry Potter', | ||
homeRegionId: 1, | ||
role: 'Grantee Specialist', | ||
lastLogin: moment().toISOString(), | ||
permissions: [{ | ||
userId: 3, | ||
scopeId: SCOPE_IDS.SITE_ACCESS, | ||
regionId: 14, | ||
}], | ||
}, | ||
{ | ||
id: 4, | ||
email: '[email protected]', | ||
name: 'Hermione Granger', | ||
homeRegionId: 1, | ||
role: 'Early Childhood Specialist', | ||
lastLogin: moment().subtract(190, 'days').toISOString(), | ||
permissions: [{ | ||
userId: 4, | ||
scopeId: SCOPE_IDS.READ_ACTIVITY_REPORTS, | ||
regionId: 1, | ||
}], | ||
}, | ||
]; | ||
|
||
beforeEach(() => { | ||
|
@@ -73,7 +93,7 @@ describe('Admin Page', () => { | |
userEvent.type(filter, '@hogwarts.com'); | ||
const sideNav = screen.getByTestId('sidenav'); | ||
const links = within(sideNav).getAllByRole('link'); | ||
expect(links.length).toBe(2); | ||
expect(links.length).toBe(3); | ||
}); | ||
|
||
it('user filtering is case-insentive', async () => { | ||
|
@@ -85,15 +105,24 @@ describe('Admin Page', () => { | |
expect(links[0]).toHaveTextContent('Harry Potter'); | ||
}); | ||
|
||
it('user list is filterable by SITE_ACCESS permission', async () => { | ||
const checkbox = await screen.findByRole('checkbox', { name: 'Show Only Locked Users' }); | ||
userEvent.click(checkbox); | ||
it('user list is filterable by users to lock', async () => { | ||
const radio = await screen.findByRole('radio', { name: 'Show users to lock' }); | ||
userEvent.click(radio); | ||
const sideNav = screen.getByTestId('sidenav'); | ||
const links = within(sideNav).getAllByRole('link'); | ||
expect(links.length).toBe(1); | ||
expect(links[0]).toHaveTextContent('[email protected]'); | ||
}); | ||
|
||
it('user list is filterable by users to disable', async () => { | ||
const radio = await screen.findByRole('radio', { name: 'Show users to disable' }); | ||
userEvent.click(radio); | ||
const sideNav = screen.getByTestId('sidenav'); | ||
const links = within(sideNav).getAllByRole('link'); | ||
expect(links.length).toBe(1); | ||
expect(links[0]).toHaveTextContent('Hermione Granger'); | ||
}); | ||
|
||
it('allows a user to be selected', async () => { | ||
const button = await screen.findByText('Harry Potter'); | ||
userEvent.click(button); | ||
|
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = { | ||
up: async (queryInterface, Sequelize) => { | ||
await queryInterface.addColumn( | ||
'Users', | ||
'lastLogin', | ||
{ | ||
defaultValue: Sequelize.fn('NOW'), | ||
allowNull: false, | ||
type: Sequelize.DATE, | ||
}, | ||
); | ||
}, | ||
|
||
down: async (queryInterface) => { | ||
await queryInterface.removeColumn('Users', 'lastLogin'); | ||
}, | ||
}; |
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
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 |
---|---|---|
|
@@ -16,6 +16,7 @@ const mockUser = { | |
hsesUserId: '49', | ||
email: '[email protected]', | ||
homeRegionId: 1, | ||
lastLogin: new Date('2021-02-09T15:13:00.000Z'), | ||
permissions: [ | ||
{ | ||
userId: 49, | ||
|
Oops, something went wrong.