Log Message:
-----------
warn superuser deletion
Modified Files:
--------------
pgadmin3/src/ui:
dlgUser.cpp (r1.24 -> r1.25)
pgadmin3/src/include:
dlgUser.h (r1.10 -> r1.11)
pgadmin3/src/schema:
pgUser.cpp (r1.31 -> r1.32)
Index: dlgUser.cpp
===================================================================
RCS file: /projects/pgadmin3/src/ui/dlgUser.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -Lsrc/ui/dlgUser.cpp -Lsrc/ui/dlgUser.cpp -u -w -r1.24 -r1.25
--- src/ui/dlgUser.cpp
+++ src/ui/dlgUser.cpp
@@ -53,7 +53,7 @@
EVT_LISTBOX_DCLICK(XRCID("lbGroupsIn"), dlgUser::OnGroupRemove)
EVT_TEXT(XRCID("txtPasswd"), dlgUser::OnChange)
EVT_CHECKBOX(XRCID("chkCreateDB"), dlgUser::OnChange)
- EVT_CHECKBOX(XRCID("chkCreateUser"), dlgUser::OnChange)
+ EVT_CHECKBOX(XRCID("chkCreateUser"), dlgUser::OnChangeSuperuser)
EVT_BUTTON(XRCID("btnAddGroup"), dlgUser::OnGroupAdd)
EVT_BUTTON(XRCID("btnDelGroup"), dlgUser::OnGroupRemove)
@@ -184,6 +184,24 @@
}
+void dlgUser::OnChangeSuperuser(wxCommandEvent &ev)
+{
+ if (user && user->GetSuperuser() && !chkCreateUser->GetValue())
+ {
+ wxMessageDialog dlg(this,
+ _("Deleting a superuser might result in unwanted behaviour (e.g. when
restoring the database).\nAre you sure?"),
+ _("Confirm superuser deletion"),
+ wxICON_EXCLAMATION | wxYES_NO |wxNO_DEFAULT);
+ if (dlg.ShowModal() != wxID_YES)
+ {
+ chkCreateUser->SetValue(true);
+ return;
+ }
+ }
+ OnChange(ev);
+}
+
+
void dlgUser::OnChange(wxCommandEvent &ev)
{
bool timEn=datValidUntil->GetDate().IsValid();
Index: dlgUser.h
===================================================================
RCS file: /projects/pgadmin3/src/include/dlgUser.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lsrc/include/dlgUser.h -Lsrc/include/dlgUser.h -u -w -r1.10 -r1.11
--- src/include/dlgUser.h
+++ src/include/dlgUser.h
@@ -34,6 +34,7 @@
wxArrayString varInfo;
void OnChange(wxCommandEvent &ev);
+ void OnChangeSuperuser(wxCommandEvent &ev);
void OnChangeSpin(wxSpinEvent &ev);
void OnChangeCal(wxCalendarEvent &ev);
void OnGroupAdd(wxCommandEvent &ev);
Index: pgUser.cpp
===================================================================
RCS file: /projects/pgadmin3/src/schema/pgUser.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -Lsrc/schema/pgUser.cpp -Lsrc/schema/pgUser.cpp -u -w -r1.31 -r1.32
--- src/schema/pgUser.cpp
+++ src/schema/pgUser.cpp
@@ -35,6 +35,15 @@
bool pgUser::DropObject(wxFrame *frame, wxTreeCtrl *browser)
{
+ if (GetUpdateCatalog())
+ {
+ wxMessageDialog dlg(frame,
+ _("Deleting a superuser might result in unwanted behaviour (e.g. when
restoring the database).\nAre you sure?"),
+ _("Confirm superuser deletion"),
+ wxICON_EXCLAMATION | wxYES_NO |wxNO_DEFAULT);
+ if (dlg.ShowModal() != wxID_YES)
+ return false;
+ }
return server->ExecuteVoid(wxT("DROP USER ") + GetQuotedFullIdentifier() +
wxT(";"));
}
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster