Changeset 920 for LATMOS-Accounts
- Timestamp:
- 04/17/12 13:41:37 (12 years ago)
- Location:
- LATMOS-Accounts
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/Changes
r863 r920 1 1 Revision history for Perl extension LATMOS::Accounts. 2 3 3.0.1 4 - add user attributes to nethost to store poeple using the computer if it is 5 not the owner (make difference between user and admin). 2 6 3 7 3.0.0 -
LATMOS-Accounts/bin/la-sql-upgrade.in
r914 r920 24 24 'b|base=s' => \my $base, 25 25 'a|attributes=s' => \my $attributes_file, 26 'no-commit' => \my $nocommit, 27 'v|verbose' => \my $verbose, 26 28 ) or pod2usage(); 27 29 … … 44 46 =cut 45 47 48 $| = 1; # autoflush 49 46 50 my $LA = LATMOS::Accounts->new($config, noacl => 1); 47 51 my $labase = $LA->base($base); … … 60 64 q{DROP TRIGGER IF EXISTS check_zone_name_unity_tg ON netzone}, 61 65 q{DROP FUNCTION IF EXISTS check_zone_name_unity()}, 62 q{ALTER TABLE nethost_attributes_ips DROP CONSTRAINT nethost_is_single_ip} 66 q{ALTER TABLE nethost_attributes_ips DROP CONSTRAINT 67 nethost_is_single_ip}, 63 68 q{INSERT INTO settings(varname, val) VALUES ('schema_version', 3)}, 69 ], 70 }, 71 { 72 ver => 4, 73 sql => [ 74 q{ 75 CREATE OR REPLACE FUNCTION nethost_sort_fields() 76 RETURNS trigger AS 77 $BODY$BEGIN 78 79 IF (TG_OP='INSERT') then 80 IF (new.attr='ip') THEN 81 insert into nethost_attributes_ips VALUES (new.*); 82 RETURN NULL; 83 END IF; 84 85 IF (new.attr='macaddr') THEN 86 insert into nethost_attributes_macs VALUES (new.*); 87 RETURN NULL; 88 END IF; 89 90 IF (new.attr='owner') THEN 91 insert into nethost_attributes_users VALUES (new.*); 92 RETURN NULL; 93 END IF; 94 95 IF (new.attr='user') THEN 96 insert into nethost_attributes_users VALUES (new.*); 97 RETURN NULL; 98 END IF; 99 end if; 100 101 102 if (TG_OP='DELETE') THEN 103 RETURN old; 104 else 105 RETURN new; 106 end if; 107 END;$BODY$ 108 LANGUAGE plpgsql VOLATILE 109 COST 100; 110 }, 64 111 ], 65 112 }, … … 78 125 my $sqlv = $sql; 79 126 $sqlv =~ s/^/ /mg; 80 warn ' >' . $sqlv . "\n"; 127 if ($verbose) { 128 warn ' >' . $sqlv . "\n"; 129 } else { 130 print 'x'; 131 } 81 132 } 82 $dbi->do($sql) or die "Erreur :\\" ;133 $dbi->do($sql) or die "Erreur :\\" . $dbi->errstr . "\n"; 83 134 } 84 print ' > Updating schema_version to ' . $maj->{ver} . "\n"; 135 136 print "\n"; 137 138 print 'Updating schema_version to ' . $maj->{ver} . "\n"; 139 85 140 $dbi->do( 86 141 'UPDATE settings SET val = ? where varname = ?', … … 88 143 $maj->{ver}, 'schema_version' 89 144 ); 145 print "Done\n\n"; 90 146 91 147 } … … 112 168 }; 113 169 170 if ($nocommit) { 171 $dbi->rollback; 172 } else { 173 $dbi->commit; 174 } 114 175 print "Process terminated successfully\n"; 115 $dbi->rollback; -
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm
r882 r920 15 15 our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 16 16 17 my $SCHEMA_VERSION = 3;17 my $SCHEMA_VERSION = 4; 18 18 19 19 =head1 NAME -
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/Nethost.pm
r861 r920 82 82 }, 83 83 owner => { 84 reference => 'user', 85 delayed => 1, 86 }, 87 user => { 84 88 reference => 'user', 85 89 delayed => 1, -
LATMOS-Accounts/sqldata/attributes.csv
r861 r920 40 40 "nethost","description","" 41 41 "nethost","owner","" 42 "nethost","user","" 42 43 "nethost","ip","" 43 44 "nethost","macaddr",""
Note: See TracChangeset
for help on using the changeset viewer.