Changeset 2268


Ignore:
Timestamp:
06/20/19 09:15:24 (5 years ago)
Author:
nanardon
Message:

Add lastlogin attribute

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm

    r2264 r2268  
    3131            expire 
    3232            endcircuit 
     33            lastlogin 
    3334            locked 
    3435            sshPublicKey 
  • trunk/LATMOS-Accounts/Changes

    r2247 r2268  
    55    - Add task module Setattribute: set attribute for objects matching the 
    66      given filter 
     7    - Add lastlogin Attribute: allow to store last login date 
    78 
    895.2.23 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql.pm

    r2262 r2268  
    1818our $VERSION = (q$Rev$ =~ /^Rev: (\d+) /)[0]; 
    1919 
    20 sub SCHEMA_VERSION { 34 }; 
     20sub SCHEMA_VERSION { 35 }; 
    2121 
    2222=head1 NAME 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/User.pm

    r2267 r2268  
    231231                monitored => 1, 
    232232                label => l('End of entrance'), 
     233            }, 
     234            lastlogin    => { 
     235                inline => 1, 
     236                formtype => 'DATETIME', 
     237                monitored => 1, 
     238                label => l('Last login'), 
     239                set => sub { 
     240                    my ($self, $values) = @_; 
     241                    if ($values) { 
     242                        my $sth = $base->db->prepare_cached( 
     243                            q{ update "user" set lastlogin = $1 where (lastlogin < $1 or lastlogin IS NULL) and name = $2 } 
     244                        ); 
     245                        return $sth->execute($values, $self->object->id); 
     246                    } else { 
     247                        my $sth = $base->db->prepare_cached( 
     248                            q{ update "user" set lastlogin = NULL where name = $2 } 
     249                        ); 
     250                        return $sth->execute($self->object->id); 
     251                    } 
     252                }, 
    233253            }, 
    234254            _endEmployment => { 
  • trunk/LATMOS-Accounts/lib/LATMOS/Accounts/Bases/Sql/upgrade.pm

    r2262 r2268  
    12611261            recompute => 1, 
    12621262        }, 
     1263        { 
     1264            ver => 35, 
     1265            sql => [ 
     1266                q{ 
     1267                ALTER TABLE "user" ADD COLUMN lastlogin timestamp with time zone 
     1268                } 
     1269            ], 
     1270        }, 
    12631271    ); 
    12641272 
  • trunk/LATMOS-Accounts/man/man8/latmos-accounts-base-sql.pod

    r2260 r2268  
    106106C<endcircuit> attribute become informationnal only. 
    107107 
     108=head2 Last Login attribute 
     109 
     110The C<lastlogin> attribute is designed to store the last datetime user login on 
     111any system. This attribute can only be set to a highter value or be unset. 
     112 
     113This allow to set this attribute from various source and to keep only the latest 
     114value. 
     115 
    108116=head2 User Employment 
    109117 
Note: See TracChangeset for help on using the changeset viewer.