diff --git a/common/src/main/java/org/phoenixctms/ctsms/util/AuthorisationExceptionCodes.java b/common/src/main/java/org/phoenixctms/ctsms/util/AuthorisationExceptionCodes.java index 4dd07ab2244e..4ccbfb0d36fb 100644 --- a/common/src/main/java/org/phoenixctms/ctsms/util/AuthorisationExceptionCodes.java +++ b/common/src/main/java/org/phoenixctms/ctsms/util/AuthorisationExceptionCodes.java @@ -14,5 +14,7 @@ public interface AuthorisationExceptionCodes { public static final String PARAMETER_DISJUNCTIVE_RESTRICTION_NOT_SATISFIED = "parameter_disjunctive_restriction_not_satisfied"; public static final String PARAMETER_RESTRICTION_VIOLATED = "parameter_restriction_violated"; public final static String FILE_NOT_PUBLIC = "file_not_public"; + public final static String FILE_NOT_ACTIVE = "file_not_active"; + public final static String HYPERLINK_NOT_ACTIVE = "hyperlink_not_active"; public final static String ENCRYPTED_FILE = "encrypted_file"; } diff --git a/core/src/main/java/org/phoenixctms/ctsms/util/ServiceUtil.java b/core/src/main/java/org/phoenixctms/ctsms/util/ServiceUtil.java index 216d8ec1e0e1..248209e00f61 100644 --- a/core/src/main/java/org/phoenixctms/ctsms/util/ServiceUtil.java +++ b/core/src/main/java/org/phoenixctms/ctsms/util/ServiceUtil.java @@ -9,6 +9,7 @@ import java.text.DateFormat; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -3364,6 +3365,20 @@ public static boolean hasProbandAllDepartmentsAccount(Staff staff, UserPermissio return false; } + public static boolean hasInheritedPermissionProfile(User user, PermissionProfileGroup profileGroup, + UserPermissionProfileDao userPermissionProfileDao, PermissionProfile... profiles) { + HashMap> inheritPermissionProfileGroupMap = new HashMap>(); + Iterator userPermissionProfilesIt = ServiceUtil.getInheritedUserPermissionProfiles(CoreUtil.getUser(), profileGroup, + true, inheritPermissionProfileGroupMap, userPermissionProfileDao).iterator(); + HashSet profilesSet = new HashSet(Arrays.asList(profiles)); + while (userPermissionProfilesIt.hasNext()) { + if (profilesSet.contains(userPermissionProfilesIt.next().getProfile())) { + return true; + } + } + return false; + } + public static Collection getInheritedUserPermissionProfiles(User user, PermissionProfileGroup profileGroup, Boolean active, HashMap> inheritPermissionProfileGroupMap, UserPermissionProfileDao userPermissionProfileDao) { if (isPermissionProfileGroupInherited(user, profileGroup, inheritPermissionProfileGroupMap)) { diff --git a/core/src/main/resources/ctsms-authorisationexceptionmessages.properties b/core/src/main/resources/ctsms-authorisationexceptionmessages.properties index 7a61556a932c..846cd434097f 100644 --- a/core/src/main/resources/ctsms-authorisationexceptionmessages.properties +++ b/core/src/main/resources/ctsms-authorisationexceptionmessages.properties @@ -14,5 +14,7 @@ no_host=not allowed to perform operation {0} - host address unknown host_not_allowed_or_unknown_host=not allowed to perform operation {0} from host address {1} file_not_public=file ID {0} is not public +file_not_active=file ID {0} is not approved +hyperlink_not_active=hyperlink ID {0} is not approved encrypted_file=file ID {0} is encrypted diff --git a/core/src/main/resources/ctsms-authorisationexceptionmessages_de.properties b/core/src/main/resources/ctsms-authorisationexceptionmessages_de.properties index 3edb6e591472..4373739f354d 100644 --- a/core/src/main/resources/ctsms-authorisationexceptionmessages_de.properties +++ b/core/src/main/resources/ctsms-authorisationexceptionmessages_de.properties @@ -14,5 +14,7 @@ no_host=Ausf\u00FChrung der Operation {0} nicht erlaubt - Host-Adresse nicht bek host_not_allowed_or_unknown_host=Ausf\u00FChrung der Operation {0} von Host-Adresse {1} nicht erlaubt file_not_public=Datei ID {0} ist nicht \u00F6ffentlich +file_not_active=Datei ID {0} ist nicht freigegeben +hyperlink_not_active=Hyperlink ID {0} ist nicht freigegeben encrypted_file=Datei ID {0} ist verschl\u00FCsselt