Skip to content

Commit

Permalink
#1036 | Show DateEntryApp HomePageCard only if user has ViewEditEntit…
Browse files Browse the repository at this point in the history
…iesOnDataEntryApp privilege
  • Loading branch information
himeshr committed Oct 19, 2023
1 parent 687b1a6 commit 287a6b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"material-table": "1.43.0",
"moment": "^2.22.2",
"openchs-idi": "git+https://github.com/avniproject/openchs-idi#b6c57e051b91ed4bc2634f4f087dba51cc3a01c8",
"openchs-models": "1.30.69",
"openchs-models": "1.30.77",
"popper.js": "^1.14.3",
"prismjs": "^1.17.1",
"prop-types": "^15.7.2",
Expand Down
16 changes: 11 additions & 5 deletions src/rootApp/views/Homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ const Homepage = ({ userInfo }) => {
httpClient.saveAuthTokenForAnalyticsApp();

const showAnalytics = UserInfo.hasPrivilege(userInfo, Privilege.PrivilegeType.Analytics);
const showDataEntryApp = UserInfo.hasPrivilege(
userInfo,
Privilege.PrivilegeType.ViewEditEntitiesOnDataEntryApp
);

return (
<ScreenWithAppBar appbarTitle={"Avni Web Console"}>
Expand Down Expand Up @@ -63,11 +67,13 @@ const Homepage = ({ userInfo }) => {
name={"Reports"}
customIconComponent={<Assessment color="primary" style={{ fontSize: 100 }} />}
/>
<HomePageCard
href={"/#/app"}
name={"Data Entry App"}
customIconComponent={<Keyboard color="primary" style={{ fontSize: 100 }} />}
/>
{showDataEntryApp && (
<HomePageCard
href={"/#/app"}

This comment has been minimized.

Copy link
@ashusvnath

ashusvnath Oct 19, 2023

what will happen if user directly opens /#/app on the webapp ?

name={"Data Entry App"}
customIconComponent={<Keyboard color="primary" style={{ fontSize: 100 }} />}
/>
)}
{showAnalytics && (
<HomePageCard
href={
Expand Down

0 comments on commit 287a6b3

Please sign in to comment.