Skip to content

Commit c028784

Browse files
committed
Bugfix to MCC notification
1 parent 5b84fa5 commit c028784

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

mcc/src/org/labkey/mcc/notification/MCCDataNotification.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import org.labkey.api.module.Module;
1010
import org.labkey.api.query.FieldKey;
1111
import org.labkey.api.security.User;
12+
import org.labkey.api.security.permissions.ReadPermission;
13+
import org.labkey.api.view.UnauthorizedException;
14+
import org.labkey.mcc.MccManager;
1215

1316
import java.util.Date;
1417
import java.util.HashMap;
@@ -68,9 +71,15 @@ public String getMessageBodyHTML(Container c, User u)
6871
StringBuilder msg = new StringBuilder();
6972
Date now = new Date();
7073

71-
doParentSexCheck(c, u, msg);
72-
doU24AssignedCheck(c, u , msg);
73-
doMissingIdCheck(c, u, msg);
74+
Container mccData = MccManager.get().getMCCContainer(c);
75+
if (!mccData.hasPermission(u, ReadPermission.class))
76+
{
77+
throw new UnauthorizedException("User does not have read permission on folder: " + mccData.getPath());
78+
}
79+
80+
doParentSexCheck(mccData, u, msg);
81+
doU24AssignedCheck(mccData, u , msg);
82+
doMissingIdCheck(mccData, u, msg);
7483

7584
//since we dont want to trigger an email if there's no alerts, conditionally append the title
7685
if (msg.length() > 0)
@@ -83,7 +92,7 @@ public String getMessageBodyHTML(Container c, User u)
8392

8493
protected void doMissingIdCheck(final Container c, User u, final StringBuilder msg)
8594
{
86-
TableInfo ti = getStudySchema(c, u).getTable("aggregatedDemographics");
95+
TableInfo ti = getUserSchemaByName(c, u, "mcc").getTable("aggregatedDemographics");
8796

8897
SimpleFilter filter = new SimpleFilter(FieldKey.fromString("Id"), null, CompareType.ISBLANK);
8998
TableSelector ts = new TableSelector(ti, filter, null);

0 commit comments

Comments
 (0)