-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from DaleMcGrew/Dale_WCC_Feb18-2025
First pass on viewerCanSeeOrDo & viewerAccessRights implementation. Added finer-grained viewerCanSeeOrDo switch to PersonSummaryRow & TeamHeader, so we turn off interface elements the person cannot access. Tested signin/signout, and confirmed that is still working. Registration requires manual browser refresh for signed in access rights to be recognized. Replaced loggedInPersonIsAdmin with viewerCanSeeOrDo & viewerAccessRights implementation. Control which PersonProfile we want to show with incoming prop. Working on bringing QuestionnaireResponsesList back to life. Implemented models/PersonModel - capturePersonRetrieveData. We may decide not to use person-retrieve in the future but I'd like to leave in place.
- Loading branch information
Showing
19 changed files
with
211 additions
and
140 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
11 changes: 7 additions & 4 deletions
11
src/js/components/Person/PersonProfileDrawerMainContent.jsx
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
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// AuthModel.js | ||
// Functions related to getting data from the apiDataCache, which stores data | ||
// received from our API servers. | ||
import isEqual from 'lodash-es/isEqual'; | ||
|
||
|
||
export const viewerCanSeeOrDo = (accessRightName, viewerAccessRights) => { | ||
if (!viewerAccessRights || !(accessRightName in viewerAccessRights)) { | ||
return false; | ||
} | ||
return viewerAccessRights[accessRightName] || false; | ||
}; | ||
|
||
export function captureAccessRightsData (data = {}, isSuccess = false, apiDataCache = {}, dispatch) { | ||
const viewerAccessRights = apiDataCache.viewerAccessRights || {}; | ||
let changeResults = { | ||
viewerAccessRights, | ||
viewerAccessRightsChanged: false, | ||
}; | ||
let viewerAccessRightsNew = { ...viewerAccessRights }; | ||
// console.log('captureAccessRightsData data:', data); | ||
if (data && data.accessRights && isSuccess === true) { | ||
let newDataReceived = false; | ||
const { accessRights } = data; | ||
if (accessRights && !('canAddPerson' in accessRights)) { | ||
viewerAccessRightsNew = accessRights; | ||
newDataReceived = true; | ||
} else if (!isEqual(accessRights, viewerAccessRightsNew)) { | ||
viewerAccessRightsNew = accessRights; | ||
newDataReceived = true; | ||
} | ||
if (newDataReceived) { | ||
// console.log('=== captureAccessRightsData viewerAccessRightsNew:', viewerAccessRightsNew, ', newDataReceived:', newDataReceived); | ||
dispatch({ type: 'updateByKeyValue', key: 'viewerAccessRights', value: viewerAccessRightsNew }); | ||
changeResults = { | ||
viewerAccessRights: viewerAccessRightsNew, | ||
viewerAccessRightsChanged: true, | ||
}; | ||
} | ||
} | ||
return changeResults; | ||
} |
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
Oops, something went wrong.