Skip to content

Commit 7bb1ef1

Browse files
committed
Bugfix to MCC RequestUtils.tsx, primarily exposed during testing when switching roles
1 parent a3dd846 commit 7bb1ef1

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

mcc/src/client/components/RequestUtils.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ export class AnimalCohort {
7878
uuid: string = uuidv4().toUpperCase();
7979
}
8080

81-
function hasAnimalDataReadPermission() {
81+
function canReadMccStudy() {
8282
const ctx = getServerContext().getModuleContext('mcc') || {};
8383

84-
return !!ctx.hasAnimalDataReadPermission
84+
return !!ctx.hasAnimalDataReadPermission && !!ctx.hasMccStudyReadPermission
8585
}
8686

8787
function getMccDataContainerPath() {
@@ -214,7 +214,7 @@ export async function queryRequestInformation(requestId, handleFailure) {
214214
})
215215
})]
216216

217-
if (hasAnimalDataReadPermission()) {
217+
if (canReadMccStudy()) {
218218
promises.push(new Promise<any>((resolve, reject) => {
219219
Query.selectRows({
220220
containerPath: getMccDataContainerPath(),

mcc/src/org/labkey/mcc/MccModule.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import org.labkey.api.query.QuerySchema;
3232
import org.labkey.api.security.permissions.ReadPermission;
3333
import org.labkey.api.security.roles.RoleManager;
34+
import org.labkey.api.study.Study;
35+
import org.labkey.api.study.StudyService;
3436
import org.labkey.api.util.SystemMaintenance;
3537
import org.labkey.api.view.WebPartFactory;
3638
import org.labkey.api.view.template.ClientDependency;
@@ -112,6 +114,14 @@ public JSONObject getPageContextJson(ContainerUser context)
112114

113115
Container dataContainer = MccManager.get().getMCCContainer(context.getContainer());
114116
ret.put("hasAnimalDataReadPermission", dataContainer != null && dataContainer.hasPermission(context.getUser(), ReadPermission.class));
117+
if (dataContainer != null)
118+
{
119+
Study s = StudyService.get().getStudy(dataContainer);
120+
if (s != null)
121+
{
122+
ret.put("hasMccStudyReadPermission", s.hasPermission(context.getUser(), ReadPermission.class));
123+
}
124+
}
115125

116126
return ret;
117127
}

0 commit comments

Comments
 (0)