wip mifosx-195 reports UI
This commit is contained in:
+18
-14
@@ -504,13 +504,13 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
|||||||
|
|
||||||
ReportParameterJoinMapper rm = new ReportParameterJoinMapper();
|
ReportParameterJoinMapper rm = new ReportParameterJoinMapper();
|
||||||
|
|
||||||
String sql = rm.schema(context.authenticatedUser().getId(), id);
|
String sql = rm.schema(id);
|
||||||
|
|
||||||
Collection<ReportParameterJoinData> rpJoins = this.jdbcTemplate.query(
|
Collection<ReportParameterJoinData> rpJoins = this.jdbcTemplate.query(
|
||||||
sql, rm, new Object[] {});
|
sql, rm, new Object[] {});
|
||||||
|
|
||||||
Collection<ReportData> reportList = new ArrayList<ReportData>();
|
Collection<ReportData> reportList = new ArrayList<ReportData>();
|
||||||
if (rpJoins == null)
|
if (rpJoins == null || rpJoins.size() == 0)
|
||||||
return reportList;
|
return reportList;
|
||||||
|
|
||||||
Collection<ReportParameterData> reportParameters = null;
|
Collection<ReportParameterData> reportParameters = null;
|
||||||
@@ -582,7 +582,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
|||||||
private static final class ReportParameterJoinMapper implements
|
private static final class ReportParameterJoinMapper implements
|
||||||
RowMapper<ReportParameterJoinData> {
|
RowMapper<ReportParameterJoinData> {
|
||||||
|
|
||||||
public String schema(Long userId, Long reportId) {
|
public String schema(Long reportId) {
|
||||||
|
|
||||||
String sql = "select r.id as reportId, r.report_name as reportName, r.report_type as reportType, "
|
String sql = "select r.id as reportId, r.report_name as reportName, r.report_type as reportType, "
|
||||||
+ " r.report_subtype as reportSubType, r.report_category as reportCategory, r.description, r.core_report as coreReport, r.use_report as useReport, "
|
+ " r.report_subtype as reportSubType, r.report_category as reportCategory, r.description, r.core_report as coreReport, r.use_report as useReport, "
|
||||||
@@ -593,22 +593,26 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
|||||||
|
|
||||||
sql += " from stretchy_report r"
|
sql += " from stretchy_report r"
|
||||||
+ " left join stretchy_report_parameter rp on rp.report_id = r.id"
|
+ " left join stretchy_report_parameter rp on rp.report_id = r.id"
|
||||||
+ " left join stretchy_parameter p on p.id = rp.parameter_id"
|
+ " left join stretchy_parameter p on p.id = rp.parameter_id";
|
||||||
+ " where exists"
|
|
||||||
+ " (select 'f'"
|
|
||||||
+ " from m_appuser_role ur "
|
|
||||||
+ " join m_role r on r.id = ur.role_id"
|
|
||||||
+ " left join m_role_permission rp on rp.role_id = r.id"
|
|
||||||
+ " left join m_permission p on p.id = rp.permission_id"
|
|
||||||
+ " where ur.appuser_id = "
|
|
||||||
+ userId
|
|
||||||
+ " and (p.code in ('ALL_FUNCTIONS', 'ALL_FUNCTIONS_READ') or p.code = concat('READ_', r.report_name))) ";
|
|
||||||
if (reportId != null)
|
if (reportId != null)
|
||||||
sql += " and r.id = " + reportId;
|
sql += " where r.id = " + reportId;
|
||||||
else
|
else
|
||||||
sql += " order by r.id, rp.parameter_id";
|
sql += " order by r.id, rp.parameter_id";
|
||||||
|
|
||||||
return sql;
|
return sql;
|
||||||
|
|
||||||
|
/* used to only return reports that the use can run as done in report UI but not necessary as there is a read_report permission
|
||||||
|
* which should give user access to look all reports
|
||||||
|
+ " where exists"
|
||||||
|
+ " (select 'f'"
|
||||||
|
+ " from m_appuser_role ur "
|
||||||
|
+ " join m_role r on r.id = ur.role_id"
|
||||||
|
+ " left join m_role_permission rp on rp.role_id = r.id"
|
||||||
|
+ " left join m_permission p on p.id = rp.permission_id"
|
||||||
|
+ " where ur.appuser_id = "
|
||||||
|
+ userId
|
||||||
|
+ " and (p.code in ('ALL_FUNCTIONS', 'ALL_FUNCTIONS_READ') or p.code = concat('READ_', r.report_name))) ";
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user