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
3 changes: 2 additions & 1 deletion query/src/org/labkey/query/controllers/InternalViewForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public static void checkEdit(ViewContext context, CstmView view)
}
else
{
if (view.getCustomViewOwner().intValue() != context.getUser().getUserId())
// must be owner or site admin
if (!context.getUser().hasSiteAdminPermission() && view.getCustomViewOwner().intValue() != context.getUser().getUserId())
{
throw new UnauthorizedException();
}
Expand Down
37 changes: 21 additions & 16 deletions query/src/org/labkey/query/view/manageViews.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,16 @@
QueryManager mgr = QueryManager.get();
List<CstmView> views = new ArrayList<>();

if (getViewContext().hasPermission(UpdatePermission.class))
if (getViewContext().getUser().hasSiteAdminPermission())
{
views.addAll(mgr.getCstmViews(c, schemaName, queryName, null, null, false, true));
views.addAll(mgr.getCstmViews(c, schemaName, queryName, null, null, false, false));
}

if (!user.isGuest())
else
{
views.addAll(mgr.getCstmViews(c, schemaName, queryName, null, user, false, false));
if (getViewContext().hasPermission(UpdatePermission.class))
views.addAll(mgr.getCstmViews(c, schemaName, queryName, null, null, false, true));
if (!user.isGuest())
views.addAll(mgr.getCstmViews(c, schemaName, queryName, null, user, false, false));
}

// UNDONE: Requires queryName and schemaName for now. We need a method to get all session views in a container.
Expand Down Expand Up @@ -107,22 +109,25 @@
<% } %>
</p>

<table>
<table class="labkey-data-region-legacy labkey-show-borders">
<tr>
<th>Schema</th>
<th>Query</th>
<th>View Name</th>
<th>Flags</th>
<th>Owner</th>
<th>Created</th>
<th>Created&nbsp;By</th>
<th>Modified</th>
<th>Modified&nbsp;By</th>
<td class="labkey-column-header">Schema</td>
<td class="labkey-column-header">Query</td>
<td class="labkey-column-header">View Name</td>
<td class="labkey-column-header">Flags</td>
<td class="labkey-column-header">Owner</td>
<td class="labkey-column-header">Created</td>
<td class="labkey-column-header">Created By</td>
<td class="labkey-column-header">Modified</td>
<td class="labkey-column-header">Modified By</td>
<td class="labkey-column-header"></td>
</tr>
<% if (getViewContext().hasPermission(UpdatePermission.class))
{
int count = 1;
for (CstmView view : views)
{
count++;
List<String> flags = new ArrayList<>();
if (view.getCustomViewId() == 0)
flags.add("<em>session</em>");
Expand All @@ -133,7 +138,7 @@
if (mgr.isSnapshot(view.getFlags()))
flags.add("shapshot");
%>
<tr>
<tr class="<%=getShadeRowClass(count)%>">
<td><%=h(view.getSchema())%>
</td>
<td><%=h(view.getQueryName())%>
Expand Down