diff --git a/issues/src/org/labkey/issue/model/IssueManager.java b/issues/src/org/labkey/issue/model/IssueManager.java index a2b4bd33d21..d598e313e94 100644 --- a/issues/src/org/labkey/issue/model/IssueManager.java +++ b/issues/src/org/labkey/issue/model/IssueManager.java @@ -948,6 +948,11 @@ private static class IndexGroup implements Consumer(issue, isRestricted)); } } diff --git a/issues/src/org/labkey/issue/view/searchSummary.jsp b/issues/src/org/labkey/issue/view/searchSummary.jsp index e8a38dff56e..6ebc4acfc5d 100644 --- a/issues/src/org/labkey/issue/view/searchSummary.jsp +++ b/issues/src/org/labkey/issue/view/searchSummary.jsp @@ -23,12 +23,15 @@ <%@ page import="java.util.regex.Matcher" %> <%@ page import="java.util.regex.Pattern" %> <%@ page import="org.apache.commons.lang3.Strings" %> +<%@ page import="org.labkey.api.util.Pair" %> <%@ taglib prefix="labkey" uri="http://www.labkey.org/taglib" %> <%@ page extends="org.labkey.api.jsp.JspBase" %> <% - JspView me = HttpView.currentView(); - final IssueObject issue = me.getModelBean(); + JspView> me = HttpView.currentView(); + final Pair rec = me.getModelBean(); final User user = getUser(); + final IssueObject issue = rec.first; + final Boolean isRestricted = rec.second; final boolean isClosed = Strings.CI.equals(issue.getStatus(),"closed"); final boolean isOpen = Strings.CI.equals(issue.getStatus(),"open"); %> @@ -47,29 +50,36 @@ <% StringBuilder html = new StringBuilder(); boolean hasTextComment = false; - for (IssueObject.CommentObject comment : issue.getCommentObjects()) + if (isRestricted) { - String s = comment.getHtmlComment().toString(); - String pattern1 = "
"; - String pattern2 = "
"; - String regexString = Pattern.quote(pattern1) + "(?s)(.*?)" + Pattern.quote(pattern2); - Pattern p = Pattern.compile(regexString); - Matcher matcher = p.matcher(s); - while (matcher.find()) + html.append("
Restricted Issue: You do not have access. Contact your administrator for access.
"); + } + else + { + for (IssueObject.CommentObject comment : issue.getCommentObjects()) { - String commentContentText = matcher.group(1); - if (!StringUtils.isEmpty(commentContentText)) + String s = comment.getHtmlComment().toString(); + String pattern1 = "
"; + String pattern2 = "
"; + String regexString = Pattern.quote(pattern1) + "(?s)(.*?)" + Pattern.quote(pattern2); + Pattern p = Pattern.compile(regexString); + Matcher matcher = p.matcher(s); + while (matcher.find()) { - hasTextComment = true; - html.append(commentContentText); - html.append("
"); - if (html.length() > 500) - break; + String commentContentText = matcher.group(1); + if (!StringUtils.isEmpty(commentContentText)) + { + hasTextComment = true; + html.append(commentContentText); + html.append("
"); + if (html.length() > 500) + break; + } } } } - if (hasTextComment) { %> + if (hasTextComment && !isRestricted) { %> <% } %>
<%= unsafe(html.toString()) %>