summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Lott (cl778h) <clott@research.att.com>2017-06-19 09:53:49 -0400
committerChristopher Lott (cl778h) <clott@research.att.com>2017-06-27 16:04:19 -0400
commitd727214365c22854d337c010b216e42f1b718290 (patch)
treee7114493f39760daa6f955cc90b649cbc01ef9c6
parent1e66cf42be4fa5288fbae0aa589a37ad5e072d24 (diff)
[PORTAL-15] Repair RAPTOR and role defects.
Change-Id: I1fd4049f1253801021f97ef7bcb3ffb11d8b8c76 Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportUserRole.java117
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java345
-rw-r--r--ecomp-sdk/epsdk-app-os/pom.xml2
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml33
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js274
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/raptorReportFactory.js202
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-security-role-del-confirm.html26
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-security-user-del-confirm.html26
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-user-role-confirm-toggle.html23
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/json/step5.json19
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/json/step6.json28
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/report-step.html148
12 files changed, 1190 insertions, 53 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportUserRole.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportUserRole.java
new file mode 100644
index 00000000..3563fc9a
--- /dev/null
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/base/ReportUserRole.java
@@ -0,0 +1,117 @@
+/*-
+ * ================================================================================
+ * ECOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.base;
+
+import java.io.*;
+import java.sql.*;
+import java.util.*;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.controller.ActionHandler;
+import org.openecomp.portalsdk.analytics.error.*;
+import org.openecomp.portalsdk.analytics.model.base.*;
+import org.openecomp.portalsdk.analytics.model.definition.*;
+import org.openecomp.portalsdk.analytics.system.*;
+import org.openecomp.portalsdk.analytics.util.*;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+@Entity
+public class ReportUserRole extends org.openecomp.portalsdk.analytics.RaptorObject implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ private Long repId = null;
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ private Long orderNo = null;
+
+ private Long roleId = null;
+
+ private Long userId = null;
+
+ private String readOnlyYn = null;
+
+ public ReportUserRole() {
+ super();
+ }
+
+ public ReportUserRole(Long repId, Long orderNo, Long roleId, Long userId, String readOnlyYn) {
+ super();
+ this.repId = repId;
+ this.orderNo = orderNo;
+ this.roleId = roleId;
+ this.userId = userId;
+ this.readOnlyYn = readOnlyYn;
+ }
+
+ public Long getRepId() {
+ return repId;
+ }
+
+ public void setRepId(Long repId) {
+ this.repId = repId;
+ }
+
+ public Long getOrderNo() {
+ return orderNo;
+ }
+
+ public void setOrderNo(Long orderNo) {
+ this.orderNo = orderNo;
+ }
+
+ public Long getRoleId() {
+ return roleId;
+ }
+
+ public void setRoleId(Long roleId) {
+ this.roleId = roleId;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public String getReadOnlyYn() {
+ return readOnlyYn;
+ }
+
+ public void setReadOnlyYn(String readOnlyYn) {
+ this.readOnlyYn = readOnlyYn;
+ }
+
+
+
+} \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
index 48fdbe4c..1613e4e2 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
@@ -42,13 +42,16 @@ import javax.servlet.http.HttpSession;
import org.openecomp.portalsdk.analytics.controller.Action;
import org.openecomp.portalsdk.analytics.controller.ErrorHandler;
+import org.openecomp.portalsdk.analytics.controller.WizardSequence;
import org.openecomp.portalsdk.analytics.error.RaptorException;
import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
import org.openecomp.portalsdk.analytics.error.ReportSQLException;
import org.openecomp.portalsdk.analytics.model.DataCache;
import org.openecomp.portalsdk.analytics.model.ReportHandler;
import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.model.base.ReportUserRole;
import org.openecomp.portalsdk.analytics.model.definition.ReportDefinition;
+import org.openecomp.portalsdk.analytics.model.definition.SecurityEntry;
import org.openecomp.portalsdk.analytics.model.definition.wizard.ColumnEditJSON;
import org.openecomp.portalsdk.analytics.model.definition.wizard.ColumnJSON;
import org.openecomp.portalsdk.analytics.model.definition.wizard.DefinitionJSON;
@@ -73,6 +76,7 @@ import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
import org.openecomp.portalsdk.analytics.system.AppUtils;
import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.Item;
import org.openecomp.portalsdk.analytics.util.AppConstants;
import org.openecomp.portalsdk.analytics.util.DataSet;
import org.openecomp.portalsdk.analytics.util.Utils;
@@ -104,7 +108,7 @@ import com.fasterxml.jackson.databind.SerializationFeature;
@Controller
@RequestMapping("/")
public class RaptorControllerAsync extends RestrictedBaseController {
-
+
private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RaptorControllerAsync.class);
private String viewName;
@@ -185,8 +189,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
// whole
}
} catch (Exception e) {
- logger.error(EELFLoggerDelegate.errorLogger, "[Controller.processRequest]Invalid raptor action ["
- + actionKey + "].", e);
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "[Controller.processRequest]Invalid raptor action [" + actionKey + "].", e);
}
} else {
response.sendRedirect("login.htm");
@@ -203,8 +207,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
if (action == null)
throw new RaptorRuntimeException("Action not found");
} catch (RaptorException e) {
- logger.error(EELFLoggerDelegate.errorLogger, "[Controller.processRequest]Invalid raptor action ["
- + actionKey + "].", e);
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "[Controller.processRequest]Invalid raptor action [" + actionKey + "].", e);
viewName = (new ErrorHandler()).processFatalErrorJSON(request,
new RaptorRuntimeException("[Controller.processRequest]Invalid raptor action [" + actionKey
@@ -486,8 +490,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
// clear predefined value
if (fft.getPredefinedValueList() != null) {
- for (Iterator<String> iter = fft.getPredefinedValueList().getPredefinedValue().iterator(); iter
- .hasNext();)
+ for (Iterator<String> iter = fft.getPredefinedValueList().getPredefinedValue()
+ .iterator(); iter.hasNext();)
iter.remove();
}
@@ -722,7 +726,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
if (pathVariables.containsKey("action")) {
action = pathVariables.get("action");
}
-
+
ServletContext servletContext = request.getSession().getServletContext();
if (!Globals.isSystemInitialized()) {
Globals.initializeSystem(servletContext);
@@ -887,6 +891,319 @@ public class RaptorControllerAsync extends RestrictedBaseController {
return wizardJSON;
}
+ @RequestMapping(value = { "/report/wizard/security/retrieveReportUserList" }, method = RequestMethod.GET)
+ public @ResponseBody List<SecurityEntry> getReportUserList(HttpServletRequest request)
+ throws IOException, RaptorException {
+ List<SecurityEntry> reportUserList = new ArrayList<SecurityEntry>();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ Vector reportUsers = rdef.getReportUsers(request);
+ for(Iterator iter=reportUsers.iterator(); iter.hasNext();) {
+ SecurityEntry rUser = (SecurityEntry) iter.next();
+ reportUserList.add(rUser);
+ }
+ return reportUserList;
+ };
+
+ @RequestMapping(value = { "/report/wizard/security/retrieveReportRoleList" }, method = RequestMethod.GET)
+ public @ResponseBody List<IdNameValue> getReportRoleList(HttpServletRequest request)
+ throws IOException, RaptorException {
+ List<IdNameValue> reportRoleList = new ArrayList<IdNameValue>();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ Vector reportRoles = rdef.getReportRoles(request);
+ Vector remainingRoles = Utils.getRolesNotInList(reportRoles,request);
+ for(int i=0; i<remainingRoles.size(); i++) {
+ IdNameValue role = (IdNameValue) remainingRoles.get(i);
+ reportRoleList.add(role);
+ }
+ return reportRoleList;
+ };
+
+ @RequestMapping(value = { "/report/wizard/security/retrieveReportUserList_query" }, method = RequestMethod.GET)
+ public @ResponseBody List<Map<String, String>> getReportUserListQuery(HttpServletRequest request)
+ throws IOException, RaptorException {
+ List<Map<String, String>> reportUserList = new ArrayList();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ String reportId = rdef.getReportID();
+ Map<String, Object> params = new HashMap<String, Object>();
+ params.put("report_id", new Long(reportId));
+ List<ReportUserRole> queriedUserList = getDataAccessService().executeNamedQuery("getReportSecurityUsers", params, null);
+ for (int i=0; i<queriedUserList.size();i++){
+ Map<String, String> reportUser = new HashMap<String, String>();
+ Object tmp = queriedUserList.get(i);
+ reportUser.put("rep_id", queriedUserList.get(i).toString());
+ reportUser.put("order_no", queriedUserList.get(i).getOrderNo().toString());
+ reportUser.put("user_id", queriedUserList.get(i).getUserId().toString());
+ reportUser.put("role_id", queriedUserList.get(i).getRoleId().toString());
+ reportUser.put("read_only_yn", queriedUserList.get(i).getReadOnlyYn());
+ reportUserList.add(reportUser);
+ }
+ return reportUserList;
+ };
+
+
+
+ @RequestMapping(value = "/report/security/addReportUser", method = RequestMethod.POST)
+ public @ResponseBody Map<String,String> addSelectedReportUser(
+ @RequestBody String userIdToAdd, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, RaptorException {
+ Map<String, String> JsonResponse = new HashMap<String, String>();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ try {
+ JsonResponse.put("status","success");
+ JsonResponse.put("userId",userIdToAdd);
+ String action = "Add User";
+ rdef.getReportSecurity().addUserAccess(userIdToAdd, "Y");
+ WizardSequence ws = rdef.getWizardSequence();
+ ws.performAction(action,rdef);
+ return JsonResponse;
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
+ return null;
+ }
+ }
+
+ @RequestMapping(value = "/report/security/removeReportUser", method = RequestMethod.POST)
+ public @ResponseBody Map<String,String> removeSelectedReportUser(
+ @RequestBody String userIdToRemove, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, RaptorException {
+ Map<String, String> JsonResponse = new HashMap<String, String>();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ try {
+ JsonResponse.put("status","success");
+ JsonResponse.put("userId",userIdToRemove);
+ String action = "Delete User";
+ rdef.getReportSecurity().removeUserAccess(userIdToRemove);
+ rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ WizardSequence ws = rdef.getWizardSequence();
+ ws.performAction(action,rdef);
+ return JsonResponse;
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
+ return null;
+ }
+ }
+
+ @RequestMapping(value = "/report/security/addReportRole", method = RequestMethod.POST)
+ public @ResponseBody Map<String,String> addSelectedReportRole(
+ @RequestBody String roleIdToAdd, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, RaptorException {
+ Map<String, String> JsonResponse = new HashMap<String, String>();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ try {
+ JsonResponse.put("status","success");
+ JsonResponse.put("roleId",roleIdToAdd);
+ String action = "Add Role";
+ rdef.getReportSecurity().addRoleAccess(roleIdToAdd, "Y");
+ WizardSequence ws = rdef.getWizardSequence();
+ ws.performAction(action,rdef);
+ return JsonResponse;
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
+ return null;
+ }
+ }
+
+ @RequestMapping(value = "/report/security/removeReportRole", method = RequestMethod.POST)
+ public @ResponseBody Map<String,String> removeSelectedReportRole(
+ @RequestBody String roleIdToRemove, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, RaptorException {
+ Map<String, String> JsonResponse = new HashMap<String, String>();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ try {
+ JsonResponse.put("status","success");
+ JsonResponse.put("roleId",roleIdToRemove);
+ String action = "Delete Role";
+ rdef.getReportSecurity().removeRoleAccess(roleIdToRemove);
+ WizardSequence ws = rdef.getWizardSequence();
+ ws.performAction(action,rdef);
+ return JsonResponse;
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
+ return null;
+ }
+ }
+
+ @RequestMapping(value = "/report/security/updateReportSecurityInfo", method = RequestMethod.POST)
+ public @ResponseBody Map<String,String> updateReportSecurityInfo(
+ @RequestBody Map<String,String> securityInfo, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, RaptorException {
+
+ Map<String, String> JsonResponse = new HashMap<String, String>();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ try {
+ JsonResponse.put("status","success");
+ String OwnerUserId = securityInfo.get("userId");
+ String isPublic = securityInfo.get("isPublic");
+ boolean rPublic = isPublic.equals("true");
+ rdef.getReportSecurity().setOwnerID(OwnerUserId);
+ rdef.setPublic(rPublic);
+ persistReportDefinition(request, rdef);
+ return JsonResponse;
+
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
+ return null;
+ }
+ }
+
+ @RequestMapping(value = "/report/security/toggleUserEditAccess/{userID}", method = RequestMethod.POST)
+ public @ResponseBody Map<String,String> toggleUserEditAccess(
+ @PathVariable("userID") String userId,
+ @RequestBody String readOnly, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, RaptorException {
+ Map<String, String> JsonResponse = new HashMap<String, String>();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ try {
+ String action ="";
+ JsonResponse.put("status","success");
+ if (readOnly.equals("N")) {
+ action = "Grant User Access";
+ } else {
+ action = "Revoke User Access";
+ }
+ rdef.getReportSecurity().updateUserAccess(userId, readOnly);
+ WizardSequence ws = rdef.getWizardSequence();
+ ws.performAction(action,rdef);
+
+ return JsonResponse;
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
+ return null;
+ }
+ };
+
+ @RequestMapping(value = "/report/security/toggleRoleEditAccess/{roleID}", method = RequestMethod.POST)
+ public @ResponseBody Map<String,String> toggleRoleEditAccess(
+ @PathVariable("roleID") String roleId,
+ @RequestBody String readOnly, HttpServletRequest request, HttpServletResponse response)
+ throws IOException, RaptorException {
+ Map<String, String> JsonResponse = new HashMap<String, String>();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ try {
+ String action ="";
+ JsonResponse.put("status","success");
+ if (readOnly.equals("N")) {
+ action = "Grant Role Access";
+ } else {
+ action = "Revoke Role Access";
+ }
+ rdef.getReportSecurity().updateRoleAccess(roleId, readOnly);
+ WizardSequence ws = rdef.getWizardSequence();
+ ws.performAction(action,rdef);
+
+ return JsonResponse;
+ } catch (Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger,
+ "[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
+ return null;
+ }
+ };
+
+ @RequestMapping(value = { "/report/wizard/security/retrieveReportOwner" }, method = RequestMethod.GET)
+ public @ResponseBody List<IdNameValue> getReportOwnerInList(HttpServletRequest request)
+ throws IOException, RaptorException {
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+
+ List<IdNameValue> UserList = new ArrayList<IdNameValue>();
+ List excludeValues = new java.util.ArrayList();
+ HttpSession session = request.getSession();
+ String query = Globals.getCustomizedScheduleQueryForUsers();
+ session.setAttribute("login_id", AppUtils.getUserBackdoorLoginId(request));
+ String userId = AppUtils.getUserID(request);
+ session.setAttribute("LOGGED_USERID", userId);
+ String[] sessionParameters = Globals.getSessionParams().split(",");
+ String param = "";
+ for (int i = 0; i < sessionParameters.length; i++) {
+ param = (String) session.getAttribute(sessionParameters[0]);
+ query = Utils.replaceInString(query, "[" + sessionParameters[i].toUpperCase() + "]",
+ (String) session.getAttribute(sessionParameters[i]));
+ }
+ boolean isAdmin = AppUtils.isAdminUser(request);
+ Vector allUsers = AppUtils.getAllUsers(query, param, isAdmin);
+ Vector result = new Vector(allUsers.size());
+
+ for (Iterator iter = allUsers.iterator(); iter.hasNext();) {
+ IdNameValue value = (IdNameValue) iter.next();
+
+ boolean exclude = false;
+ for (Iterator iterE = excludeValues.iterator(); iterE.hasNext();)
+ if (((IdNameValue) iterE.next()).getId().equals(value.getId())) {
+ exclude = true;
+ break;
+ } // if
+
+ if (!exclude)
+ UserList.add(value);
+ } // for
+ return UserList;
+ }
+
+
+ @RequestMapping(value = { "/report/wizard/security/getReportSecurityInfo" }, method = RequestMethod.GET)
+ public @ResponseBody Map<String,String> getReportSecurityInfo(HttpServletRequest request)
+ throws IOException, RaptorException {
+ Map<String, String> securityInfoMap = new HashMap<String,String>();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ String isPublic = Boolean.toString(rdef.isPublic());
+ String createUser = AppUtils.getUserName(rdef.getCreateID());
+ String createDate = rdef.getCreateDate();
+ String updateUser = AppUtils.getUserName(rdef.getUpdateID());
+ String updateDate = rdef.getUpdateDate();
+ String ownerId = rdef.getOwnerID();
+
+ securityInfoMap.put("isPublic",isPublic);
+ securityInfoMap.put("createdUser",createUser);
+ securityInfoMap.put("createdDate",createDate);
+ securityInfoMap.put("updateUser",updateUser);
+ securityInfoMap.put("updatedDate",updateDate);
+ securityInfoMap.put("ownerId",ownerId);
+
+ return securityInfoMap;
+ }
+
+ @RequestMapping(value = { "/report/wizard/security/getReportSecurityUsers" }, method = RequestMethod.GET)
+ public @ResponseBody List<SecurityEntry> getReportSecurityUsers(HttpServletRequest request)
+ throws IOException, RaptorException {
+
+ List<SecurityEntry> reportUserMapList = new ArrayList<SecurityEntry>();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ Vector reportUsers = rdef.getReportUsers(request);
+ int iCount = 0;
+
+ for(Iterator iter=reportUsers.iterator(); iter.hasNext(); iCount++) {
+ Map<String, String> reportUserMap = new HashMap<String,String>();
+ SecurityEntry rUser = (SecurityEntry) iter.next();
+ reportUserMapList.add(rUser);
+ }
+
+ return reportUserMapList;
+ }
+
+
+ @RequestMapping(value = { "/report/wizard/security/getReportSecurityRoles" }, method = RequestMethod.GET)
+ public @ResponseBody List<SecurityEntry> getReportSecurityRoles(HttpServletRequest request)
+ throws IOException, RaptorException {
+
+ List<SecurityEntry> reportRoleList = new ArrayList<SecurityEntry>();
+ ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
+ Vector reportRoles = rdef.getReportRoles(request);
+ int iCount = 0;
+
+ for(Iterator iter=reportRoles.iterator(); iter.hasNext(); iCount++) {
+ SecurityEntry rRole = (SecurityEntry) iter.next();
+ reportRoleList.add(rRole);
+ }
+
+ return reportRoleList;
+ }
+
+
@RequestMapping(value = { "/report/wizard/retrieve_def_tab_wise_data/{id}",
"/report/wizard/retrieve_def_tab_wise_data/{id}/{detailId}" }, method = RequestMethod.GET)
public @ResponseBody DefinitionJSON retrieveDefTabWiseData(@PathVariable Map<String, String> pathVariables,
@@ -1063,7 +1380,7 @@ public class RaptorControllerAsync extends RestrictedBaseController {
jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
raptorResponse.data().put("elements", jsonInString);
return raptorResponse;
-
+
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.errorLogger,
"[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
@@ -1136,7 +1453,8 @@ public class RaptorControllerAsync extends RestrictedBaseController {
dvJSON.put(ds.getColumnName(c), ds.getString(r, c));
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.errorLogger,
- "[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].", ex);
+ "[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery].",
+ ex);
}
}
reportDataRows.add(dvJSON);
@@ -1161,11 +1479,11 @@ public class RaptorControllerAsync extends RestrictedBaseController {
jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(queryResultJSON);
raptorResponse.data().put("elements", jsonInString);
return raptorResponse;
-
-
+
} catch (Exception ex) {
logger.error(EELFLoggerDelegate.errorLogger,
- "[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery]. RaptorException: ", ex);
+ "[Controller.processRequest]Invalid raptor action [retrieveDataForGivenQuery]. RaptorException: ",
+ ex);
}
} catch (ReportSQLException ex) {
ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime();
@@ -1195,7 +1513,6 @@ public class RaptorControllerAsync extends RestrictedBaseController {
jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
raptorResponse.data().put("elements", jsonInString);
return raptorResponse;
-
} catch (Exception ex1) {
logger.error(EELFLoggerDelegate.errorLogger,
diff --git a/ecomp-sdk/epsdk-app-os/pom.xml b/ecomp-sdk/epsdk-app-os/pom.xml
index 3b217789..93467f64 100644
--- a/ecomp-sdk/epsdk-app-os/pom.xml
+++ b/ecomp-sdk/epsdk-app-os/pom.xml
@@ -6,7 +6,7 @@
This is NOT the Portal - but it is developed and supported by the Portal team. -->
<groupId>org.openecomp.ecompsdkos</groupId>
<artifactId>epsdk-app-os</artifactId>
- <version>1.1.0-SNAPSHOT</version>
+ <version>1.1.0</version>
<packaging>war</packaging>
<name>ECOMP SDK Webapp for OpenSource</name>
<description>ECOMP SDK Web Application for public release</description>
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml
index 28060a7c..39939ca0 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/WEB-INF/fusion/orm/Fusion.hbm.xml
@@ -266,6 +266,17 @@
<property name="siteCd" column="broadcast_site_cd" />
</class>
+ <class name="org.openecomp.portalsdk.analytics.model.base.ReportUserRole" table="cr_report_access">
+ <composite-id>
+ <key-property name="repId" column="rep_id" />
+ <key-property name="orderNo" column="order_no" />
+ </composite-id>
+
+ <property name="roleId" column="role_id"/>
+ <property name="userId" column="user_id"/>
+ <property name="readOnlyYn" column="read_only_yn"/>
+ </class>
+
<!-- State Lookup class mapping details -->
<class name="LuState" table="FN_LU_STATE">
<id name="abbr" column="state_cd" />
@@ -349,4 +360,26 @@
<query name="getAllRoles">
select id, name from Role order by name
</query>
+
+ <query name="getReportSecurityUsers">
+ select repId, orderNo, roleId, userId, readOnlyYn from ReportUserRole where repId = :report_id and userId is not null
+ </query>
+
+ <query name="getReportSecurityRoles">
+ select repId, orderNo, roleId, userId, readOnlyYn from ReportUserRole where repId = :report_id and roleId is not null
+ </query>
+
+<!-- <query name="insertReportSecurityUsers">
+ insert into ReportUserRole (repId, roleId, userId, readOnlyYn) values (:report_id, :role_id, :user_id, :read_only_yn)
+ </query> -->
+
+
+ <query name="deleteReportSecurityUsers">
+ delete from ReportUserRole where repId = :report_id and userId =:user_id
+ </query>
+
+ <query name="deleteReportSecurityRoles">
+ delete from ReportUserRole where repId = :report_id and roleId =:role_id
+ </query>
+
</hibernate-mapping>
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js
index ab073799..3196b336 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-controllers/ds2-reports/report-step-controller.js
@@ -3,7 +3,8 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
$scope.showLoader = true;
// tabs for report wizard steps:
$scope.activeTabsId = 'Definition';
-
+ $scope.addReportUserId = {'id':''};
+ $scope.addReportRoleId = {'id':''};
// For all the dropdown box, please declare the active selection variable in the following manner:
// $scope.selectedOpt = {};
// $scope.selectedOpt.value = "";
@@ -17,8 +18,95 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
$scope.showLoader = false;
});
}
+
+ $scope.addReportSecurityUser = function(userId) {
+ raptorReportFactory.addReportSecurityUser(userId).then(function(data){
+ $scope.loadSecurityPage();
+ },function(error){
+ $log.error("raptorReportFactory: addReportSecurityUser failed.");
+ });
+ }
+
+ $scope.removeReportSecurityUser = function(securityUser) {
+ var modalInstance = $modal.open({
+ scope: $scope,
+ animation: $scope.animationsEnabled,
+ templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-security-user-del-confirm.html',
+ sizeClass: 'modal-large',
+ controller: ['$scope', '$modalInstance', '$http', '$log','raptorReportFactory','securityUser', function ($scope, $modalInstance, $http, $log, raptorReportFactory,securityUser) {
+ $scope.securityUserName = securityUser.name;
+ $scope.ok = function() {
+ raptorReportFactory.removeReportSecurityUser(securityUser.id).then(function(data){
+ $modalInstance.close();
+ },function(error){
+ $log.error("raptorReportFactory: removeReportSecurityUser failed.");
+ });
+ }
+ $scope.cancel = function() {
+ $modalInstance.dismiss();
+ };
+ }],
+ resolve:{
+ securityUser: function(){
+ return securityUser;
+ }
+ }
+ });
+ modalInstance.result.then(function () {
+ $scope.loadSecurityPage();
+ }, function () {
+ });
+ };
+
+ $scope.addReportSecurityRole = function(roleId) {
+ raptorReportFactory.addReportSecurityRole(roleId).then(function(data){
+ $scope.loadSecurityPage();
+ },function(error){
+ $log.error("raptorReportFactory: addReportSecurityRole failed.");
+ });
+ }
+
+ $scope.removeReportSecurityRole = function(securityRole) {
+ var modalInstance = $modal.open({
+ scope: $scope,
+ animation: $scope.animationsEnabled,
+ templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-security-role-del-confirm.html',
+ sizeClass: 'modal-large',
+ controller: ['$scope', '$modalInstance', '$http', '$log','raptorReportFactory','securityRole', function ($scope, $modalInstance, $http, $log, raptorReportFactory,securityRole) {
+ $scope.securityRoleName = securityRole.name;
+ $scope.ok = function() {
+ raptorReportFactory.removeReportSecurityRole(securityRole.id).then(function(data){
+ $modalInstance.close();
+ },function(error){
+ $log.error("raptorReportFactory: removeReportSecurityRole failed.");
+ });
+ }
+ $scope.cancel = function() {
+ $modalInstance.dismiss();
+ };
+ }],
+ resolve:{
+ securityRole: function(){
+ return securityRole;
+ }
+ }
+ });
+ modalInstance.result.then(function () {
+ $scope.loadSecurityPage();
+ }, function () {
+ });
+ }
+ $scope.saveReportSecurityInfo = function(userId, isPublic) {
+ var securityInfo = {'userId':userId+"",'isPublic':isPublic};
+ raptorReportFactory.updateReportSecurityInfo(securityInfo).then(function(data){
+ $scope.loadSecurityPage();
+ },function(error){
+ $log.error("raptorReportFactory: updateReportSecurityInfo failed.");
+ });
+ };
+
$scope.createNewDefinition = function() {
raptorReportFactory.createNewDefinition().then(function(data){
$scope.loadDefinition(data);
@@ -322,11 +410,17 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
tabPanelId: 'threetab4x',
disabled: (!$scope.isEdit)
}, {
- title: 'Run',
- id: 'Run',
+ title: 'Security',
+ id: 'Security',
uniqueId: 'uniqueTab5x',
tabPanelId: 'threetab5x',
disabled: (!$scope.isEdit)
+ }, {
+ title: 'Run',
+ id: 'Run',
+ uniqueId: 'uniqueTab6x',
+ tabPanelId: 'threetab6x',
+ disabled: (!$scope.isEdit)
}
];
@@ -434,6 +528,26 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
}, function () {
});
};
+
+
+ $scope.throwReportNameMissingError = function () {
+ var modalInstance = $modal.open({
+ scope: $scope,
+ animation: $scope.animationsEnabled,
+ templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-wizard-report-name-validation.html',
+ sizeClass: 'modal-small',
+ controller: ['$scope', '$modalInstance', '$http', '$log', function ($scope, $modalInstance, $http, $log) {
+ $scope.close = function() {
+ $modalInstance.dismiss();
+ };
+ }]
+ });
+ modalInstance.result.then(function () {
+ }, function () {
+ });
+ };
+
+
$scope.addNewFormField = function () {
var modalInstance = $modal.open({
scope: $scope,
@@ -646,12 +760,7 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
raptorReportFactory.setDrillDownPopupOptions(null);
- $scope.complete = function() {
-
- console.log("$scope.drillDownOptionList: ");
- console.log($scope.drillDownOptionList);
-
-
+ $scope.complete = function() {
var drillDownPopupOptions= {
radioGroup : $scope.selectedvalueradioGroup.name,
reportFF: $scope.selectedChildReportFormField.value,
@@ -674,8 +783,6 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
}
}
raptorReportFactory.setDrillDownPopupOptions(reportId,drillDownParams);
- console.log(raptorReportFactory.drillDownURL);
- console.log(raptorReportFactory.drillDownParams);
$modalInstance.close();
};
@@ -703,9 +810,10 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
/* stepFormFactory.getStepJSONData(getJsonSrcName($scope.stepNum))*/
$scope.isColumnStep = false;
$scope.isFormFieldStep = false;
+ $scope.isSecurityStep = false;
$scope.renderStep(selectedTab+1);
if ($scope.stepNum == 1) {
- $scope.showLoader = false;
+ $scope.showLoader = false;
}
else if ($scope.stepNum == 2) {
loadSqlInSession();
@@ -728,6 +836,16 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
$log.error("raptorReportFactory: get formfields failed.");
$scope.showLoader = false;});
} else if ($scope.stepNum == 5) {
+ $scope.isSecurityStep = true;
+ $scope.reportOwnerId={'id':''};
+ $scope.isPublicOptionList = [
+ {'value':'true','text':'Yes'},
+ {'value':'false','text':'No'},
+ ];
+ $scope.loadSecurityPage();
+
+ }
+ else if ($scope.stepNum == 6) {
raptorReportFactory.getDefinitionInSession().then(function(data){
$scope.reportId = data.reportId;
$scope.showLoader = false;
@@ -745,6 +863,64 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
}
});
+ $scope.loadSecurityPage = function() {
+ $scope.showLoader = true;
+ raptorReportFactory.resetSecurityLoadingCounter();
+
+ //API call 1:
+ raptorReportFactory.getSecurityReportOwnerList().then(function(data){
+ $scope.reportOwnerList = data;
+ raptorReportFactory.icrementSecurityLoadingCounter();
+ if(raptorReportFactory.checkSecurityLoadingCounter()){$scope.showLoader = false;};
+ },function(error){
+ $log.error("raptorReportFactory: getSecurityReportOwnerList failed.");
+ });
+
+ //API call 2: get report role list
+ raptorReportFactory.getReportRoleList().then(function(data){
+ $scope.reportRoleList = data;
+ raptorReportFactory.icrementSecurityLoadingCounter();
+ if(raptorReportFactory.checkSecurityLoadingCounter()){$scope.showLoader = false;};
+ },function(error){
+ $log.error("raptorReportFactory: getReportRoleList failed.");
+ });
+
+ //API call 3: get security page basic info
+ raptorReportFactory.getReportSecurityInfo().then(function(data){
+ $scope.reportSecurityInfo = data;
+ $scope.reportOwnerId ={id: $scope.reportSecurityInfo.ownerId};
+ raptorReportFactory.icrementSecurityLoadingCounter();
+ if(raptorReportFactory.checkSecurityLoadingCounter()){$scope.showLoader = false;};
+ },function(error){
+ $log.error("raptorReportFactory: getReportSecurityInfo failed.");
+ $scope.showLoader = false;});
+
+ //API call 4: retrieve security users
+ raptorReportFactory.getReportSecurityUsers().then(function(data){
+ $scope.reportSecurityUsers = data;
+ for (var i=0; i<$scope.reportSecurityUsers.length;i++) {
+ $scope.reportSecurityUsers[i]["accessAllowed"] = !$scope.reportSecurityUsers[i]["readOnly"];
+ }
+ raptorReportFactory.icrementSecurityLoadingCounter();
+ if(raptorReportFactory.checkSecurityLoadingCounter()){$scope.showLoader = false;};
+ },function(error){
+ $log.error("raptorReportFactory: reportSecurityUsers failed.");
+ });
+
+ //API call 5: retrieve security roles
+ raptorReportFactory.getReportSecurityRoles().then(function(data){
+ $scope.reportSecurityRoles = data;
+ for (var i=0; i<$scope.reportSecurityRoles.length;i++) {
+ $scope.reportSecurityRoles[i]["accessAllowed"] = !$scope.reportSecurityRoles[i]["readOnly"];
+ }
+
+ raptorReportFactory.icrementSecurityLoadingCounter();
+ if(raptorReportFactory.checkSecurityLoadingCounter()){$scope.showLoader = false;};
+ },function(error){
+ $log.error("raptorReportFactory: reportSecurityRoles failed.");
+ });
+ }
+
$scope.renderStep = function(stepNum){
var containerElement = angular.element(document.getElementById("stepView"));
@@ -753,8 +929,70 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
var jsonSrcName = getJsonSrcName(stepNum);
stepFormFactory.renderForm(jsonSrcName, containerElement, $scope);
}
+
+ $scope.toggleUserEditAccessActive = function(rowData) {
+ var modalInstance = $modal.open({
+ scope: $scope,
+ animation: $scope.animationsEnabled,
+ templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-user-role-confirm-toggle.html',
+ sizeClass: 'modal-small',
+ controller: ['$scope', '$modalInstance', '$http', '$log','raptorReportFactory','rowData', function ($scope, $modalInstance, $http, $log, raptorReportFactory, rowData) {
+ $scope.rowData = rowData;
+ $scope.toggleEditAccessStatus = function(rowData) {
+ raptorReportFactory.toggleUserEditAccess(rowData);
+ $modalInstance.close();
+ };
+
+ $scope.cancelEditAccessToggle = function(rowData) {
+ rowData.accessAllowed = ! rowData.accessAllowed;
+ $modalInstance.dismiss('cancel');}
+ }],
+ resolve:{
+ rowData: function(){
+ return rowData;
+ }
+ }
+ });
+ modalInstance.result.then(function () {
+
+ }, function () {
+ });
+ }
+
+ $scope.toggleRoleEditAccessActive = function(rowData) {
+ var modalInstance = $modal.open({
+ scope: $scope,
+ animation: $scope.animationsEnabled,
+ templateUrl: 'app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-user-role-confirm-toggle.html',
+ sizeClass: 'modal-small',
+ controller: ['$scope', '$modalInstance', '$http', '$log','raptorReportFactory','rowData', function ($scope, $modalInstance, $http, $log, raptorReportFactory, rowData) {
+ $scope.rowData = rowData;
+ $scope.toggleEditAccessStatus = function(rowData) {
+ raptorReportFactory.toggleRoleEditAccess(rowData);
+ $modalInstance.close();
+ };
+
+ $scope.cancelEditAccessToggle = function(rowData) {
+ rowData.accessAllowed = ! rowData.accessAllowed;
+ $modalInstance.dismiss('cancel');}
+ }],
+ resolve:{
+ rowData: function(){
+ return rowData;
+ }
+ }
+ });
+ modalInstance.result.then(function () {
+
+ }, function () {
+ });
+ }
+
+
+
+
- // initialize the page at step 1;
+ // initialize the page at step 1;
$scope.renderStep(1);
// create a message to display in our view
@@ -835,7 +1073,7 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
}
};
- formSelect.selectAll("option").forEach(function(d) {d.forEach(function(optionD) { console.log(optionD);checkOption(optionD); }) });
+ formSelect.selectAll("option").forEach(function(d) {d.forEach(function(optionD) {checkOption(optionD); }) });
}
if(formElement[0].length == 0) {
@@ -956,12 +1194,18 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
$scope.save = function() {
if ($scope.stepNum ==1) {
updateDefinitionData();
+ } else if($scope.stepNum ==5) {
+ $scope.saveReportSecurityInfo($scope.reportOwnerId.id,$scope.reportSecurityInfo.isPublic);
}
};
//Next function
$scope.next = function(){
if ($scope.stepNum ==1) {
+ if ($scope.reportName==="") {
+ $scope.throwReportNameMissingError();
+ return;
+ }
updateDefinitionData();
}
$scope.stepNum = $scope.stepNum +1;
@@ -982,8 +1226,6 @@ appDS2.controller('reportStepController', function($scope,$http,$location, $rout
});
$scope.$on('openDrillDownpage', function(event, reportId) {
- console.log("$scope.reportId");
- console.log($scope.reportId);
if (reportId!="") {
$scope.openDrillDownReportPopup(reportId,$scope.reportId);
}
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/raptorReportFactory.js b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/raptorReportFactory.js
index b0aafdbf..83c051db 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/raptorReportFactory.js
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-services/ds2-raptor-report/raptorReportFactory.js
@@ -361,7 +361,80 @@ appDS2.factory('raptorReportFactory', function($http, $q) {
return $q.reject("raptorReportFactory: getSearchData callback failed");
});
},
-
+
+ getSecurityReportOwnerList: function() {
+ return $http
+ .get('report/wizard/security/retrieveReportOwner')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject("raptorReportFactory: getSecurityReportOwnerList did not return a valid JSON object.");
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject("raptorReportFactory: getSecurityReportOwnerList callback failed");
+ });
+ },
+ getReportRoleList: function() {
+ return $http
+ .get('report/wizard/security/retrieveReportRoleList')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject("raptorReportFactory: getReportRoleList did not return a valid JSON object.");
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject("raptorReportFactory: getReportRoleList callback failed");
+ });
+ },
+ getReportSecurityInfo: function() {
+ return $http
+ .get('report/wizard/security/getReportSecurityInfo')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject("raptorReportFactory: getReportSecurityInfo did not return a valid JSON object.");
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject("raptorReportFactory: getReportSecurityInfo callback failed");
+ });
+ },
+ getReportSecurityUsers: function() {
+ return $http
+ .get('report/wizard/security/retrieveReportUserList')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject("raptorReportFactory: getReportSecurityUsers did not return a valid JSON object.");
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject("raptorReportFactory: getReportSecurityUsers callback failed");
+ });
+ },
+
+ getReportSecurityRoles: function() {
+ return $http
+ .get('report/wizard/security/getReportSecurityRoles')
+ .then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject("raptorReportFactory: getReportSecurityUsers did not return a valid JSON object.");
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject("raptorReportFactory: getReportSecurityUsers callback failed");
+ });
+ },
+
+
getSearchDataAtPage : function(pageSearchParameter) {
return $http
.get('raptor.htm?action=report.search.execute&r_page='+pageSearchParameter)
@@ -392,6 +465,131 @@ appDS2.factory('raptorReportFactory', function($http, $q) {
// something went wrong
return $q.reject("raptorReportFactory: getReportDeleteStatus callback failed");
});
- }
+ },
+ addReportSecurityUser: function(UserId) {
+ return $http({
+ method: "POST",
+ url: "report/security/addReportUser",
+ data: UserId
+ }).then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject("raptorReportFactory: addReportSecurityUser did not return a valid JSON object.");
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject("raptorReportFactory: saveNewDefinition callback failed");
+ });
+ },
+ removeReportSecurityUser: function(UserId) {
+ return $http({
+ method: "POST",
+ url: "report/security/removeReportUser",
+ data: UserId
+ }).then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject("raptorReportFactory: removeReportSecurityUser did not return a valid JSON object.");
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject("raptorReportFactory: saveNewDefinition callback failed");
+ });
+ },
+ addReportSecurityRole: function(RoleId) {
+ return $http({
+ method: "POST",
+ url: "report/security/addReportRole",
+ data: RoleId
+ }).then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject("raptorReportFactory: addReportSecurityRole did not return a valid JSON object.");
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject("raptorReportFactory: saveNewDefinition callback failed");
+ });
+ },
+ removeReportSecurityRole: function(RoleId) {
+ return $http({
+ method: "POST",
+ url: "report/security/removeReportRole",
+ data: RoleId
+ }).then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject("raptorReportFactory: removeReportSecurityRole did not return a valid JSON object.");
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject("raptorReportFactory: removeReportSecurityRole callback failed");
+ });
+ },
+ updateReportSecurityInfo: function(securityInfo) {
+ return $http({
+ method: "POST",
+ url: "report/security/updateReportSecurityInfo",
+ data: securityInfo
+ }).then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject("raptorReportFactory: updateReportSecurityInfo did not return a valid JSON object.");
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject("raptorReportFactory: updateReportSecurityInfo callback failed");
+ });
+ },
+
+ toggleUserEditAccess: function(reportUser) {
+ var readOnly = reportUser.accessAllowed?"N":"Y";
+ return $http({
+ method: "POST",
+ url:"report/security/toggleUserEditAccess/"+reportUser.id,
+ data: readOnly
+ }).then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject("raptorReportFactory: toggleUserEditAccess did not return a valid JSON object.");
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject("raptorReportFactory: toggleUserEditAccess callback failed");
+ });
+ },
+ toggleRoleEditAccess: function(reportRole) {
+ var readOnly = reportRole.accessAllowed?"N":"Y";
+ return $http({
+ method: "POST",
+ url:"report/security/toggleRoleEditAccess/"+reportRole.id,
+ data: readOnly
+ }).then(function(response) {
+ if (typeof response.data === 'object') {
+ return response.data;
+ } else {
+ return $q.reject("raptorReportFactory: toggleRoleEditAccess did not return a valid JSON object.");
+ }
+ }, function(response) {
+ // something went wrong
+ return $q.reject("raptorReportFactory: toggleRoleEditAccess callback failed");
+ });
+ },
+ resetSecurityLoadingCounter: function() {
+ this.securityPageApiCounter = 0;
+ this.securityPageApiTotalCount = 5;
+ },
+ icrementSecurityLoadingCounter: function() {
+ this.securityPageApiCounter = this.securityPageApiCounter+1;
+ },
+ checkSecurityLoadingCounter: function() {
+ return (this.securityPageApiCounter ==this.securityPageApiTotalCount);
+ }
};
});
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-security-role-del-confirm.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-security-role-del-confirm.html
new file mode 100644
index 00000000..01d1e609
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-security-role-del-confirm.html
@@ -0,0 +1,26 @@
+<div style="height:300px">
+ <div class="b2b-modal-header ng-scope in">
+ <h2 id="myModalLabel" modal-title="">Remove Report Role</h2>
+ <div class="corner-button in">
+ <button type="button" class="close" aria-label="Close"
+ ng-click="$dismiss('cancel')"></button>
+ </div>
+ </div>
+ <div class="b2b-modal-body ng-scope ng-isolate-scope in" style="margin-bottom: -50px;">
+ <form name="workflowForm" class="css-form" novalidate>
+
+ <div class="form-row input-emphasized-field">
+ <label class="span12 input-emphasized" for="textinputID-2a">{{securityRoleName}} will be removed. Would you want to continue?</label>
+ </div>
+
+ <div class="b2b-modal-footer ng-scope ng-isolate-scope in">
+ <div class="cta-button-group in">
+ <button class="btn btn-alt btn-small" type="button" ng-click="ok()">OK</button>
+ <button class="btn btn-alt btn-small" type="button"
+ ng-click="cancel()">Cancel</button>
+ </div>
+ </div>
+ </form>
+ <br />
+ </div>
+</div> \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-security-user-del-confirm.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-security-user-del-confirm.html
new file mode 100644
index 00000000..6620fe7c
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-security-user-del-confirm.html
@@ -0,0 +1,26 @@
+<div style="height:300px">
+ <div class="b2b-modal-header ng-scope in">
+ <h2 id="myModalLabel" modal-title="">Remove Report User</h2>
+ <div class="corner-button in">
+ <button type="button" class="close" aria-label="Close"
+ ng-click="$dismiss('cancel')"></button>
+ </div>
+ </div>
+ <div class="b2b-modal-body ng-scope ng-isolate-scope in" style="margin-bottom: -50px;">
+ <form name="workflowForm" class="css-form" novalidate>
+
+ <div class="form-row input-emphasized-field">
+ <label class="span12 input-emphasized" for="textinputID-2a">{{securityUserName}} will be removed. Would you want to continue?</label>
+ </div>
+
+ <div class="b2b-modal-footer ng-scope ng-isolate-scope in">
+ <div class="cta-button-group in">
+ <button class="btn btn-alt btn-small" type="button" ng-click="ok()">OK</button>
+ <button class="btn btn-alt btn-small" type="button"
+ ng-click="cancel()">Cancel</button>
+ </div>
+ </div>
+ </form>
+ <br />
+ </div>
+</div> \ No newline at end of file
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-user-role-confirm-toggle.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-user-role-confirm-toggle.html
new file mode 100644
index 00000000..21bb046f
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/modal/report-user-role-confirm-toggle.html
@@ -0,0 +1,23 @@
+<div>
+ <div class="b2b-modal-header ng-scope in">
+ <h1><i class="icon-primary-alert"></i></h1>
+ <h2 id="myModalLabel" modal-title="">Confirm</h2>
+ <div class="corner-button in">
+ <button type="button" class="close" aria-label="Close"
+ ng-click="$dismiss('cancel')"></button>
+ </div>
+ </div>
+ <div class="b2b-modal-body ng-scope ng-isolate-scope in" tabindex="0"
+ role="region" aria-label="Modal header text content"
+ style="height: 55px;">
+ You are about to {{rowData.accessAllowed?"grant":"revoke"}} {{rowData.name}} edit access. Would you like to continue?
+ </div>
+ <div class="b2b-modal-footer ng-scope ng-isolate-scope in">
+ <div class="cta-button-group in">
+ <button class="btn btn-alt btn-medium" type="button"
+ ng-click="toggleEditAccessStatus(rowData);">Ok</button>
+ <button class="btn btn-clear btn-medium" type="button"
+ ng-click="cancelEditAccessToggle(rowData);">Cancel</button>
+ </div>
+ </div>
+</div>
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/json/step5.json b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/json/step5.json
index e1675cde..cc10114d 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/json/step5.json
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/json/step5.json
@@ -1,20 +1,12 @@
{
"step" : "5",
- "last_step": true,
- "hideSaveButton":true,
- "hideBackButton":true,
"content": {
- "title": "Step 5 : Run",
+ "title": "",
"sections": [
{
- "elements": [
- ],
- "buttons": [
- {
- "text":"Run Report",
- "value":"next",
- "ngFunction":"RunCurrentReport()"
- }]
+ "title": "",
+ "elements": [
+ ]
},
{
"title": "finalButton",
@@ -22,7 +14,6 @@
"next":"Microservice Config",
"previous":"none"
}
- ]
-
+ ]
}
}
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/json/step6.json b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/json/step6.json
new file mode 100644
index 00000000..e3b1ccce
--- /dev/null
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/json/step6.json
@@ -0,0 +1,28 @@
+{
+ "step" : "6",
+ "last_step": true,
+ "hideSaveButton":true,
+ "hideBackButton":true,
+ "content": {
+ "title": "Step 6 : Run",
+ "sections": [
+ {
+ "elements": [
+ ],
+ "buttons": [
+ {
+ "text":"Run Report",
+ "value":"next",
+ "ngFunction":"RunCurrentReport()"
+ }]
+ },
+ {
+ "title": "finalButton",
+ "submitAction" : "",
+ "next":"Microservice Config",
+ "previous":"none"
+ }
+ ]
+
+ }
+}
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/report-step.html b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/report-step.html
index 6665dcf2..9b498870 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/report-step.html
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/app/fusion/scripts/DS2-view-models/ds2-reports/wz_steps/report-step.html
@@ -9,6 +9,12 @@
}
+.noTableBorder table tbody td {
+ border: none;
+}
+.noTableBorder table tbody tr {
+ border: none;
+}
.selectWrap {
width: 300px;
}
@@ -16,6 +22,10 @@
text-align: right;
vertical-align:middle;
}
+
+.tabs.tabs-justified > li.active, .tabs.promo-tabs > li.active {
+z-index:0;
+}
</style>
<div id="page-content">
@@ -87,7 +97,6 @@
<tr ng-repeat = "rowData in formFieldData">
<td>{{$index+1}}</td>
<td>{{rowData.name}}[{{rowData.id}}]</td>
-<!-- <td>id</td> -->
<td><a ng-click="openFormFieldPopup(rowData)" class="icon-misc-pen"></a></td>
<td><a ng-click="deleteFormField(rowData)" class="icon-misc-trash"></a></td>
</tr>
@@ -95,13 +104,140 @@
</table>
</div>
+<div id="stepViewSecurity" ng-show = "isSecurityStep">
+ <h1>Step 5 : Report Security</h1>
+ <div class="noTableBorder">
+ <table class="striped">
+ <tbody>
+ <tr>
+ <td>Created By: {{reportSecurityInfo.createdUser}}</td>
+ <td>Created Date: {{reportSecurityInfo.createdDate}}</td>
+ <tr/>
+ <tr>
+ <td>Last Updated By: {{reportSecurityInfo.updateUser}}</td>
+ <td>Last Updated: {{reportSecurityInfo.updatedDate}}</td>
+ <tr/>
+ <tr>
+ <td>
+ Report Owner:
+
+ <select name="reportOwner" b2b-dropdown ng-model="reportOwnerId.id">
+ <option b2b-dropdown-list option-repeat="d in reportOwnerList" value="{{d.id}}">{{d.name}}</option>
+ </select>
+
+ </td>
+ <td>
+ Public? (All users can run the report):
+ <select name="isPublic" b2b-dropdown ng-model="reportSecurityInfo.isPublic">
+ <option b2b-dropdown-list option-repeat="d in isPublicOptionList" value="{{d.value}}">{{d.text}}</option>
+ </select>
+ </td>
+ <tr/>
+ </tbody>
+ </table>
+ </div>
+
+ <div style="margin-top:20px;">
+ <h1 style="margin-bottom:5px;">Report Users</h1>
+ <table class="striped">
+ <thead>
+ <tr>
+ <th width="10%">No</th>
+ <th width="45%">User Name</th>
+ <th width="15%">Run Access</th>
+ <th width="15%">Edit Access</th>
+ <th width="15%">Remove</th>
+ <tr/>
+ </thead>
+ <tbody>
+ <tr ng-repeat = "reportUser in reportSecurityUsers">
+ <td>{{$index+1}}</td>
+ <td>{{reportUser.name}}</td>
+ <td>
+ <label for="switch{{$index+1}}runAccess" class="btn-switch-label">
+ <input type="checkbox" role="switch" id="switch{{$index+1}}runAccess" b2b-switches ng-model=true ng-disabled=true aria-disabled=true aria-label="">
+ </label>
+ </td>
+ <td>
+ <label for="switch{{$index+1}}" class="btn-switch-label">
+ <input type="checkbox" role="switch" id="switch{{$index+1}}" b2b-switches ng-model="reportUser.accessAllowed" ng-click="toggleUserEditAccessActive(reportUser)" ng-disabled=false aria-disabled=false aria-label="">
+ </label>
+ </td>
+ <td>
+ <a class="icon-misc-trash" style="font-size: 22px;" ng-click="removeReportSecurityUser(reportUser)"> </a>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ Grant Access To:
+ </td>
+
+ <td colspan="2">
+ <select name="reportUser" b2b-dropdown ng-model="addReportUserId.id" placeholder-text="Select a User">
+ <option b2b-dropdown-list option-repeat="d in reportOwnerList" value="{{d.id}}">{{d.name}}</option>
+ </select>
+ </td>
+ <td>
+ <button class="btn btn-alt btn-small" type="button" ng-click="addReportSecurityUser(addReportUserId.id)">Add</button>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+ </div>
+
+ <div style="margin-top:20px;">
+ <h1>Report Roles</h1>
+ <table class="striped">
+ <thead>
+ <tr>
+ <th width="10%">No</th>
+ <th width="45%">Role Name</th>
+ <th width="15%">Run Access</th>
+ <th width="15%">Edit Access</th>
+ <th width="15%">Remove</th>
+ <tr/>
+ </thead>
+ <tbody>
+ <tr ng-repeat = "reportRole in reportSecurityRoles">
+ <td>{{$index+1}}</td>
+ <td>{{reportRole.name}}</td>
+ <td>
+ <label for="switch{{$index+1}}RoleRunAccess" class="btn-switch-label">
+ <input type="checkbox" role="switch" id="switch{{$index+1}}RoleRunAccess" b2b-switches ng-model=true ng-disabled=true aria-disabled=true aria-label="">
+ </label>
+ </td>
+ <td>
+ <label for="switch{{$index+1}}RoleEditAccess" class="btn-switch-label">
+ <input type="checkbox" role="switch" id="switch{{$index+1}}RoleEditAccess" b2b-switches ng-model="reportRole.accessAllowed" ng-click="toggleRoleEditAccessActive(reportRole)" ng-disabled=false aria-disabled=false aria-label="">
+ </label>
+ </td>
+ <td>
+ <a class="icon-misc-trash" ng-click="removeReportSecurityRole(reportRole)" style="font-size: 22px;"> </a>
+
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ Grant Access To:
+ </td>
+ <td colspan="2">
+ <select name="reportOwner" b2b-dropdown ng-model="addReportRoleId.id" placeholder-text="Select a Role">
+ <option b2b-dropdown-list option-repeat="d in reportRoleList" value="{{d.id}}">{{d.name}}</option>
+ </select>
+ </td>
+ <td>
+ <button class="btn btn-alt btn-small" type="button" ng-click="addReportSecurityRole(addReportRoleId.id)">Add</button>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+</div>
+
<div id="stepView">
-<!-- <step-form ng-model="jsonSrcName" renderForm="changeme"></step-form> -->
</div>
</div>
-<!-- <select id="dropdown1" name="dropdown1" b2b-dropdown placeholder-text="Select" ng-model="selectedReportType.value">
- <option b2b-dropdown-list option-repeat="d in reportTypes" value="{{d.value}}">{{d.text}}</option>
-</select>
-<h1>{{selectedReportType.value}}</h1> -->
</div>