1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
|
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// ctlDefaultSecurityPanel.h - Panel with default security information
//
//////////////////////////////////////////////////////////////////////////
#ifndef CTL_DEFDEFSECPANEL_H
#define CTL_DEFDEFSECPANEL_H
#include <wx/wx.h>
#include <wx/dynarray.h>
#include <wx/notebook.h>
enum
{
CTL_DEFPROPSQL = 500,
CTL_DEFMSG,
CTL_DEFLBPRIV,
CTL_DEFSTATICGROUP,
CTL_DEFCBGROUP,
CTL_DEFADDPRIV,
CTL_DEFDELPRIV,
CTL_DEFALLPRIV,
CTL_DEFALLPRIVGRANT,
CTL_DEFPRIVCB // base for all privilege checkboxes, must be last
};
class defaultPrivilegesOn
{
public:
defaultPrivilegesOn(const wxChar, const wxString &, const wxString &);
wxChar m_privilegeType;
wxString m_privilegesOn;
wxString m_privileges;
wxArrayString m_privilegesList;
};
DECLARE_LOCAL_EVENT_TYPE(EVT_DEFAULTSECURITYPANEL_CHANGE, -1)
class pgConn;
class ctlDefaultPrivilegesPanel;
class dlgDefaultSecurityProperty;
class ctlDefaultSecurityPanel : public wxPanel
{
public:
ctlDefaultSecurityPanel(pgConn * , wxNotebook * , wxImageList *);
wxString GetDefaultPrivileges(const wxString &schemaName);
void UpdatePrivilegePages(bool createDefPrivs, const wxString &defPrivsOnTables,
const wxString &defPrivsOnSeqs, const wxString &defPrivsOnFuncs,
const wxString &defPrivsOnTypes);
protected:
wxNotebook *nbNotebook;
wxArrayString m_groups;
wxArrayString m_namespaces;
ctlDefaultPrivilegesPanel *m_defPrivOnTablesPanel, *m_defPrivOnSeqsPanel, *m_defPrivOnFuncsPanel, *m_defPrivOnTypesPanel;
friend class ctlDefaultPrivilegesPanel;
friend class dlgDefaultSecurityProperty;
};
class ctlDefaultPrivilegesPanel : public wxPanel
{
public:
ctlDefaultPrivilegesPanel(ctlDefaultSecurityPanel *, wxNotebook *, defaultPrivilegesOn &, wxImageList *);
~ctlDefaultPrivilegesPanel();
void Update(wxString privs);
wxString GetDefaultPrivileges(const wxString &schemaName);
protected:
typedef struct
{
wxString m_username;
wxString m_origPriv;
wxString m_newPriv;
bool m_modified;
} defPrivilege;
public:
WX_DECLARE_STRING_HASH_MAP(defPrivilege, defPrivHash);
protected:
bool m_defPrivChanged;
int privilegeCount;
defaultPrivilegesOn m_privilegeType;
defPrivHash m_privileges;
defPrivilege *m_currentSelectedPriv;
ctlDefaultSecurityPanel *m_defSecurityPanel;
wxButton *btnAddPriv, *btnDelPriv;
wxCheckBox **privCheckboxes;
wxCheckBox *allPrivileges, *allPrivilegesGrant;
ctlListView *lbPrivileges;
ctlComboBox *cbGroups;
wxStaticText *stGroup;
void OnPrivSelChange(wxListEvent &ev);
void OnAddPriv(wxCommandEvent &ev);
void OnGroupChange(wxCommandEvent &ev);
void OnDelPriv(wxCommandEvent &ev);
void OnPrivCheck(wxCommandEvent &ev);
void OnPrivCheckAll(wxCommandEvent &ev);
void OnPrivCheckAllGrant(wxCommandEvent &ev);
bool PrivCheckBoxUpdate(wxString &strUser);
void CheckGrantOpt(int index);
bool CanGrant();
DECLARE_EVENT_TABLE()
};
#endif
|