public Result Activate(string username, string password)
{
try
{
log.Info("got request to activate " + username + "'s account");
User user = dataManager.GetUser(username);
if (user != null)
{
Result res;
if (Result.OK == (res = securityManager.AuthenticateUser(username, password)))
{
if (Result.OK == (res = policyManager.IsAuthorizedActivate(username)))
{
dataManager.SetUserState(username, UserState.Active);
return Result.OK;
}
else return res;
}
else return res;
}
else return Result.USER_NOT_FOUND;
}
catch (Exception e)
{
log.Error("failed to activate " + username + "'s account", e);
throw e;
}
}