Changeset 221 for branches/acl/cgi-bin
- Timestamp:
- 04/13/05 13:24:15 (20 years ago)
- Location:
- branches/acl/cgi-bin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/acl/cgi-bin/IPDB.pm
r189 r221 23 23 @EXPORT_OK = qw( 24 24 %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist @masterblocks 25 %allocated %free %routed %bigfree 25 %allocated %free %routed %bigfree %IPDBacl 26 26 &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock &deleteBlock 27 27 &mailNotify … … 31 31 %EXPORT_TAGS = ( ALL => [qw( 32 32 %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist 33 @masterblocks %allocated %free %routed %bigfree 33 @masterblocks %allocated %free %routed %bigfree %IPDBacl 34 34 &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock 35 35 &deleteBlock &mailNotify … … 50 50 our %routed; 51 51 our %bigfree; 52 our %IPDBacl; 52 53 53 54 # Let's initialize the globals. … … 83 84 $sth = $dbh->prepare("select cidr from masterblocks order by cidr"); 84 85 $sth->execute; 86 return (undef,$sth->errstr) if $sth->err; 85 87 for (my $i=0; my @data = $sth->fetchrow_array(); $i++) { 86 88 $masterblocks[$i] = new NetAddr::IP $data[0]; … … 91 93 $routed{"$masterblocks[$i]"} = 0; 92 94 } 95 96 # Load ACL data. Specific username checks are done at a different level. 97 $sth = $dbh->prepare("select username,acl from users"); 98 $sth->execute; 93 99 return (undef,$sth->errstr) if $sth->err; 100 while (my @data = $sth->fetchrow_array) { 101 $IPDBacl{$data[0]} = $data[1]; 102 } 94 103 95 104 return (1,"OK"); -
branches/acl/cgi-bin/ipdb.psql
r189 r221 182 182 pr Dynamic-route DSL netblock Dynamic-route DSL 203 183 183 \. 184 185 186 -- 187 -- User data table - required for proper ACLs 188 -- 189 190 CREATE TABLE "users" ( 191 "user" varchar(16) NOT NULL PRIMARY KEY, 192 "password" varchar(16) DEFAULT '', 193 "acl" varchar(16) DEFAULT 'b' 194 ); -
branches/acl/cgi-bin/main.cgi
r214 r221 22 22 openlog "IPDB","pid","local2"; 23 23 24 # Present HTTP AUTH headers, as well as opening content-type. 25 #print 'WWW-Authenticate: Basic realm="ViaNet IP Database"\n'; 24 26 # Collect the username from HTTP auth. If undefined, we're in a test environment. 25 27 my $authuser; … … 171 173 print qq(<div align=right style="position: absolute; right: 30px;">). 172 174 qq(<a href="/ip/cgi-bin/admin.cgi">Admin tools</a></div><br>\n) 173 if $ authuser =~ /kdeugau|jodyh|jipp/;175 if $IPDBacl{$authuser} =~ /A/; 174 176 175 177 # We print the footer here, so we don't have to do it elsewhere. … … 448 450 } 449 451 print "</table>\n"; 450 print qq(<a href="/ip/addmaster.shtml">Add new master block</a><br><br>\n); 452 if ($IPDBacl{$authuser} =~ /a/) { 453 print qq(<a href="/ip/addmaster.shtml">Add new master block</a><br><br>\n); 454 } 451 455 print "Note: Free blocks noted here include both routed and unrouted blocks.\n"; 452 456
Note:
See TracChangeset
for help on using the changeset viewer.