ieb/sparsemapcontent — Issue #128: Make Authorizables have a validity period
Author: ieb
Created: 2011-11-23 00:04:07+00:00
State: open

We need to be able to control if a user can login to an account, but we also need to be able to do that without deleting the account, changing the password or changing anything about the account.

Ideally we need this function to allow an account to be
disabled until some time in the future
disabled at some time in the future
enabled for a defined period of time.

Disabled will mean that the user may not login via either password authentication or external authentication.
I am not absolutely clear at this stage if that means that the system should not be able to become the user, of if it should, this needs more investigation of current usage.

Implementation.
A protected property on the authorizable "_validperiod" containing 2 ISO-8601 times
eg
20111109T000000+01,20121109T000000+01

means the authorizable will be valid for login from 20111109T000000+01 to 20121109T000000+01

To disable until some time in future, set the first date to that time and leave the last date blank.
20120109T000000+01,

To disable after some time in the future, set the last date to that time
,20120109T000000+01

New API methods.
AuthorizableManager.enable(String id, String from, String to)
if both are null the enable period is removed,
if from is null, the enable period only specifies the end
if to is null the enable period only specifies the start

boolean Authorizable.enabled();
returns true if currently valid, false if not

Calendar Authorizable.enabledFrom();
Calendar Authorizable.enabledTo();

Possible changes to API methods.
If we need to allow the System to become a user, then we will have to add a method repository.loginForcedAdministrative(String userId) to force the login of administrative users. This may be necessary where the application has been using user sessions to perform back ground tasks. In some cases we may want to also disable those operations which is why it would be better to add this method.