Permalink
Browse files

Fix the handling of expiry times when modifying roles.

  • Loading branch information...
1 parent ef543b6 commit bb082def2452e085e27b8f356f6f13318912819e @dpage dpage committed Feb 6, 2013
Showing with 11 additions and 7 deletions.
  1. +1 −0 CHANGELOG
  2. +10 −7 pgadmin/dlg/dlgRole.cpp
View
@@ -37,6 +37,7 @@ Changes
Date Dev Ver Change details
---------- --- ------ --------------
+2013-02-06 DP 1.16.2 Fix the handling of expiry times when modifying roles.
2013-02-04 DP 1.16.2 Prevent foreign keys being recreated unnecessarily when
modifying tables [Michael Banck]
2013-01-24 DP 1.16.2 Prevent Cmd+S adding characters to the Query Tool when
View
@@ -210,8 +210,11 @@ int dlgRole::Go(bool modal)
chkUpdateCat->SetValue(role->GetUpdateCatalog());
chkCanLogin->SetValue(role->GetCanLogin());
chkReplication->SetValue(role->GetReplication());
- datValidUntil->SetValue(role->GetAccountExpires().GetDateOnly());
- timValidUntil->SetTime(role->GetAccountExpires());
+ if (role->GetAccountExpires().IsValid())
+ {
+ datValidUntil->SetValue(role->GetAccountExpires().GetDateOnly());
+ timValidUntil->SetTime(role->GetAccountExpires());
+ }
txtConnectionLimit->SetValue(NumToStr(role->GetConnectionLimit()));
txtComment->SetValue(role->GetComment());
@@ -322,27 +325,27 @@ void dlgRole::OnOK(wxCommandEvent &ev)
void dlgRole::OnChangeCal(wxCalendarEvent &ev)
{
- CheckChange();
-
bool timEn = ev.GetDate().IsValid();
timValidUntil->Enable(timEn);
if (!timEn)
timValidUntil->SetTime(wxDefaultDateTime);
else
timValidUntil->SetTime(wxDateTime::Today());
+
+ CheckChange();
}
void dlgRole::OnChangeDate(wxDateEvent &ev)
{
- CheckChange();
-
bool timEn = ev.GetDate().IsValid();
timValidUntil->Enable(timEn);
if (!timEn)
timValidUntil->SetTime(wxDefaultDateTime);
else
timValidUntil->SetTime(wxDateTime::Today());
+
+ CheckChange();
}
void dlgRole::OnChangeSpin(wxSpinEvent &ev)
@@ -647,7 +650,7 @@ wxString dlgRole::GetSql()
}
}
}
- if (DateToStr(datValidUntil->GetValue()) != DateToStr(role->GetAccountExpires()))
+ if (!datValidUntil->GetValue().IsValid() || DateToStr(datValidUntil->GetValue() + timValidUntil->GetValue()) != DateToStr(role->GetAccountExpires()))
{
if (datValidUntil->GetValue().IsValid())
options += wxT("\n VALID UNTIL ") + qtDbString(DateToAnsiStr(datValidUntil->GetValue() + timValidUntil->GetValue()));

0 comments on commit bb082de

Please sign in to comment.