Repository: urlaubsverwaltung/urlaubsverwaltung
Pull request #4749 (2024-06-21 10:51:28)

Hide notifications for disabled sicknote submission by user
#4737

<!--

Thanks for contributing to the Urlaubsverwaltung.
Please review the following notes before submitting you pull request.

Please look for other issues or pull requests which already work on this topic. Is somebody already on it? Do you need to synchronize?

# Security Vulnerabilities

🛑 STOP! 🛑 If your contribution fixes a security vulnerability, please do not submit it.
Instead, please open a report of a security vulnerability via
[Report a security vulnerability](https://github.com/urlaubsverwaltung/urlaubsverwaltung/security/advisories/new)


# Describing Your Changes

If, having reviewed the notes above, you're ready to submit your pull request, please
provide a brief description of the proposed changes.

If they:
 🐞 fix a bug, please describe the broken behaviour and how the changes fix it.
    Please label with 'type: bug' and 'status: new'
    
 🎁 make an enhancement, please describe the new functionality and why you believe it's useful.
    Please label with 'type: enhancement' and 'status: new'
 
If your pull request relates to any existing issues,
please reference them by using the issue number prefixed with #.

-->


sonarcloud[bot]: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&resolved=false&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&resolutions=WONTFIX)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&resolved=false&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749)


sonarcloud[bot]: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&resolved=false&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&resolutions=WONTFIX)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&resolved=false&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749)


sonarcloud[bot]: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&resolved=false&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&resolutions=WONTFIX)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&resolved=false&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=urlaubsverwaltung_urlaubsverwaltung&pullRequest=4749)



Patch:
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/person/MailNotification.java b/src/main/java/org/synyx/urlaubsverwaltung/person/MailNotification.java
index f83f21fff..d9810ce23 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/person/MailNotification.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/person/MailNotification.java
@@ -18,56 +18,58 @@ import static org.synyx.urlaubsverwaltung.person.Role.USER;
  */
 public enum MailNotification {
 
-    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_APPLIED(true, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
-    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_ALLOWED(true, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
-    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_REVOKED(true, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
-    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_REJECTED(true, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
-    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_TEMPORARY_ALLOWED(true, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
-    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_CANCELLATION(true, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
-    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_EDITED(true, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
-    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_CONVERTED(true, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
-    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_WAITING_REMINDER(true, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
-
-    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_CANCELLATION_REQUESTED(true, hasRole(USER).and(hasRole(OFFICE).or(hasRole(APPLICATION_CANCELLATION_REQUESTED).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))))),
-
-    NOTIFICATION_EMAIL_APPLICATION_APPLIED(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_APPLICATION_ALLOWED(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_APPLICATION_REVOKED(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_APPLICATION_REJECTED(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_APPLICATION_TEMPORARY_ALLOWED(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_APPLICATION_CANCELLATION(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_APPLICATION_EDITED(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_APPLICATION_CONVERTED(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_APPLICATION_UPCOMING(false, hasRole(USER)),
-
-    NOTIFICATION_EMAIL_APPLICATION_HOLIDAY_REPLACEMENT(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_APPLICATION_HOLIDAY_REPLACEMENT_UPCOMING(false, hasRole(USER)),
-
-    NOTIFICATION_EMAIL_APPLICATION_COLLEAGUES_ALLOWED(true, hasRole(USER)),
-    NOTIFICATION_EMAIL_APPLICATION_COLLEAGUES_CANCELLATION(true, hasRole(USER)),
-
-    NOTIFICATION_EMAIL_PERSON_NEW_MANAGEMENT_ALL(false, hasRole(USER).and(hasAnyRole(BOSS, OFFICE))),
-
-    NOTIFICATION_EMAIL_OVERTIME_MANAGEMENT_APPLIED(true, hasRole(USER).and(hasAnyRole(OFFICE, BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
-    NOTIFICATION_EMAIL_OVERTIME_APPLIED_BY_MANAGEMENT(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_OVERTIME_APPLIED(false, hasRole(USER)),
-
-    NOTIFICATION_EMAIL_SICK_NOTE_SUBMITTED_BY_USER_TO_USER(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_SICK_NOTE_SUBMITTED_BY_USER_TO_MANAGEMENT(true, hasRole(USER).and(hasAnyRole(OFFICE).or(hasRole(SICK_NOTE_ADD).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))))),
-    NOTIFICATION_EMAIL_SICK_NOTE_CREATED_BY_MANAGEMENT(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_SICK_NOTE_CREATED_BY_MANAGEMENT_TO_MANAGEMENT(true, hasRole(USER).and(hasRole(OFFICE).or(hasRole(SICK_NOTE_ADD).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))))),
-    NOTIFICATION_EMAIL_SICK_NOTE_ACCEPTED_BY_MANAGEMENT_TO_USER(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_SICK_NOTE_ACCEPTED_BY_MANAGEMENT_TO_MANAGEMENT(true, hasRole(USER).and(hasAnyRole(OFFICE).or(hasRole(SICK_NOTE_ADD).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))))),
-    NOTIFICATION_EMAIL_SICK_NOTE_EDITED_BY_MANAGEMENT(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_SICK_NOTE_CANCELLED_BY_MANAGEMENT(false, hasRole(USER)),
-    NOTIFICATION_EMAIL_SICK_NOTE_COLLEAGUES_CREATED(true, hasRole(USER)),
-    NOTIFICATION_EMAIL_SICK_NOTE_COLLEAGUES_CANCELLED(true, hasRole(USER));
+    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_APPLIED(true, false, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
+    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_ALLOWED(true, false, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
+    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_REVOKED(true, false, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
+    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_REJECTED(true, false, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
+    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_TEMPORARY_ALLOWED(true, false, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
+    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_CANCELLATION(true, false, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
+    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_EDITED(true, false, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
+    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_CONVERTED(true, false, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
+    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_WAITING_REMINDER(true, false, hasRole(USER).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
+
+    NOTIFICATION_EMAIL_APPLICATION_MANAGEMENT_CANCELLATION_REQUESTED(true, false, hasRole(USER).and(hasRole(OFFICE).or(hasRole(APPLICATION_CANCELLATION_REQUESTED).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))))),
+
+    NOTIFICATION_EMAIL_APPLICATION_APPLIED(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_APPLICATION_ALLOWED(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_APPLICATION_REVOKED(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_APPLICATION_REJECTED(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_APPLICATION_TEMPORARY_ALLOWED(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_APPLICATION_CANCELLATION(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_APPLICATION_EDITED(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_APPLICATION_CONVERTED(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_APPLICATION_UPCOMING(false, false, hasRole(USER)),
+
+    NOTIFICATION_EMAIL_APPLICATION_HOLIDAY_REPLACEMENT(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_APPLICATION_HOLIDAY_REPLACEMENT_UPCOMING(false, false, hasRole(USER)),
+
+    NOTIFICATION_EMAIL_APPLICATION_COLLEAGUES_ALLOWED(true, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_APPLICATION_COLLEAGUES_CANCELLATION(true, false, hasRole(USER)),
+
+    NOTIFICATION_EMAIL_PERSON_NEW_MANAGEMENT_ALL(false, false, hasRole(USER).and(hasAnyRole(BOSS, OFFICE))),
+
+    NOTIFICATION_EMAIL_OVERTIME_MANAGEMENT_APPLIED(true, false, hasRole(USER).and(hasAnyRole(OFFICE, BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))),
+    NOTIFICATION_EMAIL_OVERTIME_APPLIED_BY_MANAGEMENT(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_OVERTIME_APPLIED(false, false, hasRole(USER)),
+
+    NOTIFICATION_EMAIL_SICK_NOTE_SUBMITTED_BY_USER_TO_USER(false, true, hasRole(USER)),
+    NOTIFICATION_EMAIL_SICK_NOTE_SUBMITTED_BY_USER_TO_MANAGEMENT(true, true, hasRole(USER).and(hasAnyRole(OFFICE).or(hasRole(SICK_NOTE_ADD).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))))),
+    NOTIFICATION_EMAIL_SICK_NOTE_CREATED_BY_MANAGEMENT(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_SICK_NOTE_CREATED_BY_MANAGEMENT_TO_MANAGEMENT(true, false, hasRole(USER).and(hasRole(OFFICE).or(hasRole(SICK_NOTE_ADD).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))))),
+    NOTIFICATION_EMAIL_SICK_NOTE_ACCEPTED_BY_MANAGEMENT_TO_USER(false, true, hasRole(USER)),
+    NOTIFICATION_EMAIL_SICK_NOTE_ACCEPTED_BY_MANAGEMENT_TO_MANAGEMENT(true, true, hasRole(USER).and(hasAnyRole(OFFICE).or(hasRole(SICK_NOTE_ADD).and(hasAnyRole(BOSS, DEPARTMENT_HEAD, SECOND_STAGE_AUTHORITY))))),
+    NOTIFICATION_EMAIL_SICK_NOTE_EDITED_BY_MANAGEMENT(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_SICK_NOTE_CANCELLED_BY_MANAGEMENT(false, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_SICK_NOTE_COLLEAGUES_CREATED(true, false, hasRole(USER)),
+    NOTIFICATION_EMAIL_SICK_NOTE_COLLEAGUES_CANCELLED(true, false, hasRole(USER));
 
     private final boolean departmentRelated;
+    private final boolean sickNoteSubmissionRelated;
     private final Predicate<Collection<Role>> isValid;
 
-    MailNotification(boolean departmentRelated, Predicate<Collection<Role>> isValid) {
+    MailNotification(boolean departmentRelated, boolean sickNoteSubmissionRelated, Predicate<Collection<Role>> isValid) {
         this.departmentRelated = departmentRelated;
+        this.sickNoteSubmissionRelated = sickNoteSubmissionRelated;
         this.isValid = isValid;
     }
 
@@ -80,6 +82,10 @@ public enum MailNotification {
         return departmentRelated;
     }
 
+    public boolean isSickNoteSubmissionRelated() {
+        return sickNoteSubmissionRelated;
+    }
+
     public boolean isValidWith(final Collection<Role> roles) {
         return isValid.test(roles);
     }
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonDetailsViewController.java b/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonDetailsViewController.java
index 4ee3ddc04..4d6edf637 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonDetailsViewController.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonDetailsViewController.java
@@ -79,7 +79,7 @@ public class PersonDetailsViewController implements HasLaunchpad {
         model.addAttribute("person", person);
         model.addAttribute("permissions", mapRoleToPermissionsDto(List.copyOf(person.getPermissions())));
 
-        model.addAttribute("personNotificationsDto", mapToPersonNotificationsDto(person));
+        model.addAttribute("personNotificationsDto", mapToPersonNotificationsDto(person, settingsService.getSettings().getSickNoteSettings().getUserIsAllowedToSubmitSickNotes()));
 
         final Optional<PersonBasedata> basedataByPersonId = personBasedataService.getBasedataByPersonId(person.getId());
         if (basedataByPersonId.isPresent()) {
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsMapper.java b/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsMapper.java
index 85450803e..ac0d89e5d 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsMapper.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsMapper.java
@@ -108,7 +108,7 @@ final class PersonNotificationsMapper {
         return mailNotifications;
     }
 
-    static PersonNotificationsDto mapToPersonNotificationsDto(Person person) {
+    static PersonNotificationsDto mapToPersonNotificationsDto(Person person, boolean userIsAllowedToSubmitSickNotes) {
 
         final List<MailNotification> activePersonMailNotifications = new ArrayList<>(person.getNotifications());
         final PersonNotificationsDto personNotificationsDto = new PersonNotificationsDto();
@@ -158,7 +158,7 @@ final class PersonNotificationsMapper {
 
         for (MailNotification mailNotificationToCheck : MailNotification.values()) {
             final boolean departmentRelated = mailNotificationToCheck.isDepartmentRelated();
-            final boolean isVisible = mailNotificationToCheck.isValidWith(person.getPermissions());
+            final boolean isVisible = mailNotificationToCheck.isValidWith(person.getPermissions()) && (!mailNotificationToCheck.isSickNoteSubmissionRelated() || userIsAllowedToSubmitSickNotes);
             final boolean isActive = activePersonMailNotifications.contains(mailNotificationToCheck);
             setterByNotification.get(mailNotificationToCheck).accept(new PersonNotificationDtoDepartmentAware(departmentRelated, isVisible, isActive));
         }
@@ -210,7 +210,10 @@ final class PersonNotificationsMapper {
             personNotificationsDto.getApplicationWaitingReminderForManagement(),
             personNotificationsDto.getApplicationCancellationRequestedForManagement(),
             personNotificationsDto.getOvertimeAppliedForManagement(),
-            personNotificationsDto.getAbsenceForColleagues()
+            personNotificationsDto.getAbsenceForColleagues(),
+            personNotificationsDto.getSickNoteCreatedByManagementForManagement(),
+            personNotificationsDto.getSickNoteSubmittedByUserForManagement(),
+            personNotificationsDto.getSickNoteAcceptedByManagementForManagement()
         );
 
         final List<PersonNotificationDtoDepartmentAware> visibleDepartment = dtoDepartmentNotifications.stream()
diff --git a/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsViewController.java b/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsViewController.java
index b9f9a19e3..c7aae497b 100644
--- a/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsViewController.java
+++ b/src/main/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsViewController.java
@@ -23,6 +23,7 @@ import org.synyx.urlaubsverwaltung.person.Person;
 import org.synyx.urlaubsverwaltung.person.PersonId;
 import org.synyx.urlaubsverwaltung.person.PersonService;
 import org.synyx.urlaubsverwaltung.person.UnknownPersonException;
+import org.synyx.urlaubsverwaltung.settings.SettingsService;
 
 import java.util.List;
 import java.util.Objects;
@@ -51,17 +52,19 @@ public class PersonNotificationsViewController implements HasLaunchpad {
     private final PersonNotificationsDtoValidator validator;
     private final UserNotificationSettingsService userNotificationSettingsService;
     private final DepartmentService departmentService;
+    private final SettingsService settingsService;
 
     @Autowired
     PersonNotificationsViewController(PersonService personService,
                                       PersonNotificationsDtoValidator validator,
                                       UserNotificationSettingsService userNotificationSettingsService,
-                                      DepartmentService departmentService) {
+                                      DepartmentService departmentService, SettingsService settingsService) {
 
         this.personService = personService;
         this.validator = validator;
         this.userNotificationSettingsService = userNotificationSettingsService;
         this.departmentService = departmentService;
+        this.settingsService = settingsService;
     }
 
     @GetMapping("/person/{personId}/notifications")
@@ -87,7 +90,8 @@ public class PersonNotificationsViewController implements HasLaunchpad {
 
         final UserNotificationSettings notificationSettings = userNotificationSettingsService.findNotificationSettings(new PersonId(person.getId()));
 
-        final PersonNotificationsDto personNotificationsDto = mapToPersonNotificationsDto(person);
+        final boolean userIsAllowedToSubmitSickNotes = settingsService.getSettings().getSickNoteSettings().getUserIsAllowedToSubmitSickNotes();
+        final PersonNotificationsDto personNotificationsDto = mapToPersonNotificationsDto(person, userIsAllowedToSubmitSickNotes);
         personNotificationsDto.setRestrictToDepartments(new PersonNotificationDto(person.hasAnyRole(OFFICE, BOSS), notificationSettings.isRestrictToDepartments()));
 
         model.addAttribute("isViewingOwnNotifications", Objects.equals(person.getId(), signedInUser.getId()));
@@ -143,7 +147,8 @@ public class PersonNotificationsViewController implements HasLaunchpad {
             LOG.error("Could not save e-mail-notifications of user {}", person.getId());
 
             final PersonNotificationsDto mergedPersonNotificationsDto = new PersonNotificationsDto();
-            BeanUtils.copyProperties(mapToPersonNotificationsDto(person), mergedPersonNotificationsDto);
+            final boolean userIsAllowedToSubmitSickNotes = settingsService.getSettings().getSickNoteSettings().getUserIsAllowedToSubmitSickNotes();
+            BeanUtils.copyProperties(mapToPersonNotificationsDto(person, userIsAllowedToSubmitSickNotes), mergedPersonNotificationsDto);
             model.addAttribute("personNotificationsDto", mergedPersonNotificationsDto);
             model.addAttribute("error", true);
 
diff --git a/src/main/resources/templates/person/detail-section/person_detail_notifications.html b/src/main/resources/templates/person/detail-section/person_detail_notifications.html
index 42b198f83..5bdd9a3aa 100644
--- a/src/main/resources/templates/person/detail-section/person_detail_notifications.html
+++ b/src/main/resources/templates/person/detail-section/person_detail_notifications.html
@@ -23,9 +23,9 @@
           notifications.applicationCancellationRequestedForManagement.active
         },
         showSickNoteManagement=${
-          notifications.sickNoteCreatedByManagementForManagement.active ||
-          notifications.sickNoteSubmittedByUserForManagement.active ||
-          notifications.sickNoteSubmittedByUserForManagement.active
+          (notifications.sickNoteCreatedByManagementForManagement.visible && notifications.sickNoteCreatedByManagementForManagement.active) ||
+          (notifications.sickNoteSubmittedByUserForManagement.visible && notifications.sickNoteSubmittedByUserForManagement.active) ||
+          (notifications.sickNoteAcceptedByManagementForManagement.visible && notifications.sickNoteAcceptedByManagementForManagement.active)
         },
         showOvertime=${
           notifications.overtimeApplied.active ||
@@ -113,10 +113,10 @@
             th:replace="~{::email-notification-element(active=${notifications.sickNoteCreatedByManagementForManagement.active},info='person.notifications.section.sicknote.created.management.label')}"
           ></dd>
           <dd
-            th:replace="~{::email-notification-element(active=${notifications.sickNoteSubmittedByUserForManagement.active},info='person.notifications.section.sicknote.submitted.management.label')}"
+            th:replace="~{::email-notification-element(active=${notifications.sickNoteSubmittedByUserForManagement.visible && notifications.sickNoteSubmittedByUserForManagement.active},info='person.notifications.section.sicknote.submitted.management.label')}"
           ></dd>
           <dd
-            th:replace="~{::email-notification-element(active=${notifications.sickNoteAcceptedByManagementForManagement.active},info='person.notifications.section.sicknote.accepted.management.label')}"
+            th:replace="~{::email-notification-element(active=${notifications.sickNoteAcceptedByManagementForManagement.visible && notifications.sickNoteAcceptedByManagementForManagement.active},info='person.notifications.section.sicknote.accepted.management.label')}"
           ></dd>
         </th:block>
         <th:block th:if="${showOvertime}">
diff --git a/src/main/resources/templates/person/notifications/departments.html b/src/main/resources/templates/person/notifications/departments.html
index 609a61edf..e5b9e37a0 100644
--- a/src/main/resources/templates/person/notifications/departments.html
+++ b/src/main/resources/templates/person/notifications/departments.html
@@ -164,7 +164,13 @@
               ></li>
             </ul>
           </section>
-          <section th:if="${personNotificationsDto.sickNoteSubmittedByUserForManagement.visible}">
+          <section
+            th:if="${
+                personNotificationsDto.sickNoteCreatedByManagementForManagement.visible ||
+                personNotificationsDto.sickNoteSubmittedByUserForManagement.visible ||
+                personNotificationsDto.sickNoteAcceptedByManagementForManagement.visible
+              }"
+          >
             <h2
               class="tw-sticky tw-text-lg tw-border-b tw-bg-white dark:tw-bg-zinc-900 dark:tw-py-0.5"
               style="top: var(--uv-header-height)"


Test patch:
diff --git a/src/test/java/org/synyx/urlaubsverwaltung/person/web/PersonDetailsViewControllerTest.java b/src/test/java/org/synyx/urlaubsverwaltung/person/web/PersonDetailsViewControllerTest.java
index bf86f6f6f..5e49f8767 100644
--- a/src/test/java/org/synyx/urlaubsverwaltung/person/web/PersonDetailsViewControllerTest.java
+++ b/src/test/java/org/synyx/urlaubsverwaltung/person/web/PersonDetailsViewControllerTest.java
@@ -20,9 +20,8 @@ import org.synyx.urlaubsverwaltung.person.basedata.PersonBasedata;
 import org.synyx.urlaubsverwaltung.person.basedata.PersonBasedataService;
 import org.synyx.urlaubsverwaltung.settings.Settings;
 import org.synyx.urlaubsverwaltung.settings.SettingsService;
-import org.synyx.urlaubsverwaltung.workingtime.FederalState;
+import org.synyx.urlaubsverwaltung.sicknote.settings.SickNoteSettings;
 import org.synyx.urlaubsverwaltung.workingtime.WorkingTimeService;
-import org.synyx.urlaubsverwaltung.workingtime.WorkingTimeSettings;
 
 import java.time.Clock;
 import java.time.LocalDate;
@@ -47,7 +46,6 @@ import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standal
 import static org.synyx.urlaubsverwaltung.person.Role.DEPARTMENT_HEAD;
 import static org.synyx.urlaubsverwaltung.person.Role.OFFICE;
 import static org.synyx.urlaubsverwaltung.person.Role.USER;
-import static org.synyx.urlaubsverwaltung.workingtime.FederalState.GERMANY_BADEN_WUERTTEMBERG;
 
 
 @ExtendWith(MockitoExtension.class)
@@ -108,7 +106,7 @@ class PersonDetailsViewControllerTest {
         when(personService.getSignedInUser()).thenReturn(person);
         when(personService.getPersonByID(1L)).thenReturn(Optional.of(person));
         when(departmentService.isSignedInUserAllowedToAccessPersonData(person, person)).thenReturn(true);
-        when(settingsService.getSettings()).thenReturn(settingsWithFederalState(GERMANY_BADEN_WUERTTEMBERG));
+        userIsAllowedToSubmitSickNotes(false);
 
         perform(get("/web/person/1").param("year", "1985"))
             .andExpect(model().attribute("currentYear", Year.now().getValue()))
@@ -126,7 +124,8 @@ class PersonDetailsViewControllerTest {
         final PersonBasedata personBasedata = new PersonBasedata(new PersonId(1L), "42", "additional information");
         when(personBasedataService.getBasedataByPersonId(1)).thenReturn(Optional.of(personBasedata));
         when(departmentService.isSignedInUserAllowedToAccessPersonData(person, person)).thenReturn(true);
-        when(settingsService.getSettings()).thenReturn(settingsWithFederalState(GERMANY_BADEN_WUERTTEMBERG));
+
+        userIsAllowedToSubmitSickNotes(false);
 
         perform(get("/web/person/1"))
             .andExpect(model().attribute("personBasedata", hasProperty("personnelNumber", is("42"))))
@@ -142,7 +141,8 @@ class PersonDetailsViewControllerTest {
         when(personService.getSignedInUser()).thenReturn(person);
         when(personService.getPersonByID(1L)).thenReturn(Optional.of(person));
         when(departmentService.isSignedInUserAllowedToAccessPersonData(person, person)).thenReturn(true);
-        when(settingsService.getSettings()).thenReturn(settingsWithFederalState(GERMANY_BADEN_WUERTTEMBERG));
+
+        userIsAllowedToSubmitSickNotes(false);
 
         final int currentYear = Year.now(clock).getValue();
 
@@ -160,7 +160,7 @@ class PersonDetailsViewControllerTest {
         when(personService.getSignedInUser()).thenReturn(person);
         when(personService.getPersonByID(1L)).thenReturn(Optional.of(person));
         when(departmentService.isSignedInUserAllowedToAccessPersonData(person, person)).thenReturn(true);
-        when(settingsService.getSettings()).thenReturn(settingsWithFederalState(GERMANY_BADEN_WUERTTEMBERG));
+        userIsAllowedToSubmitSickNotes(false);
 
         perform(get("/web/person/1"))
             .andExpect(model().attribute("account", nullValue()));
@@ -181,7 +181,7 @@ class PersonDetailsViewControllerTest {
         when(personService.getSignedInUser()).thenReturn(person);
         when(personService.getPersonByID(1L)).thenReturn(Optional.of(person));
         when(departmentService.isSignedInUserAllowedToAccessPersonData(person, person)).thenReturn(true);
-        when(settingsService.getSettings()).thenReturn(settingsWithFederalState(GERMANY_BADEN_WUERTTEMBERG));
+        userIsAllowedToSubmitSickNotes(false);
 
         perform(get("/web/person/1"))
             .andExpect(view().name("person/person_detail"));
@@ -197,7 +197,7 @@ class PersonDetailsViewControllerTest {
         office.setPermissions(List.of(USER, OFFICE));
         when(personService.getSignedInUser()).thenReturn(office);
         when(personService.getPersonByID(1L)).thenReturn(Optional.of(person));
-        when(settingsService.getSettings()).thenReturn(settingsWithFederalState(GERMANY_BADEN_WUERTTEMBERG));
+        userIsAllowedToSubmitSickNotes(false);
         when(departmentService.isSignedInUserAllowedToAccessPersonData(office, person)).thenReturn(true);
 
         perform(get("/web/person/1"))
@@ -215,7 +215,7 @@ class PersonDetailsViewControllerTest {
         office.setPermissions(List.of(USER, OFFICE));
         when(personService.getSignedInUser()).thenReturn(office);
         when(personService.getPersonByID(1L)).thenReturn(Optional.of(person));
-        when(settingsService.getSettings()).thenReturn(settingsWithFederalState(GERMANY_BADEN_WUERTTEMBERG));
+        userIsAllowedToSubmitSickNotes(false);
         when(departmentService.isSignedInUserAllowedToAccessPersonData(office, person)).thenReturn(true);
 
         perform(get("/web/person/1"))
@@ -233,7 +233,7 @@ class PersonDetailsViewControllerTest {
         office.setPermissions(List.of(USER, OFFICE));
         when(personService.getSignedInUser()).thenReturn(office);
         when(personService.getPersonByID(1L)).thenReturn(Optional.of(person));
-        when(settingsService.getSettings()).thenReturn(settingsWithFederalState(GERMANY_BADEN_WUERTTEMBERG));
+        userIsAllowedToSubmitSickNotes(false);
         when(departmentService.isSignedInUserAllowedToAccessPersonData(office, person)).thenReturn(true);
 
         perform(get("/web/person/1"))
@@ -251,7 +251,7 @@ class PersonDetailsViewControllerTest {
         office.setPermissions(List.of(USER, OFFICE));
         when(personService.getSignedInUser()).thenReturn(office);
         when(personService.getPersonByID(1L)).thenReturn(Optional.of(person));
-        when(settingsService.getSettings()).thenReturn(settingsWithFederalState(GERMANY_BADEN_WUERTTEMBERG));
+        userIsAllowedToSubmitSickNotes(false);
         when(departmentService.isSignedInUserAllowedToAccessPersonData(office, person)).thenReturn(true);
 
         perform(get("/web/person/1"))
@@ -266,19 +266,16 @@ class PersonDetailsViewControllerTest {
             .perform(builder);
     }
 
-    private static Settings settingsWithFederalState(FederalState federalState) {
-
-        final WorkingTimeSettings workingTimeSettings = new WorkingTimeSettings();
-        workingTimeSettings.setFederalState(federalState);
-
-        final Settings settings = new Settings();
-        settings.setWorkingTimeSettings(workingTimeSettings);
-
-        return settings;
-    }
-
     private static Account accountForPerson(Person person) {
         final LocalDate expiryDate = LocalDate.now(clock).withMonth(APRIL.getValue()).with(firstDayOfMonth());
         return new Account(person, LocalDate.now(clock), LocalDate.now(clock), true, expiryDate, ONE, TEN, TEN, "");
     }
+
+    private void userIsAllowedToSubmitSickNotes(boolean userIsAllowedToSubmit) {
+        final Settings settings = new Settings();
+        final SickNoteSettings sickNoteSettings = new SickNoteSettings();
+        sickNoteSettings.setUserIsAllowedToSubmitSickNotes(userIsAllowedToSubmit);
+        settings.setSickNoteSettings(sickNoteSettings);
+        when(settingsService.getSettings()).thenReturn(settings);
+    }
 }
diff --git a/src/test/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsViewControllerTest.java b/src/test/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsViewControllerTest.java
index f60f59271..dff68fe66 100644
--- a/src/test/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsViewControllerTest.java
+++ b/src/test/java/org/synyx/urlaubsverwaltung/person/web/PersonNotificationsViewControllerTest.java
@@ -21,6 +21,9 @@ import org.synyx.urlaubsverwaltung.person.PersonId;
 import org.synyx.urlaubsverwaltung.person.PersonService;
 import org.synyx.urlaubsverwaltung.person.Role;
 import org.synyx.urlaubsverwaltung.person.UnknownPersonException;
+import org.synyx.urlaubsverwaltung.settings.Settings;
+import org.synyx.urlaubsverwaltung.settings.SettingsService;
+import org.synyx.urlaubsverwaltung.sicknote.settings.SickNoteSettings;
 
 import java.util.List;
 import java.util.Optional;
@@ -66,10 +69,12 @@ class PersonNotificationsViewControllerTest {
     private UserNotificationSettingsService userNotificationSettingsService;
     @Mock
     private DepartmentService departmentService;
+    @Mock
+    private SettingsService settingsService;
 
     @BeforeEach
     void setUp() {
-        sut = new PersonNotificationsViewController(personService, validator, userNotificationSettingsService, departmentService);
+        sut = new PersonNotificationsViewController(personService, validator, userNotificationSettingsService, departmentService, settingsService);
     }
 
     @ParameterizedTest
@@ -91,6 +96,8 @@ class PersonNotificationsViewControllerTest {
 
         when(departmentService.getNumberOfDepartments()).thenReturn(0L);
 
+        userIsAllowedToSubmitSickNotes(false);
+
         perform(get(givenUrl, 1))
             .andExpect(status().isOk())
             .andExpect(model().attribute("departmentsAvailable", is(false)))
@@ -119,6 +126,8 @@ class PersonNotificationsViewControllerTest {
         when(departmentService.getNumberOfDepartments()).thenReturn(4L);
         when(departmentService.getDepartmentsPersonHasAccessTo(person)).thenReturn(List.of(new Department()));
 
+        userIsAllowedToSubmitSickNotes(false);
+
         perform(get(givenUrl, 1))
             .andExpect(status().isOk())
             .andExpect(model().attribute("departmentsAvailable", is(true)))
@@ -147,6 +156,8 @@ class PersonNotificationsViewControllerTest {
         when(departmentService.getNumberOfDepartments()).thenReturn(4L);
         when(departmentService.getDepartmentsPersonHasAccessTo(person)).thenReturn(List.of());
 
+        userIsAllowedToSubmitSickNotes(false);
+
         perform(get(givenUrl, 1))
             .andExpect(status().isOk())
             .andExpect(model().attribute("departmentsAvailable", is(true)))
@@ -166,6 +177,8 @@ class PersonNotificationsViewControllerTest {
         final UserNotificationSettings userNotificationSettings = new UserNotificationSettings(new PersonId(1L), true);
         when(userNotificationSettingsService.findNotificationSettings(new PersonId(1L))).thenReturn(userNotificationSettings);
 
+        userIsAllowedToSubmitSickNotes(false);
+
         perform(get("/web/person/{personId}/notifications", 1))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("personId", is(1L))))
             .andExpect(model().attribute("personNotificationsDto",
@@ -186,8 +199,14 @@ class PersonNotificationsViewControllerTest {
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAdaptedForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationWaitingReminderForManagement", hasProperty("visible", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationWaitingReminderForManagement", hasProperty("active", is(false)))))
-            .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteCreatedByManagementForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteCreatedByManagementForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAppliedAndChanges", hasProperty("visible", is(true)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAppliedAndChanges", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationUpcoming", hasProperty("visible", is(true)))))
@@ -220,6 +239,8 @@ class PersonNotificationsViewControllerTest {
         when(userNotificationSettingsService.findNotificationSettings(new PersonId(1L)))
             .thenReturn(new UserNotificationSettings(new PersonId(1L), false));
 
+        userIsAllowedToSubmitSickNotes(false);
+
         perform(get("/web/person/{personId}/notifications", 1))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("personId", is(1L))))
             .andExpect(model().attribute("personNotificationsDto",
@@ -242,6 +263,12 @@ class PersonNotificationsViewControllerTest {
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationWaitingReminderForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("visible", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteCreatedByManagementForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteCreatedByManagementForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAppliedAndChanges", hasProperty("visible", is(true)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAppliedAndChanges", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationUpcoming", hasProperty("visible", is(true)))))
@@ -274,6 +301,8 @@ class PersonNotificationsViewControllerTest {
         when(userNotificationSettingsService.findNotificationSettings(new PersonId(1L)))
             .thenReturn(new UserNotificationSettings(new PersonId(1L), false));
 
+        userIsAllowedToSubmitSickNotes(false);
+
         perform(get("/web/person/{personId}/notifications", 1))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("personId", is(1L))))
             .andExpect(model().attribute("personNotificationsDto",
@@ -296,6 +325,12 @@ class PersonNotificationsViewControllerTest {
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationWaitingReminderForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("visible", is(true)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteCreatedByManagementForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteCreatedByManagementForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAppliedAndChanges", hasProperty("visible", is(true)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAppliedAndChanges", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationUpcoming", hasProperty("visible", is(true)))))
@@ -328,6 +363,8 @@ class PersonNotificationsViewControllerTest {
         when(userNotificationSettingsService.findNotificationSettings(new PersonId(1L)))
             .thenReturn(new UserNotificationSettings(new PersonId(1L), false));
 
+        userIsAllowedToSubmitSickNotes(false);
+
         perform(get("/web/person/{personId}/notifications", 1))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("personId", is(1L))))
             .andExpect(model().attribute("personNotificationsDto",
@@ -350,6 +387,12 @@ class PersonNotificationsViewControllerTest {
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationWaitingReminderForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("visible", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteCreatedByManagementForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteCreatedByManagementForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAppliedAndChanges", hasProperty("visible", is(true)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAppliedAndChanges", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationUpcoming", hasProperty("visible", is(true)))))
@@ -382,6 +425,8 @@ class PersonNotificationsViewControllerTest {
         when(userNotificationSettingsService.findNotificationSettings(new PersonId(1L)))
             .thenReturn(new UserNotificationSettings(new PersonId(1L), false));
 
+        userIsAllowedToSubmitSickNotes(false);
+
         perform(get("/web/person/{personId}/notifications", 1))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("personId", is(1L))))
             .andExpect(model().attribute("personNotificationsDto",
@@ -406,6 +451,8 @@ class PersonNotificationsViewControllerTest {
         when(userNotificationSettingsService.findNotificationSettings(new PersonId(1L)))
             .thenReturn(new UserNotificationSettings(new PersonId(1L), false));
 
+        userIsAllowedToSubmitSickNotes(false);
+
         perform(get("/web/person/{personId}/notifications", 1))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("personId", is(1L))))
             .andExpect(model().attribute("personNotificationsDto",
@@ -429,6 +476,8 @@ class PersonNotificationsViewControllerTest {
         when(userNotificationSettingsService.findNotificationSettings(new PersonId(1L)))
             .thenReturn(new UserNotificationSettings(new PersonId(1L), false));
 
+        userIsAllowedToSubmitSickNotes(false);
+
         perform(get("/web/person/{personId}/notifications", 1))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("personId", is(1L))))
             .andExpect(model().attribute("personNotificationsDto",
@@ -451,6 +500,12 @@ class PersonNotificationsViewControllerTest {
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationWaitingReminderForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("visible", is(true)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteCreatedByManagementForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteCreatedByManagementForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAppliedAndChanges", hasProperty("visible", is(true)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAppliedAndChanges", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationUpcoming", hasProperty("visible", is(true)))))
@@ -482,6 +537,8 @@ class PersonNotificationsViewControllerTest {
         when(userNotificationSettingsService.findNotificationSettings(new PersonId(1L)))
             .thenReturn(new UserNotificationSettings(new PersonId(1L), false));
 
+        userIsAllowedToSubmitSickNotes(false);
+
         perform(get("/web/person/{personId}/notifications", 1))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("personId", is(1L))))
             .andExpect(model().attribute("personNotificationsDto",
@@ -504,6 +561,12 @@ class PersonNotificationsViewControllerTest {
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationWaitingReminderForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("visible", is(true)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationCancellationRequestedForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteCreatedByManagementForManagement", hasProperty("visible", is(true)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteCreatedByManagementForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAppliedAndChanges", hasProperty("visible", is(true)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationAppliedAndChanges", hasProperty("active", is(false)))))
             .andExpect(model().attribute("personNotificationsDto", hasProperty("applicationUpcoming", hasProperty("visible", is(true)))))
@@ -522,6 +585,54 @@ class PersonNotificationsViewControllerTest {
             .andExpect(model().attribute("personNotificationsDto", hasProperty("overtimeApplied", hasProperty("active", is(false)))));
     }
 
+    @Test
+    void ensuresThatOnlyVisibleAndActiveAndUserIsNotAllowedToSubmitSickNotesForOffice() throws Exception {
+
+        final Person person = personWithId(1);
+        person.setFirstName("Hans");
+        person.setNotifications(List.of());
+        person.setPermissions(List.of(USER, OFFICE));
+        when(personService.getPersonByID(1L)).thenReturn(Optional.of(person));
+        when(personService.getSignedInUser()).thenReturn(person);
+
+        when(userNotificationSettingsService.findNotificationSettings(new PersonId(1L)))
+            .thenReturn(new UserNotificationSettings(new PersonId(1L), false));
+
+        userIsAllowedToSubmitSickNotes(false);
+
+        perform(get("/web/person/{personId}/notifications", 1))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("personId", is(1L))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("visible", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("active", is(false)))))
+        ;
+    }
+
+    @Test
+    void ensuresThatOnlyVisibleAndActiveAndUserIsAllowedToSubmitSickNotesForOffice() throws Exception {
+
+        final Person person = personWithId(1);
+        person.setFirstName("Hans");
+        person.setNotifications(List.of());
+        person.setPermissions(List.of(USER, OFFICE));
+        when(personService.getPersonByID(1L)).thenReturn(Optional.of(person));
+        when(personService.getSignedInUser()).thenReturn(person);
+
+        when(userNotificationSettingsService.findNotificationSettings(new PersonId(1L)))
+            .thenReturn(new UserNotificationSettings(new PersonId(1L), false));
+
+        userIsAllowedToSubmitSickNotes(true);
+
+        perform(get("/web/person/{personId}/notifications", 1))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("personId", is(1L))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("visible", is(true)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteSubmittedByUserForManagement", hasProperty("active", is(false)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("visible", is(true)))))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("sickNoteAcceptedByManagementForManagement", hasProperty("active", is(false)))))
+            ;
+    }
+
     @Test
     void showPersonNotificationsForUnknownIdThrowsUnknownPersonException() {
         assertThatThrownBy(() ->
@@ -612,6 +723,8 @@ class PersonNotificationsViewControllerTest {
             return null;
         }).when(validator).validate(any(), any());
 
+        userIsAllowedToSubmitSickNotes(false);
+
         perform(post("/web/person/{personId}/notifications", 1)
             .param("personId", "1")
             .param("applicationAppliedAndChanges.visible", "true")
@@ -623,6 +736,25 @@ class PersonNotificationsViewControllerTest {
         verify(personService, never()).update(personWithoutNotifications);
     }
 
+    @Test
+    void ensureSickNoteSubmissionOnDepartmentNotifications() throws Exception {
+
+        final Person person = personWithId(1);
+        person.setFirstName("Hans");
+        person.setNotifications(List.of());
+        person.setPermissions(List.of(USER, OFFICE));
+        when(personService.getPersonByID(1L)).thenReturn(Optional.of(person));
+        when(personService.getSignedInUser()).thenReturn(person);
+
+        when(userNotificationSettingsService.findNotificationSettings(new PersonId(1L)))
+            .thenReturn(new UserNotificationSettings(new PersonId(1L), true));
+
+        userIsAllowedToSubmitSickNotes(true);
+
+        perform(get("/web/person/{personId}/notifications/departments", 1))
+            .andExpect(model().attribute("personNotificationsDto", hasProperty("personId", is(1L))));
+    }
+
     private static Person personWithId(long personId) {
         final Person person = new Person();
         person.setId(personId);
@@ -632,4 +764,12 @@ class PersonNotificationsViewControllerTest {
     private ResultActions perform(MockHttpServletRequestBuilder builder) throws Exception {
         return standaloneSetup(sut).build().perform(builder);
     }
+
+    private void userIsAllowedToSubmitSickNotes(boolean userIsAllowedToSubmit) {
+        final Settings settings = new Settings();
+        final SickNoteSettings sickNoteSettings = new SickNoteSettings();
+        sickNoteSettings.setUserIsAllowedToSubmitSickNotes(userIsAllowedToSubmit);
+        settings.setSickNoteSettings(sickNoteSettings);
+        when(settingsService.getSettings()).thenReturn(settings);
+    }
 }