Changeset 114
- Timestamp:
- 05/16/09 16:25:26 (15 years ago)
- Location:
- LATMOS-Accounts/lib/LATMOS/Accounts/Bases
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Ad/User.pm
r107 r114 61 61 title modbile homePhone 62 62 memberOf 63 accountExpires 63 64 ), 64 65 ($mode !~ /w/ -
LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm
r95 r114 61 61 uidNumber => 'uid', 62 62 gidNumber => 'gid', 63 Expire => 'expire', 63 64 (($for !~ /w/) 64 65 ? ( … … 66 67 sAMAccountName => 'sAMAccountName', 67 68 uid => 'login', 69 accountExpires => 'accountExpires', 70 shadowExpire => 'shadowExpire', 68 71 ) 69 72 : ()), … … 93 96 } 94 97 return \@res; 98 } elsif ($field eq 'accountExpires') { 99 my $sth = $self->db->prepare_cached( 100 sprintf( 101 q{select extract(epoch from expire) + 11644474161 as expire 102 from %s where %s = ?}, 103 $self->db->quote_identifier($self->object_table), 104 $self->db->quote_identifier($self->key_field), 105 ) 106 ); 107 $sth->execute($self->id); 108 my $res = $sth->fetchrow_hashref; 109 $sth->finish; 110 return $res->{expire} ? sprintf("%.f", $res->{expire} * 1E7) : '9223372036854775807'; 111 } elsif ($field eq 'shadowExpire') { 112 my $sth = $self->db->prepare_cached( 113 sprintf( 114 q{select justify_hours(expire - '1/1/1970'::timestamp) as expire 115 from %s where %s = ?}, 116 $self->db->quote_identifier($self->object_table), 117 $self->db->quote_identifier($self->key_field), 118 ) 119 ); 120 $sth->execute($self->id); 121 my $res = $sth->fetchrow_hashref; 122 $sth->finish; 123 return -1 unless($res->{expire}); 124 $res->{expire} =~ /(\d+) days\s*(\w)?/; 125 return $1 + ($2 ? 1 : 0); 95 126 } else { 96 127 return $self->SUPER::get_field($field);
Note: See TracChangeset
for help on using the changeset viewer.