Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,17 @@ protected String getJsHandler(TableInfo ti)
@Override
public boolean isAvailable(TableInfo ti)
{
return _owner == null || ti.getUserSchema().getContainer().getActiveModules().contains(_owner);
if (_owner != null && !ti.getUserSchema().getContainer().getActiveModules().contains(_owner))
{
return false;
}

if (_permission != null && !ti.getUserSchema().getContainer().hasPermission(ti.getUserSchema().getUser(), _permission))
{
return false;
}

return true;
}

@Override
Expand Down
5 changes: 5 additions & 0 deletions LDK/src/org/labkey/ldk/query/DefaultTableCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,11 @@ private static boolean configureMoreActionsBtn(TableInfo ti, List<ButtonConfigFa
for (ButtonConfigFactory fact : buttons)
{
NavTree newButton = fact.create(ti);
if (!fact.isAvailable(ti) || !fact.isVisible(ti))
{
continue;
}

if (!btnNameMap.containsKey(newButton.getText()))
{
btnNameMap.put(newButton.getText(), newButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ public void testSteps() throws Exception
urlGenerationTest();
peptideTableTest();
searchPanelTest();

testButtonPermissions();
}

protected void setUpTest() throws Exception
Expand Down Expand Up @@ -1877,4 +1879,25 @@ public void checkViews()
//the module contains an R report tied to a specific assay name, so view check fails when an assay of that name isnt present
//when module-based assays can supply reports this should be corrected
}

protected void testButtonPermissions() throws Exception
{
goToProjectHome();
_helper.clickNavPanelItem("Samples:", "Browse All");

DataRegionTable dr = new DataRegionTable("query", this);
dr.checkAllOnPage();

dr.clickHeaderButton("More Actions");
assertElementPresent(Locator.tagWithText("a", "Bulk Edit"));

impersonateRole("Editor");
refresh();

dr = new DataRegionTable("query", this);
dr.checkAllOnPage();

dr.clickHeaderButton("More Actions");
assertElementNotPresent(Locator.tagWithText("a", "Bulk Edit"));
}
}