Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DCM-55: Add user privileges to Automation UI and Run Reports UI #48

Merged
merged 1 commit into from Aug 7, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion omod/src/main/resources/config.xml
Expand Up @@ -121,7 +121,7 @@
<description>Base privilege for running the reports</description>
</privilege>
<privilege>
<name>Run failed data</name>
<name>Run Failed Data</name>
<description>Base privilege for pushing the failed data</description>
</privilege>
<privilege>
Expand Down
67 changes: 45 additions & 22 deletions omod/src/main/webapp/automation.jsp
@@ -1,5 +1,7 @@
<%@ include file="/WEB-INF/template/include.jsp" %>
<%@ include file="/WEB-INF/template/header.jsp" %>
<openmrs:require anyPrivilege="View Automation,Run Automation,Manage Automation" otherwise="/login.htm"
redirect="/module/dhisconnector/automation.form"/>

<%@ include file="template/localHeader.jsp" %>

Expand All @@ -12,45 +14,66 @@
<spring:message code="dhisconnector.automation.description"/>
<form method="post">
<br />
<input type="checkbox" name="toogleAutomation" <c:if test="${automationEnabled}">checked="checked"</c:if>><spring:message code="dhisconnector.automation.toggleAutomation"/></input>
<br />
<input type="checkbox" name="toogleAutomation" <c:if test="${automationEnabled}">checked="checked"</c:if>
<openmrs:hasPrivilege privilege="Manage Automation" inverse="true">disabled</openmrs:hasPrivilege>>
<spring:message code="dhisconnector.automation.toggleAutomation"/>
</input>
<br />
<br />
<spring:message code="dhisconnector.automation.periodTypeMessage"/>
<br />
<table>
<thead>
<tr>
<th><spring:message code="dhisconnector.automation.delete"/></th>
<th><spring:message code="dhisconnector.automation.run"/></th>
<openmrs:hasPrivilege privilege="Manage Automation">
<th><spring:message code="dhisconnector.automation.delete"/></th>
</openmrs:hasPrivilege>
<openmrs:hasPrivilege privilege="Run Automation">
<th><spring:message code="dhisconnector.automation.run"/></th>
</openmrs:hasPrivilege>
<th><spring:message code="dhisconnector.automation.mapping"/></th>
<th><spring:message code="dhisconnector.automation.reRun"/></th>
<openmrs:hasPrivilege privilege="Run Automation">
<th><spring:message code="dhisconnector.automation.reRun"/></th>
</openmrs:hasPrivilege>
</tr>
</thead>
<tbody>
<tr class="evenRow">
<td><spring:message code="dhisconnector.automation.add"/></td>
<td><spring:message code="dhisconnector.automation.new"/></td>
<td>
<select name="mapping">
<option></option>
<c:forEach items="${mappings}" var="mapping">
<option value="${mapping.name}.${mapping.created}">${mapping.name}</option>
</c:forEach>
</select>
</td>
<td></td>
</tr>
<openmrs:hasPrivilege privilege="Manage Automation">
<tr class="evenRow">
<td><spring:message code="dhisconnector.automation.add"/></td>
<openmrs:hasPrivilege privilege="Run Automation">
<td><spring:message code="dhisconnector.automation.new"/></td>
</openmrs:hasPrivilege>
<td>
<select name="mapping">
<option></option>
<c:forEach items="${mappings}" var="mapping">
<option value="${mapping.name}.${mapping.created}">${mapping.name}</option>
</c:forEach>
</select>
</td>
<td></td>
</tr>
</openmrs:hasPrivilege>
<c:forEach items="${reportToDataSetMappings}" var="mpg">
<tr class="evenRow">
<td><input type="checkbox" name="mappingIds" value="${mpg.id}"/></td>
<td><input type="checkbox" name="runs" value="${mpg.uuid}"/></td>
<openmrs:hasPrivilege privilege="Manage Automation">
<td><input type="checkbox" name="mappingIds" value="${mpg.id}"/></td>
</openmrs:hasPrivilege>
<openmrs:hasPrivilege privilege="Run Automation">
<td><input type="checkbox" name="runs" value="${mpg.uuid}"/></td>
</openmrs:hasPrivilege>
<td>${fn:substringBefore(mpg.mapping, '.')}</td>
<td><c:if test="${not empty mpg.lastRun}"><input type="checkbox" name="reRuns" value="${mpg.uuid}"/></c:if> ${mpg.lastRun}</td>
<openmrs:hasPrivilege privilege="Run Automation">
<td><c:if test="${not empty mpg.lastRun}"><input type="checkbox" name="reRuns" value="${mpg.uuid}"/></c:if> ${mpg.lastRun}</td>
</openmrs:hasPrivilege>
</tr>
</c:forEach>
</tbody>
</table>
<input type="submit" value="<spring:message code='dhisconnector.automation.submit'/>">
<openmrs:hasPrivilege privilege="Run Automation,Manage Automation">
<input type="submit" value="<spring:message code='dhisconnector.automation.submit'/>">
</openmrs:hasPrivilege>
</form>

<c:forEach items="${postResponse}" var="resp">
Expand Down
2 changes: 2 additions & 0 deletions omod/src/main/webapp/failedData.jsp
@@ -1,5 +1,7 @@
<%@ include file="/WEB-INF/template/include.jsp" %>
<%@ include file="/WEB-INF/template/header.jsp" %>
<openmrs:require privilege="Run Failed Data" otherwise="/login.htm"
redirect="/module/dhisconnector/failedData.form"/>
<%@ include file="template/localHeader.jsp" %>

<c:if test="${showLogin == 'true'}">
Expand Down
2 changes: 2 additions & 0 deletions omod/src/main/webapp/runReports.jsp
@@ -1,5 +1,7 @@
<%@ include file="/WEB-INF/template/include.jsp" %>
<%@ include file="/WEB-INF/template/header.jsp" %>
<openmrs:require privilege="Run Reports" otherwise="/login.htm"
redirect="/module/dhisconnector/runReports.form"/>

<openmrs:htmlInclude file="/moduleResources/dhisconnector/dhisconnector.css"/>
<openmrs:htmlInclude file="/moduleResources/dhisconnector/dhisconnector-runreports.js"/>
Expand Down
41 changes: 22 additions & 19 deletions omod/src/main/webapp/template/localHeader.jsp
Expand Up @@ -19,12 +19,13 @@
</li>
</openmrs:hasPrivilege>

<li
<c:if test='<%= request.getRequestURI().contains("/automation") %>'>class="active"</c:if>>
<a
href="${pageContext.request.contextPath}/module/dhisconnector/automation.form"><spring:message
code="dhisconnector.automation" /></a>
</li>
<openmrs:hasPrivilege privilege="View Automation,Run Automation,Manage Automation">
<li <c:if test='<%= request.getRequestURI().contains("/automation") %>'>class="active"</c:if>>
<a href="${pageContext.request.contextPath}/module/dhisconnector/automation.form">
<spring:message code="dhisconnector.automation" />
</a>
</li>
</openmrs:hasPrivilege>

<li
<c:if test='<%= request.getRequestURI().contains("/dhis2BackupImport") %>'>class="active"</c:if>>
Expand Down Expand Up @@ -53,20 +54,22 @@
href="${pageContext.request.contextPath}/module/dhisconnector/manageMappings.form"><spring:message
code="dhisconnector.manageMappings" /></a>
</li>

<li
<c:if test='<%= request.getRequestURI().contains("/runReports") %>'>class="active"</c:if>>
<a
href="${pageContext.request.contextPath}/module/dhisconnector/runReports.form"><spring:message
code="dhisconnector.runReports" /></a>
</li>

<li
<c:if test='<%= request.getRequestURI().contains("/failedData") %>'>class="active"</c:if>>
<a
href="${pageContext.request.contextPath}/module/dhisconnector/failedData.form"><spring:message
code="dhisconnector.failedData" /></a>
</li>
<openmrs:hasPrivilege privilege="Run Reports">
<li <c:if test='<%= request.getRequestURI().contains("/runReports") %>'>class="active"</c:if>>
<a href="${pageContext.request.contextPath}/module/dhisconnector/runReports.form">
<spring:message code="dhisconnector.runReports" />
</a>
</li>
</openmrs:hasPrivilege>

<openmrs:hasPrivilege privilege="Run Failed Data">
<li <c:if test='<%= request.getRequestURI().contains("/failedData") %>'>class="active"</c:if>>
<a href="${pageContext.request.contextPath}/module/dhisconnector/failedData.form">
<spring:message code="dhisconnector.failedData" />
</a>
</li>
</openmrs:hasPrivilege>

<!-- Add further links here -->
</ul>
Expand Down