Adapt delete options when user has not expired
This commit is contained in:
parent
e22a9e4942
commit
4649fc492f
|
@ -71,7 +71,7 @@ __DATA__
|
|||
<field type="select"
|
||||
id="ExpireDeleteAfterLock"
|
||||
value="get_user_prop('ExpireDeleteAfterLock')"
|
||||
options="'never', '7', '30', '180', '365'">
|
||||
options="get_delete_options()">
|
||||
<description>DESC_DELETE_AFTER_LOCK</description>
|
||||
<label>LABEL_DELETE_AFTER_LOCK</label>
|
||||
</field>
|
||||
|
@ -93,7 +93,7 @@ __DATA__
|
|||
<field type="select"
|
||||
id="ExpireDeleteAfterLock"
|
||||
value="get_user_prop('ExpireDeleteAfterLock')"
|
||||
options="'never', '7', '30', '180', '365'">
|
||||
options="get_delete_options()">
|
||||
<description>DESC_DELETE_AFTER_LOCK</description>
|
||||
<label>LABEL_DELETE_AFTER_LOCK</label>
|
||||
</field>
|
||||
|
|
|
@ -210,6 +210,22 @@ sub get_conf_bool{
|
|||
return ($val =~ m/^yes|enabled|1|on$/) ? 'enabled' : 'disabled';
|
||||
}
|
||||
|
||||
sub get_delete_options{
|
||||
my ($self) = @_;
|
||||
my $options = [ qw(never 7 30 180 365) ];
|
||||
my $acctName = $self->{cgi}->param('acctName');
|
||||
if ($acctName =~ /^(\w[\-\w_\.]*)$/){
|
||||
$acctName = $1;
|
||||
my $acct = $a->get($acctName);
|
||||
my $pass = $acct->prop('PasswordSet') || 'no';
|
||||
my $locked = $acct->prop('ExpireLockedOn') || '';
|
||||
if ($pass eq 'no' && $locked !~ m/^\d{4}\-\d{1,2}\-\d{1,2}$/){
|
||||
$options = [ qw(never) ];
|
||||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
sub modify_config{
|
||||
my ($self) = @_;
|
||||
my $rec = $c->get('ExpireAccounts') || $c->new_record('ExpireAccounts', { type => 'service' });
|
||||
|
|
Loading…
Reference in New Issue