Initial OpenECOMP policy/engine commit
[policy/engine.git] / ecomp-sdk-app / src / main / webapp / WEB-INF / fusion / raptor / wizard_user_access.jsp
1 <%--
2   ================================================================================
3   eCOMP Portal SDK
4   ================================================================================
5   Copyright (C) 2017 AT&T Intellectual Property
6   ================================================================================
7   Licensed under the Apache License, Version 2.0 (the "License");
8   you may not use this file except in compliance with the License.
9   You may obtain a copy of the License at
10   
11        http://www.apache.org/licenses/LICENSE-2.0
12   
13   Unless required by applicable law or agreed to in writing, software
14   distributed under the License is distributed on an "AS IS" BASIS,
15   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   See the License for the specific language governing permissions and
17   limitations under the License.
18   ================================================================================
19   --%>
20 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
21 <%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
22 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
23 <%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
24 <%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
25 <%@ page import="java.util.Vector" %>
26 <%@ page import="java.util.List" %>
27 <%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
28 <%@ page import="java.util.Iterator" %>
29 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %>
30 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %>
31 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %>
32 <%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
33 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %>
34 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
35 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableJoin" %>
36 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.SecurityEntry" %>
37 <%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
38
39 <%      
40     ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
41     WizardSequence ws = rdef.getWizardSequence();
42     String curSubStep = ws.getCurrentSubStep();
43 %>  
44 <table width="100%"  class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
45         <tr>
46                 <td class=rbg1 colspan=4 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
47         </tr>
48         <tr>
49                 <td class=rbg2 align="right" width="16%" height="30"><font class=rtabletext>Created By: </font></td> 
50                 <td class=rbg3 align="left" width="34%" valign="middle" nowrap><font class=rtabletext><%= AppUtils.getUserName(rdef.getCreateID()) %></font></td>
51                 <td class=rbg2 align="right" width="16%"><font class=rtabletext>Created Date: </font></td> 
52                 <td class=rbg3 align="left" width="34%" valign="middle" nowrap><font class=rtabletext><%= rdef.getCreateDate() %></font></td>
53         </tr> 
54         <tr>
55                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Last Updated By: </font></td> 
56                 <td class=rbg3 align="left" valign="middle" nowrap><font class=rtabletext><%= AppUtils.getUserName(rdef.getUpdateID()) %></font></td>
57                 <td class=rbg2 align="right"><font class=rtabletext>Last Updated: </font></td> 
58                 <td class=rbg3 align="left" valign="middle" nowrap><font class=rtabletext><%= rdef.getUpdateDate() %></font></td>
59         </tr> 
60         <tr>
61                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Report Owner: </font></td> 
62                 <td class=rbg3 align="left"><font class=rtabletext>
63                         <select name="reportOwner">
64 <%                      Vector allUsers = Utils.getUsersNotInList(new java.util.ArrayList(),request);
65                         for(int i=0; i<allUsers.size(); i++) {
66                                 IdNameValue user = (IdNameValue) allUsers.get(i); %>
67                             <option value="<%= user.getId() %>"<%= user.getId().equals(rdef.getOwnerID())?" selected":"" %>><%= user.getName() %>
68 <%                      }       // for 
69 %>
70                         </select></font>
71                 </td>
72                 <td class=rbg2 align="right"><font class=rtabletext>Public? (All users can run the report)</font></td> 
73                 <td class=rbg3 align="left">
74                         <select name="public" >
75                                 <option value="Y"<%= rdef.isPublic()?" selected":"" %>>Yes
76                                 <option value="N"<%= rdef.isPublic()?"":" selected" %>>No
77                         </select>
78                 </td>
79         </tr>
80 </table>
81 <br>
82
83 <table class="mTAB" width="100%" border="0" cellspacing="1" cellpadding="3" align=center>
84         <tr>
85                 <td class=rbg1 colspan=5 valign="Middle"><b class=rtableheader>Report Users</b></td>
86         </tr>
87         <tr class=rbg1>
88                 <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
89                 <td align="center" valign="Middle" width="59%"><b class=rtableheader>User Name</b></td>
90                 <td align="center" valign="Middle" width="10%"><b class=rtableheader>Run Access</b></td>
91                 <td align="center" valign="Middle" width="10%"><b class=rtableheader>Edit Access</b></td>
92                 <td align="center" valign="Middle" width="14%"><b class=rtableheader>Remove</b></td>
93         </tr>
94 <%      int iCount = 0;
95         Vector reportUsers = rdef.getReportUsers(request);
96         for(Iterator iter=reportUsers.iterator(); iter.hasNext(); iCount++) { 
97                 SecurityEntry rUser = (SecurityEntry) iter.next(); %>
98         <tr class="<%=((iCount % 2 == 0)?"rowalt1":"rowalt2")%>">
99                 <td align="center" height="30"><font class=rtabletext><%= iCount+1 %></font></td>
100                 <td><font class=rtabletext><%= rUser.getName() %></font></td>
101                 <td align="center" valign="Middle"><img src="<%= AppUtils.getImgFolderURL() %>active.gif" width="16" height="16" border="0"></td>
102                 <td align="center" valign="Middle"><input type="image" src="<%= AppUtils.getImgFolderURL() %><%= rUser.isReadOnly()?"inactive.gif":"active.gif" %>" alt="<%= rUser.isReadOnly()?"Grant":"Revoke" %> edit access" width="16" height="16" border="0" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= rUser.isReadOnly()?AppConstants.WA_GRANT_USER:AppConstants.WA_REVOKE_USER %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= rUser.getId() %>';"></td>
103                 <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! confirm('Are you sure you want to remove user <%= rUser.getName() %>?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_USER %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= rUser.getId() %>'; }"></td>
104         </tr>
105 <%      }   // for
106 //      if(iCount==0) { %>
107         <!--tr class=rbg2>
108                 <td colspan=5 align="center" height="30"><font class=rtabletext>No user access defined</font></td>
109         </tr-->
110 <%      //}
111         Vector remainingUsers = Utils.getUsersNotInList(reportUsers,request);
112         if(remainingUsers.size()>0) { %>
113         <tr>
114                 <td class=rbg1 colspan=5 valign="Middle" nowrap><b class=rtableheader>Grant Access To&nbsp;
115                         <select name="newUserId" onChange="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_USER %>'; document.forma.submit();">
116                             <option value="" selected>--- Select User ---
117 <%                      for(int i=0; i<remainingUsers.size(); i++) {
118                                 IdNameValue user = (IdNameValue) remainingUsers.get(i); %>
119                             <option value="<%= user.getId() %>"><%= user.getName() %>
120 <%                      }       // for 
121 %>
122                         </select></b>
123                 </td>
124 <%      }       // if 
125 %>
126         </tr>
127 </table>
128 <br>
129
130 <table class="mTAB" width="100%" border="0" cellspacing="1" cellpadding="3" align=center>
131         <tr>
132                 <td class=rbg1 colspan=5 valign="Middle"><b class=rtableheader>Report Roles</b></td>
133         </tr>
134         <tr class=rbg1>
135                 <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader>&nbsp;&nbsp;No&nbsp;&nbsp;</b></td>
136                 <td align="center" valign="Middle" width="59%"><b class=rtableheader>Role Name</b></td>
137                 <td align="center" valign="Middle" width="10%"><b class=rtableheader>Run Access</b></td>
138                 <td align="center" valign="Middle" width="10%"><b class=rtableheader>Edit Access</b></td>
139                 <td align="center" valign="Middle" width="14%"><b class=rtableheader>Remove</b></td>
140         </tr>
141 <%      iCount = 0;
142         Vector reportRoles = rdef.getReportRoles(request);
143         for(Iterator iter=reportRoles.iterator(); iter.hasNext(); iCount++) { 
144                 SecurityEntry rRole = (SecurityEntry) iter.next(); %>
145         <tr class="<%=((iCount % 2 == 0)?"rowalt1":"rowalt2")%>">
146                 <td align="center" height="30"><font class=rtabletext><%= iCount+1 %></font></td>
147                 <td><font class=rtabletext><%= rRole.getName() %></font></td>
148                 <td align="center" valign="Middle"><img src="<%= AppUtils.getImgFolderURL() %>active.gif" width="16" height="16" border="0"></td>
149                 <td align="center" valign="Middle"><input type="image" src="<%= AppUtils.getImgFolderURL() %><%= rRole.isReadOnly()?"inactive.gif":"active.gif" %>" alt="<%= rRole.isReadOnly()?"Grant":"Revoke" %> edit access" width="16" height="16" border="0" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= rRole.isReadOnly()?AppConstants.WA_GRANT_ROLE:AppConstants.WA_REVOKE_ROLE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= rRole.getId() %>';"></td>
150                 <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! confirm('Are you sure you want to remove role <%= rRole.getName() %>?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_ROLE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= rRole.getId() %>'; }"></td>
151         </tr>
152 <%      }   // for
153 //      if(iCount==0) { %>
154         <!--tr class=rbg2>
155                 <td colspan=5 align="center" height="30"><font class=rtabletext>No role access defined</font></td>
156         </tr-->
157 <%      //}
158         Vector remainingRoles = Utils.getRolesNotInList(reportRoles,request); 
159         if(remainingRoles.size()>0) { %>
160         <tr>
161                 <td class=rbg1 colspan=5 valign="Middle" nowrap><b class=rtableheader>Grant Access To&nbsp;
162                         <select name="newRoleId" onChange="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_ROLE %>'; document.forma.submit();">
163                             <option value="" selected>--- Select Role ---
164 <%                      for(int i=0; i<remainingRoles.size(); i++) {
165                                 IdNameValue role = (IdNameValue) remainingRoles.get(i); %>
166                             <option value="<%= role.getId() %>"><%= role.getName() %>
167 <%                      }       // for 
168 %>
169                         </select></b>
170                 </td>
171 <%      }       // if 
172 %>
173         </tr>
174 </table>
175 <br>
176
177 <script language="JavaScript">
178 <!--
179 function dataValidate() {
180         return true;
181 }   // dataValidate
182 //-->
183 </script>
184