1 ////////////////////////////////////////////////////////////////////////// 2 // 3 // pgAdmin III - PostgreSQL Tools 4 // 5 // Copyright (C) 2002 - 2016, The pgAdmin Development Team 6 // This software is released under the PostgreSQL Licence 7 // 8 // pgUser.h - PostgreSQL User 9 // 10 ////////////////////////////////////////////////////////////////////////// 11 12 #ifndef PGUSER_H 13 #define PGUSER_H 14 15 #include "pgServer.h" 16 17 class pgUserFactory : public pgServerObjFactory 18 { 19 public: 20 pgUserFactory(); 21 virtual dlgProperty *CreateDialog(frmMain *frame, pgObject *node, pgObject *parent); 22 virtual pgObject *CreateObjects(pgCollection *obj, ctlTree *browser, const wxString &restr = wxEmptyString); 23 }; 24 extern pgUserFactory userFactory; 25 26 27 // Class declarations 28 class pgUser : public pgServerObject 29 { 30 public: 31 pgUser(const wxString &newName = wxT("")); 32 wxString GetTranslatedMessage(int kindOfMessage) const; 33 34 // User Specific GetSystemObject()35 bool GetSystemObject() const 36 { 37 return userId < 100; 38 } GetUserId()39 long GetUserId() const 40 { 41 return userId; 42 } iSetUserId(const long l)43 void iSetUserId(const long l) 44 { 45 userId = l; 46 } GetAccountExpires()47 wxDateTime GetAccountExpires() const 48 { 49 return accountExpires; 50 } iSetAccountExpires(const wxDateTime & dt)51 void iSetAccountExpires(const wxDateTime &dt) 52 { 53 accountExpires = dt; 54 } GetPassword()55 wxString GetPassword() const 56 { 57 return password; 58 } iSetPassword(const wxString & s)59 void iSetPassword(const wxString &s) 60 { 61 password = s; 62 } GetCreateDatabase()63 bool GetCreateDatabase() const 64 { 65 return createDatabase; 66 } iSetCreateDatabase(const bool b)67 void iSetCreateDatabase(const bool b) 68 { 69 createDatabase = b; 70 } GetSuperuser()71 bool GetSuperuser() const 72 { 73 return superuser; 74 } iSetSuperuser(const bool b)75 void iSetSuperuser(const bool b) 76 { 77 superuser = b; 78 } GetUpdateCatalog()79 bool GetUpdateCatalog() const 80 { 81 return updateCatalog; 82 } iSetUpdateCatalog(const bool b)83 void iSetUpdateCatalog(const bool b) 84 { 85 updateCatalog = b; 86 } GetGroupsIn()87 wxArrayString &GetGroupsIn() 88 { 89 return groupsIn; 90 } GetConfigList()91 wxArrayString &GetConfigList() 92 { 93 return configList; 94 } 95 96 97 // Tree object creation 98 void ShowTreeDetail(ctlTree *browser, frmMain *form = 0, ctlListView *properties = 0, ctlSQLBox *sqlPane = 0); 99 void ShowDependents(frmMain *form, ctlListView *referencedBy, const wxString &where); 100 101 // virtual methods 102 wxString GetSql(ctlTree *browser); 103 pgObject *Refresh(ctlTree *browser, const wxTreeItemId item); 104 bool DropObject(wxFrame *frame, ctlTree *browser, bool cascaded); 105 HasStats()106 bool HasStats() 107 { 108 return false; 109 } HasDepends()110 bool HasDepends() 111 { 112 return true; 113 } HasReferences()114 bool HasReferences() 115 { 116 return true; 117 } 118 119 private: 120 wxString password; 121 wxDateTime accountExpires; 122 bool createDatabase, superuser, updateCatalog; 123 wxArrayString groupsIn; 124 wxArrayString configList; 125 long userId; 126 }; 127 128 class pgUserCollection : public pgServerObjCollection 129 { 130 public: 131 pgUserCollection(pgaFactory *factory, pgServer *sv); 132 wxString GetTranslatedMessage(int kindOfMessage) const; 133 }; 134 135 #endif 136