Skip to content

Commit

Permalink
authorisationexception messages for denied access to not approved
Browse files Browse the repository at this point in the history
files/hyperlinks
  • Loading branch information
rkrenn committed Oct 11, 2024
1 parent 498ed77 commit e41abfa
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
15 changes: 15 additions & 0 deletions core/src/main/java/org/phoenixctms/ctsms/util/ServiceUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Long, HashSet<PermissionProfileGroup>> inheritPermissionProfileGroupMap = new HashMap<Long, HashSet<PermissionProfileGroup>>();
Iterator<UserPermissionProfile> userPermissionProfilesIt = ServiceUtil.getInheritedUserPermissionProfiles(CoreUtil.getUser(), profileGroup,
true, inheritPermissionProfileGroupMap, userPermissionProfileDao).iterator();
HashSet<PermissionProfile> profilesSet = new HashSet<PermissionProfile>(Arrays.asList(profiles));
while (userPermissionProfilesIt.hasNext()) {
if (profilesSet.contains(userPermissionProfilesIt.next().getProfile())) {
return true;
}
}
return false;
}

public static Collection<UserPermissionProfile> getInheritedUserPermissionProfiles(User user, PermissionProfileGroup profileGroup, Boolean active,
HashMap<Long, HashSet<PermissionProfileGroup>> inheritPermissionProfileGroupMap, UserPermissionProfileDao userPermissionProfileDao) {
if (isPermissionProfileGroupInherited(user, profileGroup, inheritPermissionProfileGroupMap)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e41abfa

Please sign in to comment.