File: sparql_acl.vspx

package info (click to toggle)
virtuoso-opensource 6.1.4%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 245,116 kB
  • sloc: ansic: 639,631; sql: 439,225; xml: 287,085; java: 61,048; sh: 38,723; cpp: 36,889; cs: 25,240; php: 12,562; yacc: 9,036; lex: 7,149; makefile: 6,093; jsp: 4,447; awk: 1,643; perl: 1,017; ruby: 1,003; python: 329
file content (254 lines) | stat: -rw-r--r-- 10,403 bytes parent folder | download
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
<?xml version="1.0" encoding="UTF-8"?>
<!--
 -
 -  $Id: sparql_acl.vspx,v 1.3.2.4 2010/09/20 10:15:36 source Exp $
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -
 -  Copyright (C) 1998-2006 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/"
    doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
      <head>
	<title>FOAF+SSL ACLs</title>
	<link rel="stylesheet" type="text/css" href="default.css" />
      </head>
      <v:variable persist="temp" name="msg_msg" type="varchar" default="''"/>
      <v:variable name="edit_oauth" type="varchar" default="null" param-name="edit" />
      <v:variable name="del_oauth" type="varchar" default="null" param-name="del" />
      <v:variable name="u_id" type="int" default="null" />
      <v:variable name="apps" type="any" default="null" persist="temp"/>
      <v:login name="login1" realm="wa" mode="url" user-password-check="OAUTH..web_user_password_check">
	<v:template type="if-no-login" name="if_no_login" redirect="login.vspx"/>
	<v:template type="if-login" name="if_login">
	</v:template>
	<v:after-data-bind><![CDATA[
	  self.apps := vector ();
	  if (control.vl_authenticated)
	    {
	      declare ndata any;
	      set isolation = 'committed';
	      if (connection_get ('vspx_user') <> 'dba')
	        {
                  self.sid := null;
                  control.vl_authenticated := 0;
		  self.vc_redirect (sprintf ('login.vspx?URL=%U', 'sparql_acl.vspx'));
		  return;
		}
	    }
	    ]]></v:after-data-bind>
      </v:login>
      <body>
	<div id="MD">
	  <h1>FOAF+SSL ACLs</h1>
<?vsp
  if (not self.vc_is_valid)
    {
?>
<div class="error_msg" id="page_error_msg"><?vsp self.vc_error_summary (0); ?></div>
<?vsp
} ?>
	  <div class="message"><v:label name="pwd_msg" value="--self.msg_msg" /></div>
	  <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
	    <tr valign='top'>
	      <td>
		<table cellpadding='10' cellspacing='0' border='0' width='100%'>
		  <tr>
		    <td class="tab_deck">
		      <v:form type="simple" method="POST">
			<table class="listing" rules="groups">
			  <colgroup>
			    <col/>
			    <col/>
			    <col/>
			  </colgroup>
			  <tr class="listing_header_row">
			    <th>Web ID</th>
			    <th>Role</th>
			    <th>Action</th>
			  </tr>
			  <v:data-set name="oauth" sql="select g.U_NAME, FS_URI from FOAF_SSL_ACL left outer join  SYS_USERS u on (u.U_NAME = FS_UID)
			      	join SYS_USER_GROUP on (u.U_ID = UG_UID) join SYS_USERS g on (g.U_ID = UG_GID)" scrollable="1" editable="1" nrows="1000">
			    <v:before-data-bind>
                        if (not e.ve_is_post and self.del_oauth is not null)
                        {
			  declare uid varchar;
                          uid := (select FS_UID from FOAF_SSL_ACL where FS_URI = self.del_oauth);
                          delete from FOAF_SSL_ACL where FS_URI = self.del_oauth;
			  if (uid like 'SPUID%')
			    USER_DROP (uid);
			  self.vc_redirect ('sparql_acl.vspx');
                        }
                		  </v:before-data-bind>

				  <v:template name="maps_rep" type="repeat">
				    <v:template name="template7" type="if-not-exists">
				      <tr><td colspan="4">No applications registered</td></tr>
				    </v:template>
                		    <v:template name="maps_brows" type="browse">
            <v:after-data-bind>
              if (not e.ve_is_post and control.te_rowset[1] = self.edit_oauth)
              {
                self.webid.ufl_value := control.te_rowset[1];
                self.rol.ufl_value := control.te_rowset[0];
              }
            </v:after-data-bind>
					<tr class="<?V case when self.edit_oauth = control.te_rowset[1] then 'listing_row_selected'
					    when mod(control.te_ctr, 2) then 'listing_row_odd' else 'listing_row_even' end ?>">
                			    <td>
                				    <v:label name="la2" value="--(control.vc_parent as vspx_row_template).te_rowset[1]"
                				      format="%s" render-only="1"/>

                			    </td>
                			    <td>
                				    <v:label name="ur1"
                				      format="%s"
                				      value="--(control.vc_parent as vspx_row_template).te_rowset[0]"
                				    />
                			    </td>
                			    <td>
                				    <v:url name="ur3" value='<img src="images/edit_16.png" hspace="3" border="0"/>Edit'
                				      format="%s"
                				      url="--sprintf ('sparql_acl.vspx?edit=%U', (control.vc_parent as vspx_row_template).te_rowset[1])"
                				      xhtml_title="Edit"
                				      xhtml_alt="Edit"
                				      />
                				    <v:url name="ur2" value='<img src="images/del_16.png" hspace="3" border="0"/>Delete'
                				      format="%s"
                				      url="--sprintf ('sparql_acl.vspx?del=%U', (control.vc_parent as vspx_row_template).te_rowset[1])"
                				      xhtml_title="Delete"
                				      xhtml_alt="Delete"
                				      />
                			    </td>
                			  </tr>
                		    </v:template>
                		  </v:template>

                		  <v:template name="maps_footer" type="simple">
                		  <tr>
                			  <td colspan="4" class="listing_col_action">
                			    <vm:ds-navigation data-set="oauth" type="set" />
                			  </td>
                		  </tr>
                		  </v:template>
                	  </v:data-set>
                	  </table>
                  	  <div class="fm">
			      <fieldset>
		              Web ID: <v:text name="webid" value="" xhtml_size="100"/>
			      <v:button action="browse" name="sel_id" value="Browse" selector="sel_user.vspx"
				  child-window-options="scrollbars=yes, menubar=no, height=630, width=600"
				  enabled="--coalesce ((select top 1 1 from SYS_KEYS where KEY_TABLE = 'DB.DBA.WA_USER_INFO'), 0)">
				  <v:field name="webid"/>
 			      </v:button>
				  <br/>
			      SPARQL Role: <v:select-list name="rol">
				  <v:item name="SELECT" value="SPARQL_SELECT"/>
				  <v:item name="SPONGE" value="SPARQL_SPONGE"/>
				  <v:item name="UPDATE" value="SPARQL_UPDATE"/>
			      </v:select-list>
			      <!-- SQL Account: <v:text name="acc" value="" xhtml_size="100"/--><br/>
                 	      <span class="fm_ctl_btn">
				      <v:button name="cancel2" value="Cancel" action="simple" enabled="--equ(isnull(self.edit_oauth),0)">
					  <v:on-post>

					      self.webid.ufl_value := null;
					      self.rol.ufl_value := null;

					      self.edit_oauth := null;
					      self.save1.vc_data_bind (e);
					      control.vc_enabled := 0;
					  </v:on-post>
				      </v:button>
				  </span>
                 	      <span class="fm_ctl_btn">
                  		  <v:button name="save1" value="--case when self.edit_oauth is not null then 'Update' else 'Register' end" action="simple">
				      <v:on-post><![CDATA[
					  declare uid, orole varchar;
					  self.webid.ufl_value := trim (self.webid.ufl_value);
					  if (0 = length (self.webid.ufl_value))
					    {
  					      self.vc_is_valid := 0;
					      self.vc_error_message := 'Web ID could not be empty';
					      return;
					    }
					  if (0 = FOAF_CHECK_WEBID (self.webid.ufl_value))
                                            {
					      self.vc_is_valid := 0;
                                              self.vc_error_message := 'The WebID is inaccessible or does not contain certificate properties';
					      return;
					    }
					  if (self.edit_oauth is null)
                                            {
					      if (exists (select 1 from FOAF_SSL_ACL where FS_URI = self.webid.ufl_value))
					    {
  					      self.vc_is_valid := 0;
						  self.vc_error_message := 'This Web ID is alredy registered';
					      return;
					    }
					      uid := sprintf ('SPUID%d', sequence_next ('__SPUID'));
					      USER_CREATE (uid, uuid());
					      USER_GRANT_ROLE (uid, self.rol.ufl_value);
					      USER_SET_OPTION (uid, 'DISABLED', 1);
					      insert into FOAF_SSL_ACL (FS_URI, FS_UID) values (self.webid.ufl_value, uid);
					    }
                                          else
					    {
					      uid := (select FS_UID from FOAF_SSL_ACL where FS_URI = self.edit_oauth);
					      orole := (select  g.U_NAME from SYS_USERS u join SYS_USER_GROUP on (u.U_ID = UG_UID)
					      		join SYS_USERS g on (g.U_ID = UG_GID) where u.U_NAME = uid);
					      USER_REVOKE_ROLE (uid, orole);
					      USER_GRANT_ROLE (uid, self.rol.ufl_value);
					    }

					  self.vc_redirect ('sparql_acl.vspx');
                          ]]></v:on-post>
                  		  </v:button>
                	      </span>
                  	  </fieldset>
		      </div>
		    </v:form>
		    <br/>
		    <div><v:url name="uh" value="Back to main menu" url="/policy_manager/" /></div>
	      </td>
	  </tr>
      </table>
  </td>
	</tr>
    </table>
</div>
<div id="FT">
    <div id="FT_L">
	<a href="http://www.openlinksw.com/virtuoso">
	    <img alt="Powered by OpenLink Virtuoso Universal Server"
		src="images/virt_power_no_border.png"
		border="0" />
	</a>
      </div>
	<div id="FT_RC">
	  <div id="copyright_ctr">Copyright &amp;copy; 1998-<?V "LEFT" (datestring (now()), 4) ?> OpenLink Software</div>
        </div> <!-- FT_R -->
</div>

      </body>
  </html>
</v:page>