Closed ghost closed 9 years ago
Trac update at 20121018T00:31:58:
This will also help with cleaning up of expired users, as a ticket could have an activation expiry of 6 months, but a usage expiry of 7 days, and so could be cleaned up almost 5 months earlier in some cases.
- tim changed priority from "minor" to "major"
- tim changed status from "new" to "accepted"
Something like the following works if we don't have the monthly jobs summarise the radacct table into mtotacct.
sqlcounter accessperiod {
counter-name = Max-Access-Period-Never
check-name = Access-Period
sqlmod-inst = sql
key = User-Name
reset = never
query = "SELECT IF(COUNT(radacctid>=1),(UNIX_TIMESTAMP() - IFNULL(UNIX_TIMESTAMP(AcctStartTime),0)),0) FROM radacct WHERE UserName = '%{%k}' AND AcctSessionTime >= 1 ORDER BY AcctStartTime LIMIT 1"
}
Ideally, we combine something like this, with a nightly cron job that then sets a valid expiry on that user once it's first activated, so even at first login, we can have it work, and for an expiry of say "+6 months" from first use, it will also work.
Initial POC in the grase-conf-freeradius nightly package. To use, insert a line into the database like follows
INSERT INTO `radius`.`radcheck` (`UserName`, `Attribute`, `op`, `Value`) VALUES ('tim', 'GRASE-ExpireAfter', ':=', '+1 month');
The format of ExpireAfter is anything that can be parsed with the perl parsedate function (http://search.cpan.org/~muir/Time-ParseDate-2013.1113/lib/Time/ParseDate.pm)
Basic GUI in 932bd8db2d4a7a113c0b832771db9b83402a5557 Still need Cronjob to allow expire after dates of more than 1 month.
Cronjob done in 25ece46790b049c02ccac4b6f32221489b0adeac
When the user gets used for the first time a countdown starts which will cause the user to be expired 'x' days form first log-in This yould be useful for visitors
Migrated from http://trac.grasehotspot.org/ticket/39