diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/feature/FeatureType.java b/sormas-api/src/main/java/de/symeda/sormas/api/feature/FeatureType.java index a5e9675189b..f54a6b4e65f 100644 --- a/sormas-api/src/main/java/de/symeda/sormas/api/feature/FeatureType.java +++ b/sormas-api/src/main/java/de/symeda/sormas/api/feature/FeatureType.java @@ -332,7 +332,7 @@ public enum FeatureType { CONTACT_TRACING }, null, ImmutableMap.of(FeatureTypeProperty.S2S_SHARING, Boolean.FALSE)), - DISEASE_DETAILS(false, true, null, null, null); + DISEASE_DETAILS(true, false, null, null, null); public static final FeatureType[] SURVEILLANCE_FEATURE_TYPES = { FeatureType.CASE_SURVEILANCE, diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/user/DefaultUserRole.java b/sormas-api/src/main/java/de/symeda/sormas/api/user/DefaultUserRole.java index b91d28b515b..afc901005c1 100644 --- a/sormas-api/src/main/java/de/symeda/sormas/api/user/DefaultUserRole.java +++ b/sormas-api/src/main/java/de/symeda/sormas/api/user/DefaultUserRole.java @@ -311,6 +311,7 @@ public Set getDefaultUserRights() { ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_ARCHIVE, ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_DELETE, ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_EXPORT, + DISEASE_DETAILS_VIEW, PERSON_VIEW, PERSON_EDIT, PERSON_DELETE, @@ -1329,6 +1330,7 @@ public Set getDefaultUserRights() { ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_ARCHIVE, ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_DELETE, ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_EXPORT, + DISEASE_DETAILS_VIEW, PERSON_VIEW, PERSON_EDIT, PERSON_DELETE, diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/user/UserRight.java b/sormas-api/src/main/java/de/symeda/sormas/api/user/UserRight.java index 806a73d1cb6..25d16a9eb20 100644 --- a/sormas-api/src/main/java/de/symeda/sormas/api/user/UserRight.java +++ b/sormas-api/src/main/java/de/symeda/sormas/api/user/UserRight.java @@ -70,6 +70,8 @@ public enum UserRight { ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_DELETE(UserRightGroup.ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION), ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_EXPORT(UserRightGroup.ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION), + DISEASE_DETAILS_VIEW(UserRightGroup.DISEASE_DETAILS_VIEW), + PERSON_VIEW(UserRightGroup.PERSON), PERSON_EDIT(UserRightGroup.PERSON, UserRight._PERSON_VIEW), PERSON_DELETE(UserRightGroup.PERSON, UserRight._PERSON_VIEW, UserRight._VISIT_DELETE), @@ -531,6 +533,7 @@ public enum UserRight { public static final String _EXTERNAL_EMAIL_SEND = "EXTERNAL_EMAIL_SEND"; public static final String _EXTERNAL_EMAIL_ATTACH_DOCUMENTS = "EXTERNAL_EMAIL_ATTACH_DOCUMENTS"; public static final String _CUSTOMIZABLE_ENUM_MANAGEMENT = "CUSTOMIZABLE_ENUM_MANAGEMENT"; + public static final String _DISEASE_DETAILS_VIEW ="DISEASE_DETAILS_VIEW" ; private static final Map> userRightDependencies = buildUserRightDependencies(); diff --git a/sormas-api/src/main/java/de/symeda/sormas/api/user/UserRightGroup.java b/sormas-api/src/main/java/de/symeda/sormas/api/user/UserRightGroup.java index 7fa2dd34069..ada0bee03be 100644 --- a/sormas-api/src/main/java/de/symeda/sormas/api/user/UserRightGroup.java +++ b/sormas-api/src/main/java/de/symeda/sormas/api/user/UserRightGroup.java @@ -48,7 +48,8 @@ public enum UserRightGroup { EXPORT, CONFIGURATION, - EXTERNAL; + EXTERNAL, + DISEASE_DETAILS_VIEW; @Override public String toString() { diff --git a/sormas-api/src/main/resources/enum.properties b/sormas-api/src/main/resources/enum.properties index 8d66487befb..26ac488e736 100644 --- a/sormas-api/src/main/resources/enum.properties +++ b/sormas-api/src/main/resources/enum.properties @@ -1565,6 +1565,7 @@ UserRight.ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_EDIT = Edit existing adverse eve UserRight.ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_DELETE = Delete adverse events following immunization from the system UserRight.ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_ARCHIVE = Archive adverse events following immunization UserRight.ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_EXPORT = Export adverse events following immunization +UserRight.DISEASE_DETAILS_VIEW = View details of selected disease UserRight.PERSON_EXPORT = Export persons UserRight.CONTACT_MERGE = Merge contacts UserRight.EVENTGROUP_CREATE = Create new event groups @@ -1790,6 +1791,7 @@ UserRight.Desc.ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_EDIT = Able to edit existin UserRight.Desc.ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_DELETE = Able to delete adverse events following immunization from the system UserRight.Desc.ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_ARCHIVE = Able to archive adverse events following immunization UserRight.Desc.ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_EXPORT = Able to export adverse events following immunization +UserRight.Desc.DISEASE_DETAILS_VIEW = Able to View details of selected disease UserRight.Desc.PERSON_EXPORT = Able to export persons UserRight.Desc.CONTACT_MERGE = Able to merge contacts UserRight.Desc.EVENTGROUP_CREATE = Able to create new event groups diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/dashboard/DashboardFacadeEjb.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/dashboard/DashboardFacadeEjb.java index defa0249587..2ebf72ffd27 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/dashboard/DashboardFacadeEjb.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/dashboard/DashboardFacadeEjb.java @@ -807,6 +807,7 @@ public List getDiseaseBurden( } @Override + @RightsAllowed({UserRight._DISEASE_DETAILS_VIEW}) public DiseaseBurdenDto getDiseaseForDashboard( RegionReferenceDto region, DistrictReferenceDto district, @@ -875,6 +876,8 @@ public DiseaseBurdenDto getDiseaseForDashboard( } @Override + @RightsAllowed({ + UserRight._DISEASE_DETAILS_VIEW}) public DiseaseBurdenDto getDiseaseGridForDashboard( RegionReferenceDto region, DistrictReferenceDto district, diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/outbreak/OutbreakService.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/outbreak/OutbreakService.java index aa622c51736..2e5ce59dc69 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/outbreak/OutbreakService.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/outbreak/OutbreakService.java @@ -174,7 +174,8 @@ public Predicate buildCriteriaFilter(OutbreakCriteria criteria, CriteriaBuilder filter = CriteriaBuilderHelper.and(cb, filter, from.get(Outbreak.DISEASE).in(criteria.getDiseases())); } if (criteria.getDistrict() != null) { - filter = CriteriaBuilderHelper.and(cb, filter, cb.equal(from.join(Outbreak.DISTRICT, JoinType.LEFT).get(District.UUID), criteria.getDistrict().getUuid())); + filter = CriteriaBuilderHelper + .and(cb, filter, cb.equal(from.join(Outbreak.DISTRICT, JoinType.LEFT).get(District.UUID), criteria.getDistrict().getUuid())); } if (criteria.getRegion() != null) { filter = CriteriaBuilderHelper.and( @@ -194,7 +195,8 @@ public Predicate buildCriteriaFilter(OutbreakCriteria criteria, CriteriaBuilder filter = CriteriaBuilderHelper.and(cb, filter, activeFilter); } if (criteria.getReportedDateFrom() != null || criteria.getReportedDateTo() != null) { - filter = CriteriaBuilderHelper.and(cb, filter, cb.between(from.get(Outbreak.REPORT_DATE), criteria.getReportedDateFrom(), criteria.getReportedDateTo())); + filter = CriteriaBuilderHelper + .and(cb, filter, cb.between(from.get(Outbreak.REPORT_DATE), criteria.getReportedDateFrom(), criteria.getReportedDateTo())); } return filter; diff --git a/sormas-backend/src/main/resources/META-INF/glassfish-ejb-jar.xml b/sormas-backend/src/main/resources/META-INF/glassfish-ejb-jar.xml index c907e3669f4..79a1412f56a 100644 --- a/sormas-backend/src/main/resources/META-INF/glassfish-ejb-jar.xml +++ b/sormas-backend/src/main/resources/META-INF/glassfish-ejb-jar.xml @@ -642,6 +642,11 @@ DASHBOARD_ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_VIEW + + DISEASE_DETAILS_VIEW + DISEASE_DETAILS_VIEW + + CASE_CLINICIAN_VIEW CASE_CLINICIAN_VIEW diff --git a/sormas-backend/src/main/resources/sql/sormas_schema.sql b/sormas-backend/src/main/resources/sql/sormas_schema.sql index fb32127ab77..970885c691d 100644 --- a/sormas-backend/src/main/resources/sql/sormas_schema.sql +++ b/sormas-backend/src/main/resources/sql/sormas_schema.sql @@ -13668,4 +13668,9 @@ INSERT INTO userroles_userrights (userrole_id, userright) SELECT id, 'ADVERSE_EV INSERT INTO userroles_userrights (userrole_id, userright) SELECT id, 'ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_EXPORT' FROM public.userroles WHERE userroles.linkeddefaultuserrole in ('ADMIN','NATIONAL_USER'); INSERT INTO schema_version (version_number, comment) VALUES (552, 'Adverse Events Following Immunization (AEFI) - Entities #12634'); + +-- Assign DISEASE_DETAILS_VIEW user rights to default admin and national_user user roles +INSERT INTO userroles_userrights (userrole_id, userright) SELECT id, 'DISEASE_DETAILS_VIEW' FROM public.userroles WHERE userroles.linkeddefaultuserrole in ('ADMIN','NATIONAL_USER'); + +INSERT INTO schema_version (version_number, comment) VALUES (553, 'Dashboard Diseases Details View - #12880'); -- *** Insert new sql commands BEFORE this line. Remember to always consider _history tables. *** diff --git a/sormas-rest/src/main/webapp/WEB-INF/glassfish-web.xml b/sormas-rest/src/main/webapp/WEB-INF/glassfish-web.xml index d9f6a362c55..12fc5998e12 100644 --- a/sormas-rest/src/main/webapp/WEB-INF/glassfish-web.xml +++ b/sormas-rest/src/main/webapp/WEB-INF/glassfish-web.xml @@ -625,6 +625,11 @@ DASHBOARD_ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_VIEW + + DISEASE_DETAILS_VIEW + DISEASE_DETAILS_VIEW + + CASE_CLINICIAN_VIEW CASE_CLINICIAN_VIEW diff --git a/sormas-rest/src/main/webapp/WEB-INF/web.xml b/sormas-rest/src/main/webapp/WEB-INF/web.xml index dc2a67e6b83..b5a41db8405 100644 --- a/sormas-rest/src/main/webapp/WEB-INF/web.xml +++ b/sormas-rest/src/main/webapp/WEB-INF/web.xml @@ -508,6 +508,10 @@ DASHBOARD_ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_VIEW + + DISEASE_DETAILS_VIEW + + CASE_CLINICIAN_VIEW diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/MainScreen.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/MainScreen.java index 00ecea96b08..8504987662f 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/MainScreen.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/MainScreen.java @@ -460,6 +460,10 @@ private static boolean aefiDashboardPermitted() { UserRight.DASHBOARD_ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_VIEW); } + private static boolean diseaseDetailsDashboardPermitted() { + return permitted(EnumSet.of(FeatureType.DISEASE_DETAILS),UserRight.DISEASE_DETAILS_VIEW); + } + private static Set initKnownViews() { final Set views = new HashSet<>( Arrays.asList( diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/AbstractDashboardView.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/AbstractDashboardView.java index 87d8c116c2c..948647bdf82 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/AbstractDashboardView.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/AbstractDashboardView.java @@ -83,7 +83,7 @@ protected AbstractDashboardView(String viewName) { dashboardSwitcher.setItemCaption(DashboardType.CAMPAIGNS, I18nProperties.getEnumCaption(DashboardType.CAMPAIGNS)); } - if (permitted(FeatureType.DISEASE_DETAILS)) { + if (permitted(FeatureType.DISEASE_DETAILS , UserRight.DISEASE_DETAILS_VIEW) ) { dashboardSwitcher.addItem(DashboardType.DISEASE); dashboardSwitcher.setItemCaption(DashboardType.DISEASE, I18nProperties.getEnumCaption(DashboardType.DISEASE)); } diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/DashboardController.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/DashboardController.java index b5f972071ce..cbfccd7b739 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/DashboardController.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/DashboardController.java @@ -62,7 +62,7 @@ public void registerViews(Navigator navigator) { navigator.addView(SampleDashboardView.VIEW_NAME, SampleDashboardView.class); } - if (permitted(FeatureType.DISEASE_DETAILS)) { + if (permitted(FeatureType.DISEASE_DETAILS, UserRight.DISEASE_DETAILS_VIEW)) { navigator.addView(DiseaseDetailsView.VIEW_NAME, DiseaseDetailsView.class); } diff --git a/sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/surveillance/components/disease/tile/DiseaseTileComponent.java b/sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/surveillance/components/disease/tile/DiseaseTileComponent.java index 2ad55559488..1fdb3e89554 100644 --- a/sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/surveillance/components/disease/tile/DiseaseTileComponent.java +++ b/sormas-ui/src/main/java/de/symeda/sormas/ui/dashboard/surveillance/components/disease/tile/DiseaseTileComponent.java @@ -35,6 +35,9 @@ import de.symeda.sormas.ui.dashboard.DashboardDataProvider; import de.symeda.sormas.ui.utils.ButtonHelper; import com.vaadin.ui.themes.ValoTheme; +import de.symeda.sormas.api.feature.FeatureType; +import de.symeda.sormas.api.user.UserRight; +import static de.symeda.sormas.ui.UiUtil.permitted; public class DiseaseTileComponent extends VerticalLayout { @@ -153,7 +156,7 @@ private void addTopLayout(Disease disease, Long casesCount, Long previousCasesCo addComponent(layout); } - private void addStatsLayout(DiseaseBurdenDto diseaseBurden,DashboardDataProvider dashboardDataProvider) { + private void addStatsLayout(DiseaseBurdenDto diseaseBurden, DashboardDataProvider dashboardDataProvider) { Long fatalities = diseaseBurden.getCaseDeathCount(); Long events = diseaseBurden.getEventCount(); String district = diseaseBurden.getLastReportedDistrictName(); @@ -166,22 +169,27 @@ private void addStatsLayout(DiseaseBurdenDto diseaseBurden,DashboardDataProvider layout.addStyleName(CssStyles.BACKGROUND_HIGHLIGHT); StatsItem lastReportItem = - new StatsItem.Builder(Captions.dashboardLastReport, district.isEmpty() ? I18nProperties.getString(Strings.none) : district) + new StatsItem.Builder(Captions.dashboardLastReport, district.length() == 0 ? I18nProperties.getString(Strings.none) : district) .singleColumn(true) .build(); lastReportItem.addStyleName(CssStyles.VSPACE_TOP_4); layout.addComponent(lastReportItem); StatsItem fatality = new StatsItem.Builder(Captions.dashboardFatalities, fatalities).critical(fatalities > 0).build(); - fatality.addStyleName(CssStyles.HSPACE_LEFT_5); + if (permitted(FeatureType.DISEASE_DETAILS , UserRight.DISEASE_DETAILS_VIEW) ) { + fatality.addStyleName(CssStyles.HSPACE_LEFT_5); + } + layout.addComponent(fatality); StatsItem noOfEventsItem = new StatsItem.Builder(Captions.DiseaseBurden_eventCount, events).build(); noOfEventsItem.addStyleName(CssStyles.VSPACE_4); layout.addComponent(noOfEventsItem); - Button component = addDiseaseButton(disease, dashboardDataProvider); - layout.addComponent(component); + if (permitted(FeatureType.DISEASE_DETAILS , UserRight.DISEASE_DETAILS_VIEW) ) { + Button component = addDiseaseButton(disease, dashboardDataProvider); + layout.addComponent(component); + } addComponent(layout); } diff --git a/sormas-ui/src/main/webapp/WEB-INF/glassfish-web.xml b/sormas-ui/src/main/webapp/WEB-INF/glassfish-web.xml index cc6f9e6ccf8..2f1cb43dd34 100644 --- a/sormas-ui/src/main/webapp/WEB-INF/glassfish-web.xml +++ b/sormas-ui/src/main/webapp/WEB-INF/glassfish-web.xml @@ -622,7 +622,12 @@ DASHBOARD_ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_VIEW - DASHBOARD_ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_VIEW + DASHBOARD_ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_VI+EW + + + + DISEASE_DETAILS_VIEW + DISEASE_DETAILS_VIEW diff --git a/sormas-ui/src/main/webapp/WEB-INF/web.xml b/sormas-ui/src/main/webapp/WEB-INF/web.xml index b62eb6a327a..5916fc2f1d9 100644 --- a/sormas-ui/src/main/webapp/WEB-INF/web.xml +++ b/sormas-ui/src/main/webapp/WEB-INF/web.xml @@ -513,6 +513,10 @@ DASHBOARD_ADVERSE_EVENTS_FOLLOWING_IMMUNIZATION_VIEW + + DISEASE_DETAILS_VIEW + + CASE_CLINICIAN_VIEW