Skip to content

Commit 38726e0

Browse files
committed
Merge remote-tracking branch 'Origin/release26.3-SNAPSHOT' into 26.3_fb_lovcombo_timeofday_1266
2 parents 161631f + e6fe190 commit 38726e0

75 files changed

Lines changed: 2756 additions & 646 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

announcements/src/org/labkey/announcements/AnnouncementsController.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.jetbrains.annotations.Nullable;
2727
import org.json.JSONObject;
2828
import org.labkey.announcements.model.AnnouncementDigestProvider;
29+
import org.labkey.announcements.model.AnnouncementFullModel;
2930
import org.labkey.announcements.model.AnnouncementManager;
3031
import org.labkey.announcements.model.AnnouncementModel;
3132
import org.labkey.announcements.model.DailyDigestEmailPrefsSelector;
@@ -214,7 +215,6 @@ public static ActionURL getBeginURL(Container c)
214215

215216
public static AnnouncementModel copyEditableProps(AnnouncementModel target, AnnouncementModel source, boolean isInsert)
216217
{
217-
if (source.getApproved() != null) target.setApproved(source.getApproved());
218218
if (source.getAssignedTo() != null) target.setAssignedTo(source.getAssignedTo());
219219
if (source.getBody() != null) target.setBody(source.getBody());
220220
if (source.getExpires() != null) target.setExpires(source.getExpires());
@@ -915,7 +915,7 @@ public BindException bindParameters(PropertyValues m) throws Exception
915915
public ModelAndView getInsertUpdateView(AnnouncementForm form, boolean reshow, BindException errors)
916916
{
917917
Permissions perm = getPermissions();
918-
AnnouncementModel parent = null;
918+
AnnouncementFullModel parent = null;
919919
Container c = getContainer();
920920

921921
if (null != form.getParentId())
@@ -2240,7 +2240,7 @@ protected DataRegion getDataRegion(Permissions perm, Settings settings)
22402240

22412241
public static class ThreadViewBean
22422242
{
2243-
public AnnouncementModel announcementModel;
2243+
public AnnouncementFullModel announcementModel;
22442244
public String message = "";
22452245
public Permissions perm = null;
22462246
public boolean isResponse = false;
@@ -2261,7 +2261,7 @@ private ThreadView()
22612261
super("/org/labkey/announcements/announcementThread.jsp", new ThreadViewBean());
22622262
}
22632263

2264-
public ThreadView(Container c, ActionURL url, AnnouncementModel ann, Permissions perm)
2264+
public ThreadView(Container c, ActionURL url, AnnouncementFullModel ann, Permissions perm)
22652265
{
22662266
this();
22672267
init(c, ann, url, perm, true, false);
@@ -2270,11 +2270,11 @@ public ThreadView(Container c, ActionURL url, AnnouncementModel ann, Permissions
22702270
public ThreadView(AnnouncementForm form, Container c, ActionURL url, Permissions perm, boolean print)
22712271
{
22722272
this();
2273-
AnnouncementModel ann = findThread(c, form.getAsString("rowId"), form.getAsString("entityId"));
2273+
AnnouncementFullModel ann = findThread(c, form.getAsString("rowId"), form.getAsString("entityId"));
22742274
init(c, ann, url, perm, false, print);
22752275
}
22762276

2277-
protected void init(Container c, AnnouncementModel ann, URLHelper currentURL, Permissions perm, boolean isResponse, boolean print)
2277+
protected void init(Container c, AnnouncementFullModel ann, URLHelper currentURL, Permissions perm, boolean isResponse, boolean print)
22782278
{
22792279
if (null == c || !perm.allowRead(ann))
22802280
{
@@ -2378,7 +2378,7 @@ public AnnouncementModel getAnnouncement()
23782378
}
23792379

23802380

2381-
private static @Nullable AnnouncementModel findThread(Container c, String rowIdVal, String entityId)
2381+
private static @Nullable AnnouncementFullModel findThread(Container c, String rowIdVal, String entityId)
23822382
{
23832383
int rowId = 0;
23842384
if (rowIdVal != null)

announcements/src/org/labkey/announcements/announcementThread.jsp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<%@ page import="org.labkey.announcements.AnnouncementsController.RespondAction" %>
2121
<%@ page import="org.labkey.announcements.AnnouncementsController.ThreadView" %>
2222
<%@ page import="org.labkey.announcements.AnnouncementsController.ThreadViewBean" %>
23+
<%@ page import="org.labkey.announcements.model.AnnouncementFullModel" %>
2324
<%@ page import="org.labkey.announcements.model.AnnouncementManager" %>
2425
<%@ page import="org.labkey.announcements.model.AnnouncementModel" %>
2526
<%@ page import="org.labkey.announcements.model.Settings" %>
@@ -38,7 +39,7 @@
3839
Container c = getContainer();
3940
User user = getUser();
4041
ThreadViewBean bean = me.getModelBean();
41-
AnnouncementModel announcementModel = bean.announcementModel;
42+
AnnouncementFullModel announcementModel = bean.announcementModel;
4243
Settings settings = bean.settings;
4344
4445
if (null == announcementModel)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.labkey.announcements.model;
2+
3+
import java.util.Date;
4+
5+
public class AnnouncementFullModel extends AnnouncementModel
6+
{
7+
private Date _approved = null;
8+
9+
public Date getApproved()
10+
{
11+
return _approved;
12+
}
13+
14+
public void setApproved(Date approved)
15+
{
16+
_approved = approved;
17+
}
18+
19+
public boolean isSpam()
20+
{
21+
return AnnouncementManager.SPAM_MAGIC_DATE.equals(getApproved());
22+
}
23+
}

announcements/src/org/labkey/announcements/model/AnnouncementManager.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,20 @@ private AnnouncementManager()
121121
{
122122
}
123123

124-
private static @Nullable AnnouncementModel getAnnouncement(@Nullable Container c, @NotNull SimpleFilter filter)
124+
private static @Nullable AnnouncementFullModel getAnnouncement(@Nullable Container c, @NotNull SimpleFilter filter)
125125
{
126126
if (c != null)
127127
filter.addCondition(FieldKey.fromParts("Container"), c);
128128

129-
return new TableSelector(_comm.getTableInfoAnnouncements(), filter, null).getObject(AnnouncementModel.class);
129+
return new TableSelector(_comm.getTableInfoAnnouncements(), filter, null).getObject(AnnouncementFullModel.class);
130130
}
131131

132-
public static @Nullable AnnouncementModel getAnnouncement(@Nullable Container c, long rowId)
132+
public static @Nullable AnnouncementFullModel getAnnouncement(@Nullable Container c, long rowId)
133133
{
134134
return getAnnouncement(c, new SimpleFilter(FieldKey.fromParts("RowId"), rowId));
135135
}
136136

137-
public static @Nullable AnnouncementModel getAnnouncement(@Nullable Container c, String entityId)
137+
public static @Nullable AnnouncementFullModel getAnnouncement(@Nullable Container c, String entityId)
138138
{
139139
try
140140
{
@@ -522,7 +522,7 @@ private static AnnouncementModel validateModelWithSideEffects(AnnouncementModel
522522
}
523523

524524
// Magic date value used to mark an announcement that a moderator has reviewed and marked as spam
525-
private static final Date SPAM_MAGIC_DATE = new Date(0);
525+
static final Date SPAM_MAGIC_DATE = new Date(0);
526526

527527
// Standard filters for retrieving specific classes of messages (approved, spam, needs review)
528528
public static final SimpleFilter IS_APPROVED_FILTER = new SimpleFilter(FieldKey.fromParts("Approved"), AnnouncementManager.SPAM_MAGIC_DATE, CompareType.GT);
@@ -534,11 +534,6 @@ public static void markAsSpam(Container c, AnnouncementModel ann)
534534
updateApproved(c, ann, SPAM_MAGIC_DATE);
535535
}
536536

537-
public static boolean isSpam(AnnouncementModel ann)
538-
{
539-
return SPAM_MAGIC_DATE.equals(ann.getApproved());
540-
}
541-
542537
// Execute direct SQL (not Table.update())... I don't think we want to change Modified or ModifiedBy. Could consider adding column for Moderator, though.
543538
// Returns true if an update was made, false if not (e.g., message was already reviewed).
544539
private static boolean updateApproved(Container c, AnnouncementModel ann, Date date)

announcements/src/org/labkey/announcements/model/AnnouncementModel.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public class AnnouncementModel extends Entity implements Serializable
8080

8181
private Collection<AnnouncementModel> _responses = null;
8282
private Set<User> _authors;
83-
private Date _approved = null;
8483

8584
/**
8685
* Standard constructor.
@@ -418,21 +417,5 @@ public AttachmentParent getAttachmentParent()
418417
{
419418
return new AnnouncementAttachmentParent(this);
420419
}
421-
422-
public Date getApproved()
423-
{
424-
return _approved;
425-
}
426-
427-
public void setApproved(Date approved)
428-
{
429-
_approved = approved;
430-
}
431-
432-
@JsonIgnore
433-
public boolean isSpam()
434-
{
435-
return AnnouncementManager.isSpam(this);
436-
}
437420
}
438421

api/src/org/labkey/api/action/ApiJsonWriter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,9 @@ public void testExceptionNotCommitted() throws IOException
485485
var responseText = ((MockHttpServletResponse)writer.getResponse()).getContentAsString();
486486
var json = new JSONObject(responseText);
487487
assertEquals("throwing up", json.getString("exception"));
488-
assertTrue(json.has("stackTrace"));
488+
assertFalse(json.getBoolean("success"));
489+
assertEquals("java.lang.IllegalStateException", json.get("exceptionClass"));
490+
assertFalse(json.has("stackTrace"));
489491
assertFalse(json.has("schemaName"));
490492
}
491493

api/src/org/labkey/api/action/ApiResponseWriter.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,6 @@ public JSONObject toJSON(Throwable e)
453453
JSONObject json = new JSONObject();
454454
json.put("exception", e.getMessage() != null ? e.getMessage() : e.getClass().getName());
455455
json.put("exceptionClass", e.getClass().getName());
456-
json.put("stackTrace", e.getStackTrace());
457456
return json;
458457
}
459458

api/src/org/labkey/api/assay/AssayUrls.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ public interface AssayUrls extends UrlProvider
6161

6262
ActionURL getChooseCopyDestinationURL(ExpProtocol protocol, Container container);
6363

64-
ActionURL getDeleteDesignURL(ExpProtocol protocol);
65-
6664
/**
6765
* Returns the URL for the assay import data wizard for an existing assay definition.
6866
* path and files may be null, in which case it is assumed that the POST will include data object RowIds

api/src/org/labkey/api/assay/actions/AssayHeaderView.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,6 @@ public List<NavTree> getLinks()
9494
return links;
9595
}
9696

97-
public static String getDeleteOnClick(ExpProtocol protocol, Container currentContainer)
98-
{
99-
ActionURL deleteURL = PageFlowUtil.urlProvider(AssayUrls.class).getDeleteDesignURL(protocol);
100-
String extraWarning = "";
101-
if (!protocol.getContainer().equals(currentContainer))
102-
{
103-
extraWarning = " It is defined in " + protocol.getContainer().getPath() + " and deleting it will remove it from all subfolders.";
104-
}
105-
return "if (window.confirm('Are you sure you want to delete this assay design and all of its runs?" + extraWarning + "')) { window.location = '" + deleteURL + "' }";
106-
}
107-
10897
public ExpProtocol getProtocol()
10998
{
11099
return _protocol;

api/src/org/labkey/api/data/AbstractParticipantCategory.java

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616
package org.labkey.api.data;
1717

18+
import org.jetbrains.annotations.NotNull;
1819
import org.json.JSONArray;
1920
import org.json.JSONObject;
2021
import org.labkey.api.query.SimpleValidationError;
@@ -226,15 +227,11 @@ public boolean canEdit(Container container, User user, List<ValidationError> err
226227
{
227228
if (isNew())
228229
return true;
229-
else
230-
{
231-
User owner = UserManager.getUser(getCreatedBy());
232-
boolean allowed = (owner != null && !owner.isGuest()) ? owner.equals(user) : false;
233230

234-
if (!allowed)
235-
errors.add(new SimpleValidationError("You must be the owner to unshare this participant category"));
236-
}
231+
if (!isOwner(user))
232+
errors.add(new SimpleValidationError("You must be the owner to unshare this participant category"));
237233
}
234+
238235
return errors.isEmpty();
239236
}
240237

@@ -254,44 +251,28 @@ public boolean canDelete(Container container, User user, List<ValidationError> e
254251
{
255252
if (isNew())
256253
return true;
257-
else
258-
{
259-
User owner = UserManager.getUser(getCreatedBy());
260-
boolean allowed = (owner != null && !owner.isGuest()) ? owner.equals(user) : false;
261254

262-
if (!allowed)
263-
errors.add(new SimpleValidationError("You must be the owner to delete this participant category"));
264-
}
255+
if (!isOwner(user))
256+
errors.add(new SimpleValidationError("You must be the owner to delete this participant category"));
265257
}
258+
266259
return errors.isEmpty();
267260
}
268261

269-
public boolean canRead(Container c, User user)
262+
public boolean canRead(@NotNull User user)
270263
{
271-
return canRead(c, user, new ArrayList<>());
264+
if (isShared() || isNew())
265+
return true;
266+
267+
// Issue 16645: Do not show participant groups that may have been created by guests, which was possible
268+
// before this bug was fixed. When admins can update and delete private groups, we can make
269+
// guest-created groups visible again.
270+
return isOwner(user);
272271
}
273272

274-
public boolean canRead(Container c, User user, List<ValidationError> errors)
273+
private boolean isOwner(@NotNull User user)
275274
{
276-
if (!isShared())
277-
{
278-
if (isNew())
279-
return true;
280-
else
281-
{
282-
// issue 16645 : don't show participant groups that may have been created by guests, which was possible
283-
// before this bug was fixed. When admins have the ability to update and delete private groups we can
284-
// make guest created groups visible again.
285-
User owner = UserManager.getUser(getCreatedBy());
286-
boolean allowed = (owner != null && !owner.isGuest()) ? owner.equals(user) : false;
287-
288-
if (!allowed)
289-
{
290-
errors.add(new SimpleValidationError("You don't have permission to read this private participant category"));
291-
return false;
292-
}
293-
}
294-
}
295-
return true;
275+
User owner = UserManager.getUser(getCreatedBy());
276+
return owner != null && !owner.isGuest() && owner.equals(user);
296277
}
297278
}

0 commit comments

Comments
 (0)