mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-01 19:25:56 +00:00
implemented the idpc compliance section
This commit is contained in:
parent
75b4d10526
commit
f44f5d339c
@ -20,7 +20,7 @@ from wherehows.common import Constant
|
||||
|
||||
class ConfidentialFieldLoad:
|
||||
|
||||
confidential_field_names = ["member_id", "memberid", "firstname", "first_name", "lastname", "last_name",
|
||||
confidential_field_names = ["firstname", "first_name", "lastname", "last_name",
|
||||
"email", "email_address", "emailaddress", "address", "birthday", "birth_day",
|
||||
"birthdate", "birth_date", "birth_month", "birthmonth", "birthyear", "birth_year", "ssn"]
|
||||
def __init__(self):
|
||||
|
||||
@ -46,6 +46,11 @@ public class Dashboard extends Controller
|
||||
return ok(DashboardDAO.getDescriptionPercentageByManagerId(managerId));
|
||||
}
|
||||
|
||||
public static Result getIdpcComplianceDatasetsPercentage(String managerId)
|
||||
{
|
||||
return ok(DashboardDAO.getIdpcCompliancePercentageByManagerId(managerId));
|
||||
}
|
||||
|
||||
public static Result getPagedOwnershipDatasets(String managerId)
|
||||
{
|
||||
int page = 1;
|
||||
@ -213,6 +218,51 @@ public class Dashboard extends Controller
|
||||
return ok(DashboardDAO.getPagedDescriptionDatasetsByManagerId(managerId, option, page, size));
|
||||
}
|
||||
|
||||
public static Result getPagedComplianceDatasets(String managerId)
|
||||
{
|
||||
int page = 1;
|
||||
String pageStr = request().getQueryString("page");
|
||||
if (StringUtils.isBlank(pageStr))
|
||||
{
|
||||
page = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
page = Integer.parseInt(pageStr);
|
||||
}
|
||||
catch(NumberFormatException e)
|
||||
{
|
||||
Logger.error("Dashboard Controller getPagedComplianceDatasets wrong page parameter. Error message: " + e.getMessage());
|
||||
page = 1;
|
||||
}
|
||||
}
|
||||
|
||||
String option = request().getQueryString("option");
|
||||
|
||||
int size = 10;
|
||||
String sizeStr = request().getQueryString("size");
|
||||
if (StringUtils.isBlank(sizeStr))
|
||||
{
|
||||
size = 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
size = Integer.parseInt(sizeStr);
|
||||
}
|
||||
catch(NumberFormatException e)
|
||||
{
|
||||
Logger.error("Dashboard Controller getPagedComplianceDatasets wrong size parameter. Error message: " + e.getMessage());
|
||||
size = 10;
|
||||
}
|
||||
}
|
||||
|
||||
return ok(DashboardDAO.getPagedComplianceDatasetsByManagerId(managerId, option, page, size));
|
||||
}
|
||||
|
||||
public static Result getOwnershipBarData(String managerId)
|
||||
{
|
||||
return ok(DashboardDAO.getOwnershipBarChartData(managerId));
|
||||
|
||||
@ -44,12 +44,15 @@ public class DashboardDAO extends AbstractMySQLOpenSourceDAO
|
||||
|
||||
private final static String GET_OWNERSHIP_CONFIRMED_DATASETS = "SELECT SQL_CALC_FOUND_ROWS o.dataset_id, " +
|
||||
"GROUP_CONCAT(o.owner_id ORDER BY o.owner_id ASC SEPARATOR ',') as owner_id, " +
|
||||
"GROUP_CONCAT(CASE WHEN o.confirmed_by is not null THEN o.confirmed_by ELSE null END " +
|
||||
"GROUP_CONCAT(CASE WHEN o.confirmed_by is not null and o.confirmed_by != '' THEN o.confirmed_by " +
|
||||
"ELSE null END " +
|
||||
"ORDER BY o.confirmed_by ASC SEPARATOR ',') as confirmed_owner_id, d.name " +
|
||||
"FROM dataset_owner o " +
|
||||
"JOIN dict_dataset d ON o.dataset_id = d.id " +
|
||||
"WHERE o.dataset_id in " +
|
||||
"(SELECT DISTINCT dataset_id FROM dataset_owner WHERE confirmed_by is not null) and o.owner_id in ( " +
|
||||
"(SELECT DISTINCT dataset_id FROM dataset_owner " +
|
||||
"WHERE confirmed_by is not null and confirmed_by != '' and ( is_deleted != 'Y' or is_deleted is null )) " +
|
||||
"and o.owner_id in ( " +
|
||||
"SELECT user_id FROM dir_external_user_info WHERE org_hierarchy = ? or org_hierarchy like ?) " +
|
||||
"GROUP BY o.dataset_id, d.name ORDER BY d.name LIMIT ?, ?";
|
||||
|
||||
@ -70,7 +73,8 @@ public class DashboardDAO extends AbstractMySQLOpenSourceDAO
|
||||
"ORDER BY o.confirmed_by ASC SEPARATOR ',') as confirmed_owner_id, d.name " +
|
||||
"FROM dataset_owner o " +
|
||||
"JOIN dict_dataset d ON o.dataset_id = d.id and ( o.is_deleted != 'Y' or o.is_deleted is null ) " +
|
||||
"WHERE o.dataset_id not in (SELECT DISTINCT dataset_id FROM dataset_owner WHERE confirmed_by is not null)" +
|
||||
"WHERE o.dataset_id not in (SELECT DISTINCT dataset_id FROM dataset_owner " +
|
||||
"WHERE confirmed_by is not null and confirmed_by != '' and ( is_deleted != 'Y' or is_deleted is null ))" +
|
||||
" and o.owner_id in ( " +
|
||||
"SELECT user_id FROM dir_external_user_info WHERE org_hierarchy = ? or org_hierarchy like ?) " +
|
||||
"GROUP BY o.dataset_id, d.name ORDER BY d.name LIMIT ?, ?";
|
||||
@ -91,6 +95,23 @@ public class DashboardDAO extends AbstractMySQLOpenSourceDAO
|
||||
"SELECT user_id FROM dir_external_user_info WHERE org_hierarchy = ? or org_hierarchy like ?) " +
|
||||
"GROUP BY o.dataset_id, d.name ORDER BY d.name LIMIT ?, ?";
|
||||
|
||||
private final static String GET_DATASETS_NO_DESCRIPTION_BY_ID = "SELECT SQL_CALC_FOUND_ROWS o.dataset_id, " +
|
||||
"GROUP_CONCAT(o.owner_id ORDER BY o.owner_id ASC SEPARATOR ',') as owner_id, d.name FROM " +
|
||||
"dataset_owner o JOIN dict_dataset d ON o.dataset_id = d.id and " +
|
||||
"( o.is_deleted != 'Y' or o.is_deleted is null ) " +
|
||||
"WHERE o.dataset_id not in ( SELECT DISTINCT dataset_id FROM comments ) and owner_id in ( " +
|
||||
"SELECT user_id FROM dir_external_user_info WHERE org_hierarchy = ? or org_hierarchy like ?) " +
|
||||
"GROUP BY o.dataset_id, d.name ORDER BY d.name LIMIT ?, ?";
|
||||
|
||||
private final static String GET_DATASETS_WITH_IDPC_COMPLIANCE_BY_ID = "SELECT SQL_CALC_FOUND_ROWS o.dataset_id, " +
|
||||
"GROUP_CONCAT(o.owner_id ORDER BY o.owner_id ASC SEPARATOR ',') as owner_id, d.name FROM " +
|
||||
"dataset_owner o JOIN dict_dataset d ON o.dataset_id = d.id and " +
|
||||
"( o.is_deleted != 'Y' or o.is_deleted is null ) " +
|
||||
"WHERE o.dataset_id in ( SELECT DISTINCT dataset_id FROM dataset_security WHERE compliance_type = ? ) " +
|
||||
"and owner_id in ( " +
|
||||
"SELECT user_id FROM dir_external_user_info WHERE org_hierarchy = ? or org_hierarchy like ?) " +
|
||||
"GROUP BY o.dataset_id, d.name ORDER BY d.name LIMIT ?, ?";
|
||||
|
||||
private final static String GET_DATASETS_WITH_FULL_FIELD_DESCRIPTION_BY_ID = "SELECT SQL_CALC_FOUND_ROWS " +
|
||||
"o.dataset_id, GROUP_CONCAT(o.owner_id ORDER BY o.owner_id ASC SEPARATOR ',') as owner_id, d.name FROM " +
|
||||
"dataset_owner o JOIN dict_dataset d ON o.dataset_id = d.id and " +
|
||||
@ -140,16 +161,28 @@ public class DashboardDAO extends AbstractMySQLOpenSourceDAO
|
||||
"WHERE o.dataset_id in ( SELECT DISTINCT dataset_id from comments ) and owner_id in ( " +
|
||||
"SELECT user_id FROM dir_external_user_info WHERE org_hierarchy = ? or org_hierarchy like ?)";
|
||||
|
||||
private final static String GET_COUNT_OF_DATASET_WITH_CONFIRMED_OWNER = "SELECT count(DISTINCT o.dataset_id) " +
|
||||
private final static String GET_COUNT_OF_DATASET_WITH_IDPC_PURGE = "SELECT count(DISTINCT o.dataset_id) " +
|
||||
"as count FROM dataset_owner o JOIN dict_dataset d ON o.dataset_id = d.id and " +
|
||||
"( o.is_deleted != 'Y' or o.is_deleted is null ) " +
|
||||
"WHERE o.confirmed_by is not null and owner_id in ( " +
|
||||
"WHERE o.dataset_id in ( SELECT DISTINCT dataset_id from dataset_security ) and owner_id in ( " +
|
||||
"SELECT user_id FROM dir_external_user_info WHERE org_hierarchy = ? or org_hierarchy like ?)";
|
||||
|
||||
private final static String GET_COUNT_OF_DATASET_WITH_CONFIRMED_OWNER = "SELECT count(DISTINCT o.dataset_id) " +
|
||||
"as count FROM dataset_owner o JOIN dict_dataset d ON o.dataset_id = d.id " +
|
||||
"WHERE o.dataset_id in (SELECT DISTINCT dataset_id FROM dataset_owner " +
|
||||
"WHERE confirmed_by is not null and confirmed_by != '' and ( is_deleted != 'Y' or is_deleted is null )) " +
|
||||
"and owner_id in ( " +
|
||||
"SELECT user_id FROM dir_external_user_info WHERE org_hierarchy = ? or org_hierarchy like ?)";
|
||||
|
||||
private final static String GET_FIELDS_WITH_DESCRIPTION = "SELECT field_name FROM " +
|
||||
"dict_field_detail dd JOIN dict_dataset_field_comment fc ON " +
|
||||
"dd.field_id = fc.field_id and dd.dataset_id = fc.dataset_id WHERE dd.dataset_id = ?";
|
||||
|
||||
private final static String GET_DATASET_LEVEL_COMMENTS = "SELECT text FROM comments WHERE dataset_id = ? LIMIT 1";
|
||||
|
||||
private final static String GET_COMPLIANCE_TYPE_BY_DATASET_ID = "SELECT compliance_type FROM " +
|
||||
"dataset_security WHERE dataset_id = ?";
|
||||
|
||||
private final static String GET_CONFIDENTIAL_FIELDS = "SELECT field_name " +
|
||||
"FROM dict_pii_field WHERE dataset_id = ?";
|
||||
|
||||
@ -193,6 +226,13 @@ public class DashboardDAO extends AbstractMySQLOpenSourceDAO
|
||||
"WHERE o.owner_id in (SELECT user_id FROM dir_external_user_info " +
|
||||
"WHERE org_hierarchy = ? or org_hierarchy like ?)) co";
|
||||
|
||||
private final static String IDPC_AUTO_PURGE = "AUTO_PURGE";
|
||||
private final static String IDPC_CUSTOMER_PURGE = "CUSTOMER_PURGE";
|
||||
private final static String IDPC_RETENTION = "RETENTION";
|
||||
private final static String IDPC_PURGE_NA = "Not purge applicable";
|
||||
private final static String IDPC_PURGE_UNKNOWN = "Unknown";
|
||||
private final static String ALL_DATASETS = "All Datasets";
|
||||
|
||||
public static ObjectNode getOwnershipPercentageByManagerId(String managerId) {
|
||||
|
||||
ObjectNode resultNode = Json.newObject();
|
||||
@ -405,6 +445,112 @@ public class DashboardDAO extends AbstractMySQLOpenSourceDAO
|
||||
return resultNode;
|
||||
}
|
||||
|
||||
public static ObjectNode getIdpcCompliancePercentageByManagerId(String managerId) {
|
||||
|
||||
ObjectNode resultNode = Json.newObject();
|
||||
ConfidentialFieldsOwner currentUser = null;
|
||||
List<ConfidentialFieldsOwner> memberList = new ArrayList<ConfidentialFieldsOwner>();
|
||||
if (StringUtils.isNotBlank(managerId))
|
||||
{
|
||||
List<LdapInfo> ldapInfoList = JiraDAO.getCurrentUserLdapInfo(managerId);
|
||||
if (ldapInfoList != null && ldapInfoList.size() > 0)
|
||||
{
|
||||
LdapInfo ldapInfo = ldapInfoList.get(0);
|
||||
if (ldapInfo != null)
|
||||
{
|
||||
currentUser = new ConfidentialFieldsOwner();
|
||||
currentUser.displayName = ldapInfo.displayName;
|
||||
currentUser.iconUrl = ldapInfo.iconUrl;
|
||||
currentUser.managerUserId = ldapInfo.managerUserId;
|
||||
currentUser.orgHierarchy = ldapInfo.orgHierarchy;
|
||||
currentUser.userName = ldapInfo.userName;
|
||||
if (StringUtils.isNotBlank(ldapInfo.orgHierarchy)) {
|
||||
currentUser.potentialDatasets = getJdbcTemplate().queryForObject(
|
||||
GET_COUNT_OF_DATASET,
|
||||
Long.class,
|
||||
currentUser.orgHierarchy,
|
||||
currentUser.orgHierarchy + "/%");
|
||||
}
|
||||
else if (managerId.equalsIgnoreCase("jweiner"))
|
||||
{
|
||||
currentUser.potentialDatasets = getJdbcTemplate().queryForObject(
|
||||
GET_COUNT_OF_DATASET,
|
||||
Long.class,
|
||||
"/" + currentUser.userName,
|
||||
"/" + currentUser.userName + "/%");
|
||||
}
|
||||
if (StringUtils.isNotBlank(ldapInfo.orgHierarchy)) {
|
||||
currentUser.confirmed = getJdbcTemplate().queryForObject(
|
||||
GET_COUNT_OF_DATASET_WITH_IDPC_PURGE,
|
||||
Long.class,
|
||||
currentUser.orgHierarchy,
|
||||
currentUser.orgHierarchy + "/%");
|
||||
}
|
||||
else if (managerId.equalsIgnoreCase("jweiner"))
|
||||
{
|
||||
currentUser.confirmed = getJdbcTemplate().queryForObject(
|
||||
GET_COUNT_OF_DATASET_WITH_IDPC_PURGE,
|
||||
Long.class,
|
||||
"/" + currentUser.userName,
|
||||
"/" + currentUser.userName + "/%");
|
||||
}
|
||||
|
||||
if (currentUser.potentialDatasets != 0)
|
||||
{
|
||||
currentUser.completed =
|
||||
df2.format(100.0 * currentUser.confirmed / currentUser.potentialDatasets);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentUser.completed = df2.format(0.0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
List<LdapInfo> members = JiraDAO.getFirstLevelLdapInfo(managerId);
|
||||
if (members != null)
|
||||
{
|
||||
for(LdapInfo member : members)
|
||||
{
|
||||
if (member != null && StringUtils.isNotBlank(member.orgHierarchy))
|
||||
{
|
||||
ConfidentialFieldsOwner owner = new ConfidentialFieldsOwner();
|
||||
owner.displayName = member.displayName;
|
||||
owner.fullName = member.fullName;
|
||||
owner.userName = member.userName;
|
||||
owner.iconUrl = member.iconUrl;
|
||||
owner.managerUserId = member.managerUserId;
|
||||
owner.orgHierarchy = member.orgHierarchy;
|
||||
owner.potentialDatasets = getJdbcTemplate().queryForObject(
|
||||
GET_COUNT_OF_DATASET,
|
||||
Long.class,
|
||||
owner.orgHierarchy,
|
||||
owner.orgHierarchy + "/%");
|
||||
|
||||
owner.confirmed = getJdbcTemplate().queryForObject(
|
||||
GET_COUNT_OF_DATASET_WITH_IDPC_PURGE,
|
||||
Long.class,
|
||||
owner.orgHierarchy,
|
||||
owner.orgHierarchy + "/%");
|
||||
if (owner.potentialDatasets != 0)
|
||||
{
|
||||
owner.completed = df2.format(100.0 * owner.confirmed / owner.potentialDatasets);
|
||||
}
|
||||
else
|
||||
{
|
||||
owner.completed = df2.format(0.0);
|
||||
}
|
||||
memberList.add(owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resultNode.put("status", "ok");
|
||||
resultNode.set("currentUser", Json.toJson(currentUser));
|
||||
resultNode.set("members", Json.toJson(memberList));
|
||||
return resultNode;
|
||||
}
|
||||
|
||||
public static ObjectNode getConfidentialPercentageByManagerId(String managerId) {
|
||||
|
||||
ObjectNode resultNode = Json.newObject();
|
||||
@ -564,7 +710,12 @@ public class DashboardDAO extends AbstractMySQLOpenSourceDAO
|
||||
datasetConfidential.datasetId = (Long) row.get("dataset_id");
|
||||
datasetConfidential.datasetName = (String) row.get("name");
|
||||
datasetConfidential.ownerId = (String) row.get("owner_id");
|
||||
datasetConfidential.confirmedOwnerId = (String) row.get("confirmed_owner_id");
|
||||
String confirmedOwnerId = (String) row.get("confirmed_owner_id");
|
||||
if (StringUtils.isBlank(confirmedOwnerId) && option == 1)
|
||||
{
|
||||
confirmedOwnerId = "<other team>";
|
||||
}
|
||||
datasetConfidential.confirmedOwnerId = confirmedOwnerId;
|
||||
confidentialList.add(datasetConfidential);
|
||||
}
|
||||
}
|
||||
@ -677,6 +828,8 @@ public class DashboardDAO extends AbstractMySQLOpenSourceDAO
|
||||
ObjectNode resultNode = Json.newObject();
|
||||
Long count = 0L;
|
||||
List<DatasetConfidential> confidentialList = new ArrayList<DatasetConfidential>();
|
||||
Boolean isDatasetLevel = true;
|
||||
String description = "";
|
||||
|
||||
if (StringUtils.isNotBlank(managerId))
|
||||
{
|
||||
@ -691,21 +844,34 @@ public class DashboardDAO extends AbstractMySQLOpenSourceDAO
|
||||
{
|
||||
case 1:
|
||||
datasetQuery = GET_DATASETS_WITH_DESCRIPTION_BY_ID;
|
||||
description = "has dataset level description";
|
||||
break;
|
||||
case 2:
|
||||
datasetQuery = GET_DATASETS_WITH_FULL_FIELD_DESCRIPTION_BY_ID;
|
||||
datasetQuery = GET_DATASETS_NO_DESCRIPTION_BY_ID;
|
||||
description = "no dataset level description";
|
||||
break;
|
||||
case 3:
|
||||
datasetQuery = GET_DATASETS_WITH_ANY_FIELD_DESCRIPTION_BY_ID;
|
||||
datasetQuery = GET_DATASETS_WITH_FULL_FIELD_DESCRIPTION_BY_ID;
|
||||
description = "all fields have description";
|
||||
isDatasetLevel = false;
|
||||
break;
|
||||
case 4:
|
||||
datasetQuery = GET_DATASETS_WITH_NO_FIELD_DESCRIPTION_BY_ID;
|
||||
datasetQuery = GET_DATASETS_WITH_ANY_FIELD_DESCRIPTION_BY_ID;
|
||||
description = "has field description";
|
||||
isDatasetLevel = false;
|
||||
break;
|
||||
case 5:
|
||||
datasetQuery = GET_DATASETS_WITH_NO_FIELD_DESCRIPTION_BY_ID;
|
||||
description = "no field description";
|
||||
isDatasetLevel = false;
|
||||
break;
|
||||
case 6:
|
||||
datasetQuery = GET_ALL_DATASETS_BY_ID;
|
||||
description = "";
|
||||
break;
|
||||
default:
|
||||
datasetQuery = GET_ALL_DATASETS_BY_ID;
|
||||
description = "";
|
||||
}
|
||||
List<Map<String, Object>> rows = null;
|
||||
if (StringUtils.isNotBlank(ldapInfo.orgHierarchy)) {
|
||||
@ -736,6 +902,131 @@ public class DashboardDAO extends AbstractMySQLOpenSourceDAO
|
||||
Logger.error("Exception = " + e.getMessage());
|
||||
}
|
||||
|
||||
for (Map row : rows) {
|
||||
DatasetConfidential datasetConfidential = new DatasetConfidential();
|
||||
datasetConfidential.datasetId = (Long) row.get("dataset_id");
|
||||
datasetConfidential.datasetName = (String) row.get("name");
|
||||
datasetConfidential.ownerId = (String) row.get("owner_id");
|
||||
if (datasetConfidential.datasetId != null && datasetConfidential.datasetId > 0) {
|
||||
if (isDatasetLevel)
|
||||
{
|
||||
datasetConfidential.confidentialFieldList =
|
||||
getJdbcTemplate().queryForList(
|
||||
GET_DATASET_LEVEL_COMMENTS,
|
||||
String.class,
|
||||
datasetConfidential.datasetId);
|
||||
}
|
||||
else {
|
||||
datasetConfidential.confidentialFieldList =
|
||||
getJdbcTemplate().queryForList(
|
||||
GET_FIELDS_WITH_DESCRIPTION,
|
||||
String.class,
|
||||
datasetConfidential.datasetId);
|
||||
}
|
||||
}
|
||||
confidentialList.add(datasetConfidential);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resultNode.put("status", "ok");
|
||||
resultNode.put("count", count);
|
||||
resultNode.put("page", page);
|
||||
resultNode.put("description", description);
|
||||
resultNode.put("itemsPerPage", size);
|
||||
resultNode.put("isDatasetLevel", isDatasetLevel);
|
||||
resultNode.put("totalPages", (int) Math.ceil(count / ((double) size)));
|
||||
resultNode.set("datasets", Json.toJson(confidentialList));
|
||||
return resultNode;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
public static ObjectNode getPagedComplianceDatasetsByManagerId(
|
||||
String managerId,
|
||||
String option,
|
||||
Integer page,
|
||||
Integer size) {
|
||||
|
||||
ObjectNode result = Json.newObject();
|
||||
|
||||
javax.sql.DataSource ds = getJdbcTemplate().getDataSource();
|
||||
DataSourceTransactionManager tm = new DataSourceTransactionManager(ds);
|
||||
TransactionTemplate txTemplate = new TransactionTemplate(tm);
|
||||
result = txTemplate.execute(new TransactionCallback<ObjectNode>()
|
||||
{
|
||||
public ObjectNode doInTransaction(TransactionStatus status)
|
||||
{
|
||||
ObjectNode resultNode = Json.newObject();
|
||||
Long count = 0L;
|
||||
List<DatasetConfidential> confidentialList = new ArrayList<DatasetConfidential>();
|
||||
|
||||
if (StringUtils.isNotBlank(managerId))
|
||||
{
|
||||
List<LdapInfo> ldapInfoList = JiraDAO.getCurrentUserLdapInfo(managerId);
|
||||
if (ldapInfoList != null && ldapInfoList.size() > 0)
|
||||
{
|
||||
LdapInfo ldapInfo = ldapInfoList.get(0);
|
||||
if (ldapInfo != null)
|
||||
{
|
||||
List<Map<String, Object>> rows = null;
|
||||
if (StringUtils.isNotBlank(ldapInfo.orgHierarchy)) {
|
||||
|
||||
if (StringUtils.isNotBlank(option) && !(option.equalsIgnoreCase(ALL_DATASETS)))
|
||||
{
|
||||
rows = getJdbcTemplate().queryForList(
|
||||
GET_DATASETS_WITH_IDPC_COMPLIANCE_BY_ID,
|
||||
option,
|
||||
ldapInfo.orgHierarchy,
|
||||
ldapInfo.orgHierarchy + "/%",
|
||||
(page - 1) * size,
|
||||
size);
|
||||
}
|
||||
else
|
||||
{
|
||||
rows = getJdbcTemplate().queryForList(
|
||||
GET_ALL_DATASETS_BY_ID,
|
||||
ldapInfo.orgHierarchy,
|
||||
ldapInfo.orgHierarchy + "/%",
|
||||
(page - 1) * size,
|
||||
size);
|
||||
}
|
||||
|
||||
}
|
||||
else if (managerId.equalsIgnoreCase("jweiner"))
|
||||
{
|
||||
if (StringUtils.isNotBlank(option) && !(option.equalsIgnoreCase(ALL_DATASETS)))
|
||||
{
|
||||
rows = getJdbcTemplate().queryForList(
|
||||
GET_DATASETS_WITH_IDPC_COMPLIANCE_BY_ID,
|
||||
option,
|
||||
"/" + ldapInfo.userName,
|
||||
"/" + ldapInfo.userName + "/%",
|
||||
(page - 1) * size,
|
||||
size);
|
||||
}
|
||||
else
|
||||
{
|
||||
rows = getJdbcTemplate().queryForList(
|
||||
GET_ALL_DATASETS_BY_ID,
|
||||
"/" + ldapInfo.userName,
|
||||
"/" + ldapInfo.userName + "/%",
|
||||
(page - 1) * size,
|
||||
size);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
count = getJdbcTemplate().queryForObject(
|
||||
"SELECT FOUND_ROWS()",
|
||||
Long.class);
|
||||
}
|
||||
catch(EmptyResultDataAccessException e)
|
||||
{
|
||||
Logger.error("Exception = " + e.getMessage());
|
||||
}
|
||||
|
||||
for (Map row : rows) {
|
||||
DatasetConfidential datasetConfidential = new DatasetConfidential();
|
||||
datasetConfidential.datasetId = (Long) row.get("dataset_id");
|
||||
@ -744,7 +1035,7 @@ public class DashboardDAO extends AbstractMySQLOpenSourceDAO
|
||||
if (datasetConfidential.datasetId != null && datasetConfidential.datasetId > 0) {
|
||||
datasetConfidential.confidentialFieldList =
|
||||
getJdbcTemplate().queryForList(
|
||||
GET_FIELDS_WITH_DESCRIPTION,
|
||||
GET_COMPLIANCE_TYPE_BY_DATASET_ID,
|
||||
String.class,
|
||||
datasetConfidential.datasetId);
|
||||
}
|
||||
@ -900,7 +1191,14 @@ public class DashboardDAO extends AbstractMySQLOpenSourceDAO
|
||||
String label = Integer.toString(month) + "/" + Integer.toString(year);
|
||||
MetadataBarData metadataBarData = new MetadataBarData();
|
||||
metadataBarData.label = label;
|
||||
metadataBarData.value = value.longValue();
|
||||
if (value != null)
|
||||
{
|
||||
metadataBarData.value = value.longValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
metadataBarData.value = 0L;
|
||||
}
|
||||
barDataList.add(metadataBarData);
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
<a id="descriptionlink" data-toggle="tab" href="#descriptiontab">Description</a>
|
||||
</li>
|
||||
<li id="idpcpage">
|
||||
<a id="idpctablink" data-toggle="tab" href="#idpctab">IDPC Privacy</a>
|
||||
<a id="idpctablink" data-toggle="tab" href="#idpctab">IDPC Compliance</a>
|
||||
</li>
|
||||
<li id="confidentialpage">
|
||||
<a id="confidentiallink" data-toggle="tab" href="#confidentialtab">Confidential Fields</a>
|
||||
@ -307,7 +307,7 @@
|
||||
</li>
|
||||
{{/unless}}
|
||||
<li>
|
||||
{{ descriptionDatasets.count }} datasets - page {{ descriptionDatasets.page }} of {{ descriptionDatasets.totalPages }}
|
||||
{{ descriptionDatasets.count }} datasets {{ descriptionDatasets.description }} - page {{ descriptionDatasets.page }} of {{ descriptionDatasets.totalPages }}
|
||||
</li>
|
||||
{{#unless descLast}}
|
||||
<li class="next">
|
||||
@ -322,7 +322,11 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Dataset</th>
|
||||
<th class="text-center">Fields With Description</th>
|
||||
{{#if descriptionDatasets.isDatasetLevel}}
|
||||
<th class="text-center">Description</th>
|
||||
{{else}}
|
||||
<th class="text-center">Fields With Description</th>
|
||||
{{/if}}
|
||||
<th class="text-center">Owners</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -371,6 +375,168 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="idpctab" class="tab-pane">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-4">
|
||||
<h4>IDPC Compliance for {{ currentComplianceUser.displayName }}</h4>
|
||||
<table class="table table-bordered table-condensed table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Name</th>
|
||||
<th class="text-center">Completion</th>
|
||||
<th class="text-center">Total Potential</th>
|
||||
<th class="text-center">Has Purge Option</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<img src={{currentComplianceUser.iconUrl}} title={{currentComplianceUser.displayName}}
|
||||
width="25px"
|
||||
height="25px"/>
|
||||
<a href='metadata#/dashboard/{{currentComplianceUser.userName}}' title={{currentComplianceUser.displayName}}>
|
||||
{{ currentComplianceUser.displayName }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center">{{ currentComplianceUser.completed }}%</td>
|
||||
<td class="text-center">{{ currentComplianceUser.potentialDatasets }}</td>
|
||||
<td class="text-center">{{ currentComplianceUser.confirmed }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<h4>Ticket Roll-Up for Individual User</h4>
|
||||
<table class="table table-bordered table-condensed table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Name</th>
|
||||
<th class="text-center">Completion</th>
|
||||
<th class="text-center">Total Potential</th>
|
||||
<th class="text-center">Has Purge Option</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#if userNoIdpcMembers}}
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 text-center">
|
||||
This user has no one that reports to them.
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
{{#each complianceOwners as |user|}}
|
||||
<tr>
|
||||
<td>
|
||||
<img src={{user.iconUrl}} title={{user.displayName}}
|
||||
width="25px"
|
||||
height="25px"/>
|
||||
<a href='metadata#/dashboard/{{user.userName}}' title={{user.displayName}}>
|
||||
{{ user.displayName }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center">{{ user.completed }}%</td>
|
||||
<td class="text-center">{{ user.potentialDatasets }}</td>
|
||||
<td class="text-center">{{ user.confirmed }}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-8">
|
||||
<div class="row">
|
||||
<div class="col-xs-9">
|
||||
<h4>List of Datasets</h4>
|
||||
</div>
|
||||
<div class="col-xs-3 headerBarFilter">
|
||||
<form class="form-inline">
|
||||
<select id="idpcShowOption" class="form-control" {{action "idpcOptionChanged" on="change"}}>
|
||||
{{#each idpcOptions as |option index|}}
|
||||
{{#if index}}
|
||||
<option value={{option.option}}>{{option.value}}
|
||||
</option>
|
||||
{{else}}
|
||||
<option selected value={{option.option}}>{{option.value}}
|
||||
</option>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="search-pagination">
|
||||
<ul class="pager">
|
||||
{{#unless idpcFirst}}
|
||||
<li class="previous">
|
||||
<a {{ action "prevIdpcPage" }}>
|
||||
← Prev
|
||||
</a>
|
||||
</li>
|
||||
{{/unless}}
|
||||
<li>
|
||||
{{ complianceDatasets.count }} datasets - page {{ complianceDatasets.page }} of {{ complianceDatasets.totalPages }}
|
||||
</li>
|
||||
{{#unless idpcLast}}
|
||||
<li class="next">
|
||||
<a {{ action "nextIdpcPage" }}>
|
||||
Next →
|
||||
</a>
|
||||
</li>
|
||||
{{/unless}}
|
||||
</ul>
|
||||
</div>
|
||||
<table class="table table-bordered table-condensed table-hover table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Dataset</th>
|
||||
<th class="text-center">Purge Option</th>
|
||||
<th class="text-center">Owners</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#if idpcInProgress}}
|
||||
<tr>
|
||||
<td colspan="8" class="text-center">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<i class="fa fa-spinner spinning fa-4x">
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
{{#if userNoComplianceFields}}
|
||||
<tr>
|
||||
<td colspan="8">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 text-center">
|
||||
This user has no datasets with IDPC compliance information.
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{{else}}
|
||||
{{#each complianceDatasets.datasets as |dataset|}}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/#/datasets/{{dataset.datasetId}}">
|
||||
{{ dataset.datasetName }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
{{ dataset.confidentialFieldList }}
|
||||
</td>
|
||||
<td class="text-center">{{ dataset.ownerId }}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="confidentialtab" class="tab-pane">
|
||||
<div class="row">
|
||||
|
||||
@ -681,7 +681,7 @@
|
||||
<a data-toggle="tab"
|
||||
title="Accessibilities"
|
||||
href="#accesstab">
|
||||
Accessibilities
|
||||
Availability
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@ -864,7 +864,7 @@
|
||||
<h4 class="panel-title">
|
||||
<a class="collapsed" data-toggle="collapse" data-parent="#accordion"
|
||||
href="#accessview" aria-expanded="false" aria-controls="accessData">
|
||||
Accessiblities
|
||||
Availability
|
||||
</a>
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
@ -221,12 +221,16 @@ GET /api/v1/metadata/dashboard/confidential/:managerId controllers.api.
|
||||
|
||||
GET /api/v1/metadata/dashboard/description/:managerId controllers.api.v1.Dashboard.getDescriptionDatasetsPercentage(managerId :String)
|
||||
|
||||
GET /api/v1/metadata/dashboard/compliance/:managerId controllers.api.v1.Dashboard.getIdpcComplianceDatasetsPercentage(managerId :String)
|
||||
|
||||
GET /api/v1/metadata/dataset/ownership/:managerId controllers.api.v1.Dashboard.getPagedOwnershipDatasets(managerId :String)
|
||||
|
||||
GET /api/v1/metadata/dataset/confidential/:managerId controllers.api.v1.Dashboard.getPagedConfidentialDatasets(managerId :String)
|
||||
|
||||
GET /api/v1/metadata/dataset/description/:managerId controllers.api.v1.Dashboard.getPagedDescriptionDatasets(managerId :String)
|
||||
|
||||
GET /api/v1/metadata/dataset/compliance/:managerId controllers.api.v1.Dashboard.getPagedComplianceDatasets(managerId :String)
|
||||
|
||||
GET /api/v1/metadata/barchart/ownership/:managerId controllers.api.v1.Dashboard.getOwnershipBarData(managerId :String)
|
||||
|
||||
GET /api/v1/metadata/barchart/description/:managerId controllers.api.v1.Dashboard.getDescriptionBarData(managerId :String)
|
||||
|
||||
@ -355,6 +355,7 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
/*
|
||||
if (refresh)
|
||||
{
|
||||
var barDataUrl = '/api/v1/metadata/barchart/description/' + user + '?option=' + option;
|
||||
@ -367,12 +368,80 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
function refreshIdpcDatasets(user, option, page, size, refresh)
|
||||
{
|
||||
if (!user)
|
||||
return;
|
||||
|
||||
if (!page)
|
||||
page = 1;
|
||||
if (!size)
|
||||
size = 10;
|
||||
|
||||
jiraController.set('idpcInProgress', true);
|
||||
var datasetsUrl = '/api/v1/metadata/dataset/compliance/' + user + '?page=' +
|
||||
page + '&size=' + size + '&option=' + option;
|
||||
$.get(datasetsUrl, function(data) {
|
||||
jiraController.set('idpcInProgress', false);
|
||||
if (data && data.status == "ok") {
|
||||
var currentPage = data.page;
|
||||
var totalPage = data.totalPages;
|
||||
if (currentPage == 1)
|
||||
{
|
||||
jiraController.set('idpcFirst', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
jiraController.set('idpcFirst', false);
|
||||
}
|
||||
if (currentPage == totalPage)
|
||||
{
|
||||
jiraController.set('idpcLast', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
jiraController.set('idpcLast', false);
|
||||
}
|
||||
jiraController.set('complianceDatasets', data);
|
||||
jiraController.set('currentIdpcPage', data.page);
|
||||
if (data.datasets && data.datasets.length > 0)
|
||||
{
|
||||
/*
|
||||
if (refresh)
|
||||
{
|
||||
renderPie("pie", descriptionOptions[option-1].value, data.count);
|
||||
}
|
||||
*/
|
||||
jiraController.set('userNoComplianceFields', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
jiraController.set('userNoComplianceFields', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
/*
|
||||
if (refresh)
|
||||
{
|
||||
var barDataUrl = '/api/v1/metadata/barchart/description/' + user + '?option=' + option;
|
||||
$.get(barDataUrl, function(data) {
|
||||
if (data && data.status == "ok") {
|
||||
if (data.barData && data.barData.length > 0)
|
||||
{
|
||||
renderBarChart(('#barchart'), data.barData, option);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
var jiraController = null;
|
||||
var hierarchy = '/jweiner';
|
||||
var breadcrumbs;
|
||||
var sortOptions = ['Assignee First', 'Jira Status First', 'Directory Path First'];
|
||||
var selectedUser = {
|
||||
'userId': 'jweiner',
|
||||
'displayName': 'jweiner',
|
||||
@ -386,16 +455,25 @@
|
||||
'url': '/metadata#/dashboard/jweiner'};
|
||||
var descriptionOptions = [
|
||||
{'value':'Has Dataset Description', 'option': 1},
|
||||
{'value':'Full Fields Description', 'option': 2},
|
||||
{'value':'Has Fields Description', 'option': 3},
|
||||
{'value':'No Fields Description', 'option': 4},
|
||||
{'value':'All Datasets', 'option': 5}];
|
||||
{'value':'No Dataset Description', 'option': 2},
|
||||
{'value':'Full Fields Description', 'option': 3},
|
||||
{'value':'Has Fields Description', 'option': 4},
|
||||
{'value':'No Fields Description', 'option': 5},
|
||||
{'value':'All Datasets', 'option': 6}];
|
||||
|
||||
var ownershipOptions = [
|
||||
{'value':'Confirmed Datasets', 'option': 1},
|
||||
{'value':'Unconfirmed Datasets', 'option': 2},
|
||||
{'value':'All Datasets', 'option': 3}];
|
||||
|
||||
var idpcOptions = [
|
||||
{'value':'Auto Purge', 'option': "AUTO_PURGE"},
|
||||
{'value':'Custome Purge', 'option': "CUSTOM_PURGE"},
|
||||
{'value':'Limited Retention', 'option': "LIMITED_RETENTION"},
|
||||
{'value':'Not Applicable', 'option': "PURGE_NOT_APPLICABLE"},
|
||||
{'value':'Unknown', 'option': "UNKNOWN"},
|
||||
{'value':'All Datasets', 'option': "All Datasets"}];
|
||||
|
||||
setTimeout(setActiveTab, 500);
|
||||
|
||||
App.DashboardRoute = Ember.Route.extend({
|
||||
@ -406,6 +484,7 @@
|
||||
jiraController.set('selectedUser', selectedUser);
|
||||
jiraController.set('descriptionOptions', descriptionOptions);
|
||||
jiraController.set('ownershipOptions', ownershipOptions);
|
||||
jiraController.set('idpcOptions', idpcOptions);
|
||||
}
|
||||
});
|
||||
|
||||
@ -440,14 +519,20 @@
|
||||
}
|
||||
jiraController.set('breadcrumbs', breadcrumbs);
|
||||
|
||||
refreshOwnerDatasets(params.user, 1, 1, 10, true);
|
||||
var obj = $('#ownerShowOption');
|
||||
if (obj)
|
||||
{
|
||||
refreshOwnerDatasets(params.user, obj.val(), 1, 10, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
refreshOwnerDatasets(params.user, 1, 1, 10, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
jiraController.set('cfInProgress', true);
|
||||
var confidentialUrl = 'api/v1/metadata/dashboard/confidential/' + params.user;
|
||||
var headlessTickets;
|
||||
var userTickets;
|
||||
$.get(confidentialUrl, function(data) {
|
||||
jiraController.set('cfInProgress', false);
|
||||
if (data && data.status == "ok") {
|
||||
@ -478,10 +563,8 @@
|
||||
});
|
||||
|
||||
jiraController.set('descInProgress', true);
|
||||
var confidentialUrl = 'api/v1/metadata/dashboard/description/' + params.user;
|
||||
var headlessTickets;
|
||||
var userTickets;
|
||||
$.get(confidentialUrl, function(data) {
|
||||
var descriptionUrl = 'api/v1/metadata/dashboard/description/' + params.user;
|
||||
$.get(descriptionUrl, function(data) {
|
||||
jiraController.set('descInProgress', false);
|
||||
if (data && data.status == "ok") {
|
||||
jiraController.set('descriptionOwners', data.members);
|
||||
@ -515,7 +598,45 @@
|
||||
{
|
||||
refreshDescDatasets(params.user, 1, 1, 10, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
jiraController.set('idpcInProgress', true);
|
||||
var complianceUrl = 'api/v1/metadata/dashboard/compliance/' + params.user;
|
||||
$.get(complianceUrl, function(data) {
|
||||
jiraController.set('idpcInProgress', false);
|
||||
if (data && data.status == "ok") {
|
||||
jiraController.set('complianceOwners', data.members);
|
||||
if (data.members && data.members.length > 0)
|
||||
{
|
||||
jiraController.set('userNoIdpcMembers', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
jiraController.set('userNoIdpcMembers', true);
|
||||
}
|
||||
jiraController.set('currentComplianceUser', data.currentUser);
|
||||
var breadcrumbs;
|
||||
if (data.currentUser.orgHierarchy)
|
||||
{
|
||||
breadcrumbs = genBreadcrumbs(data.currentUser.orgHierarchy);
|
||||
}
|
||||
else
|
||||
{
|
||||
var hierarchy = '/jweiner';
|
||||
breadcrumbs = genBreadcrumbs(hierarchy);
|
||||
}
|
||||
jiraController.set('breadcrumbs', breadcrumbs);
|
||||
|
||||
var obj = $('#idpcShowOption');
|
||||
if (obj)
|
||||
{
|
||||
refreshIdpcDatasets(params.user, obj.val(), 1, 10, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
refreshIdpcDatasets(params.user, idpcOptions[0].value, 1, 10, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -594,6 +715,28 @@
|
||||
|
||||
}
|
||||
},
|
||||
prevIdpcPage: function() {
|
||||
var idpcInfo = this.get("complianceDatasets");
|
||||
var user = this.get("currentComplianceUser");
|
||||
if (idpcInfo && user) {
|
||||
var currentPage = parseInt(idpcInfo.page) - 1;
|
||||
if (currentPage > 0) {
|
||||
refreshIdpcDatasets(user.userName, $('#idpcShowOption').val(), currentPage, 10, false);
|
||||
}
|
||||
}
|
||||
},
|
||||
nextIdpcPage: function() {
|
||||
var idpcInfo = this.get("complianceDatasets");
|
||||
var user = this.get("currentComplianceUser");
|
||||
if (idpcInfo && user) {
|
||||
var currentPage = parseInt(idpcInfo.page) + 1;
|
||||
var totalPages = idpcInfo.totalPages;
|
||||
if (currentPage <= totalPages) {
|
||||
refreshIdpcDatasets(user.userName, $('#idpcShowOption').val(), currentPage, 10, false);
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
optionChanged: function() {
|
||||
var user = this.get("currentDescriptionUser");
|
||||
if (user)
|
||||
@ -605,7 +748,14 @@
|
||||
var user = this.get("currentOwnershipUser");
|
||||
if (user)
|
||||
{
|
||||
refreshOwnerDatasets(user.userName, $('#ownerShowOption').val(), 1, 10, true);
|
||||
refreshOwnerDatasets(user.userName, $('#ownerShowOption').val(), 1, 10, false);
|
||||
}
|
||||
},
|
||||
idpcOptionChanged: function() {
|
||||
var user = this.get("currentComplianceUser");
|
||||
if (user)
|
||||
{
|
||||
refreshIdpcDatasets(user.userName, $('#idpcShowOption').val(), 1, 10, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user