File: accounts.vspx

package info (click to toggle)
virtuoso-opensource 7.2.5.1%2Bdfsg1-0.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 285,240 kB
  • sloc: ansic: 641,220; sql: 490,413; xml: 269,570; java: 83,893; javascript: 79,900; cpp: 36,927; sh: 31,653; cs: 25,702; php: 12,690; yacc: 10,227; lex: 7,601; makefile: 7,129; jsp: 4,523; awk: 1,697; perl: 1,013; ruby: 1,003; python: 326
file content (345 lines) | stat: -rw-r--r-- 11,888 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<?xml version="1.0" encoding="UTF-8"?>
<!--
 -
 -  $Id$
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -
 -  Copyright (C) 1998-2018 OpenLink Software
 -
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -
-->
<v:page name="blog-home-page"
        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
        xmlns:v="http://www.openlinksw.com/vspx/"
        style="index.xsl"
        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
	fast-render="1">
  <vm:page>
    <vm:header>
      <vm:title>User Accounts Administration</vm:title>
    </vm:header>
    <v:on-init>
      if(wa_user_is_dba (connection_get('vspx_user'),null)=0)
         signal('22024', 'You have no DBA privileges!');
    </v:on-init>

    <vm:pagewrapper>
      <vm:variable persist="0" name="account_folder_mask" type="varchar" default="'00000000000000000000000000'"/>
      <vm:variable persist="0" name="search_mask" type="varchar" default="'%'"/>
      <vm:variable persist="0" name="pattern_value" type="varchar" default="''"/>
      <vm:variable persist="0" name="pattern_where" type="varchar" default="'1'"/>
      <vm:variable persist="0" name="filt_state" type="varchar" default="'all'"/>
      <vm:variable persist="temp" name="r_count" type="integer" default="0"/>
      <vm:variable name="ord" type="varchar" default="'name'" />
      <vm:variable name="ordseq" type="varchar" default="'asc'" />
      <vm:navigation on="settings"/>
      <vm:rawheader caption="User Accounts Administration"/>
      <vm:body>
	  <v:method name="set_ord" arglist="in x any, inout e vspx_event, inout ds vspx_control"><![CDATA[
		if (self.ord = x)
		  {
		    if (self.ordseq = 'asc')
		      self.ordseq := 'desc';
		    else
		      self.ordseq := 'asc';
		  }
		else
		  {
		    self.ord := x;
		    self.ordseq := 'asc';
		  }
		if (ds is not null)
		  ds.vc_data_bind (e);
	      ]]></v:method>
        <vm:login redirect="index.vspx"/>
    <table align="left">
      <tr>
        <td>
            <table class="ctl_grp">
              <tr>
                <td><img src="images/icons/filter_32.png"/></td>
		<td valign="top">
		  <table border="0" cellpadding="0">
		    <tr>
		      <td>
			Show users
		      </td>
		      <td>
			<v:select-list name="howto" value="--self.pattern_where">
			  <v:item name="Starting with" value="1" />
			  <v:item name="Containing" value="2" />
			  <v:item name="Ending with" value="3" />
			  <v:item name="Exact match" value="4" />
			</v:select-list>
		      </td>
		    </tr>
		    <tr>
		      <td>
			Show
		      </td>
		      <td>
			<v:select-list name="filt_state1" value="--self.filt_state" auto-submit="1">
			  <v:item name="All" value="all"/>
			  <v:item name="Frozen" value="frozen" />
			  <v:item name="Active users" value="active"/>
			  <v:on-post>
			    if (e.ve_initiator = control)
			      {
			        self.filt_state := self.filt_state1.ufl_value;
			        self.ds.vc_reset ();
			        self.ds.vc_data_bind (e);
		              }
			  </v:on-post>
			</v:select-list>
		      </td>
		    </tr>
		  </table>
		</td>
                <td valign="top">
                  <v:text name="pattern_text" value="--self.pattern_value"/>
                </td>
                <td valign="center">
                  <v:button name="submit1" action="simple" value="Filter">
                    <v:on-post>
                      <v:script>
                        <![CDATA[

			self.pattern_where := self.howto.ufl_value;
			self.pattern_value := self.pattern_text.ufl_value;
			self.search_mask := case self.pattern_where
			when '1' then self.pattern_value || '%'
			when '2' then '%' || self.pattern_value || '%'
			when '3' then '%' || self.pattern_value
			else self.pattern_value end;
			self.filt_state := self.filt_state1.ufl_value;

			if (self.search_mask = '')
			self.search_mask := '%';
			self.ds.vc_reset ();
			self.ds.vc_data_bind (e);

			]]>
		      </v:script>
		    </v:on-post>
		  </v:button>
		</td>
		<td valign="center">
		  <v:button name="reset" action="simple" value="Clear">
		    <v:on-post>
		      <v:script>
			<![CDATA[

			self.pattern_where := '1';
			self.pattern_value := '%';
			self.search_mask := '%';
			self.filt_state := 'all';
			self.howto.vc_data_bind (e);
			self.pattern_text.ufl_value := '';
			self.ds.vc_reset ();
			self.ds.vc_data_bind (e);

                         ]]>
                       </v:script>
                     </v:on-post>
                   </v:button>
                 </td>
	       </tr>
             </table>
         </td>
       </tr>
       <tr>
	 <td>
	   <div class="scroll_area">
	       <v:on-post><![CDATA[
		 if (control = e.ve_button and e.ve_initiator is not null and e.ve_initiator.vc_name = 'cbc')
		   {
		     declare cb vspx_check_box;
                     declare flag int;
		     declare uname varchar;
		     declare rows any;

		     cb := e.ve_initiator;
		     uname := cb.ufl_value;
		     if (get_keyword (cb.vc_get_name(), e.ve_params) is null)
		       {
		         flag := 1;
			 cb.ufl_selected := 0;
		       }
		     else
                       {
			 cb.ufl_selected := 1;
		         flag := 0;
		       }

		     USER_SET_OPTION (uname, 'DISABLED', flag);
		     delete from VSPX_SESSION where VS_UID = uname;

		     update DB.DBA.WA_INSTANCE set WAI_IS_FROZEN = flag
		       where WAI_NAME in
		       (select WAM_INST from WA_MEMBER, SYS_USERS where WAM_USER = U_ID and U_NAME = uname
		       and WAM_MEMBER_TYPE = 1);

		     rows := (cb.vc_parent as vspx_row_template).te_rowset;
		     rows[2] := flag;
		     (cb.vc_parent as vspx_row_template).te_rowset := rows;

		   }
	   ]]></v:on-post>
           <v:data-set name="ds"
	     sql="select U_NAME, U_FULL_NAME, U_ACCOUNT_DISABLED, U_ID from WA_SYS_USERS where mask = :self.search_mask
	     and ord = :self.ord and seq = :self.ordseq and what = :self.filt_state and U_NAME not in ('dav', 'dba', 'nobody')"
                       nrows="1000"
                       scrollable="1"
                       cursor-type="static"
                       edit="0"
                       width="80"
                       initial-enable="1">
             <v:column name="U_FULL_NAME"/>
             <v:column name="U_NAME"/>
             <v:column name="U_ACCOUNT_DISABLED"/>
             <v:column name="U_ID"/>
             <v:template name="u_lst_head_tmpl"
                         type="simple"
                         name-to-remove="table"
                         set-to-remove="bottom">
               <table class="listing">
                 <tr class="listing_header_row">
		   <th>
			      <v:button action="simple" name="name_ord1" value="Login name" style="url">
				  <v:on-post><![CDATA[
				      self.set_ord ('name', e, self.ds);
				      ]]></v:on-post>
			      </v:button>
		   </th>
                   <th>Enabled</th>
		   <th>
			      <v:button action="simple" name="name_ord2" value="Full Name" style="url">
				  <v:on-post><![CDATA[
				      self.set_ord ('fullname', e, self.ds);
				      ]]></v:on-post>
			      </v:button>
		   </th>
                   <!--th>Actions
                   </th-->
                 </tr>
               </table>
             </v:template>
             <v:template name="u_lst_no_match_tmpl"
                         type="repeat"
                         name-to-remove=""
                         set-to-remove="">
               <v:template name="template7"
                           type="if-not-exists"
                           name-to-remove="table"
                           set-to-remove="both">
                 <table>
                   <tr>
                     <td class="listing_count" colspan="5">
                       No user names match given pattern
                     </td>
                   </tr>
                 </table>
               </v:template>

               <v:template name="u_lst_body_tmpl"
                           type="browse"
                           name-to-remove="table"
                           set-to-remove="both">
                 <table class="listing">
<?vsp
  self.r_count := self.r_count + 1;
  http (sprintf ('<tr class="%s">',
                 case when mod (self.r_count, 2) then 'listing_row_odd'
                      else 'listing_row_even'
                      end));
?>
                   <!-- tr -->
                     <td class="listing_col" nowrap="1">
                       <img src="images/icons/user_16.png"
                            alt="User"
                            title="User"/>
                       <v:label name="label6"
                                value="--(control.vc_parent as vspx_row_template).te_rowset[0]"
				format="%s"/>
			    </td>
			    <td>
		       <v:check-box auto-submit="1" name="cbc" xhtml_id="--control.vc_get_name ()"
			       initial-checked="--equ ((control.vc_parent as vspx_row_template).te_rowset[2], 0)"
			       value="--(control.vc_parent as vspx_row_template).te_rowset[0]">
 		       </v:check-box>
                      </td>
                      <td class="listing_col" nowrap="1">
                        <v:label name="label5"
                                 value="--(control.vc_parent as vspx_row_template).te_rowset[1]"
                                 format="%s"
                                 width="80"/>
                      </td>
                      <!--td class="listing_col_action">
                        <v:button action="simple" style="url" name="modf"
			  value="-#-case when (control.vc_parent as vspx_row_template).te_rowset[2] = 0
			           then 'Disable' else 'Enable' end"
			       enabled="-#-case when (control.vc_parent as vspx_row_template).te_rowset[0]
			                  in ('dba', 'dav') then 0 else 1 end"
			       >
			       <v:on-post>
				 declare flag, u_id, u_name int;

				 flag := equ ((control.vc_parent as vspx_row_template).te_rowset[2], 0);
				 u_id := (control.vc_parent as vspx_row_template).te_rowset[3];
				 u_name := (control.vc_parent as vspx_row_template).te_rowset[0];

				 USER_SET_OPTION (u_name, 'DISABLED', flag);
				 delete from VSPX_SESSION where VS_UID = u_name;

				 update DB.DBA.WA_INSTANCE set WAI_IS_FROZEN = flag
				   where WAI_NAME in (select WAM_INST from WA_MEMBER where WAM_USER = u_id
				   and WAM_MEMBER_TYPE = 1);

				 self.ds.vc_data_bind (e);
			       </v:on-post>
			</v:button>
                      </td-->
<?vsp
              http('</tr>');
?>
                  </table>
                </v:template>

              </v:template>

              <v:template name="template3111"
                          type="simple"
                          name-to-remove="table"
                          set-to-remove="top">
                <table class="ds_browse_ctls">
                  <tr>
                    <td colspan="3" align="center" class="listing_col_action">
			<vm:ds-navigation data-set="ds"/>
                    </td>
                  </tr>
                </table>
              </v:template>
	    </v:data-set>
	  </div>
          </td>
        </tr>
      </table>
      </vm:body>
    </vm:pagewrapper>
  </vm:page>
</v:page>