class FileAccessService {

    public boolean isUserHasAtLeastGivenPermission(String userId, File file, Permission... permissions) {
        Map<String, Permission> sharedUsersIdWithPermission = file.getSharedUsersIdWithPermission();
        if (sharedUsersIdWithPermission.containsKey(userId)) {
            Permission userPermission = sharedUsersIdWithPermission.get(userId);
            return Arrays.asList(permissions).contains(userPermission);
        }
        return false;
    }

}