Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

473 lines
13 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000 - 2001.
  5. //
  6. // File: PolicyStoreDlg.h
  7. //
  8. // Contents: Dialog boxes for Creating/Opening Policy Store
  9. //
  10. // History: 07-26-2001 Hiteshr Created
  11. //
  12. //----------------------------------------------------------------------------
  13. /******************************************************************************
  14. Class: CSortListCtrl
  15. Purpose:Subclases ListCtrl class and handles initialization and sorting
  16. ******************************************************************************/
  17. class CSortListCtrl : public CListCtrl
  18. {
  19. public:
  20. CSortListCtrl(UINT uiFlags,
  21. BOOL bActionItem,
  22. COL_FOR_LV *pColForLv,
  23. BOOL bCheckBox = FALSE)
  24. :m_iSortDirection(1),
  25. m_iLastColumnClick(0),
  26. m_uiFlags(uiFlags),
  27. m_bActionItem(bActionItem),
  28. m_pColForLv(pColForLv),
  29. m_bCheckBox(bCheckBox)
  30. {
  31. ASSERT(m_pColForLv);
  32. }
  33. void Initialize();
  34. void Sort();
  35. protected:
  36. afx_msg void
  37. OnListCtrlColumnClicked(NMHDR* pNotifyStruct, LRESULT* pResult);
  38. private:
  39. int m_iSortDirection;
  40. int m_iLastColumnClick;
  41. UINT m_uiFlags; //Contains info on columns of listctrl
  42. BOOL m_bActionItem; //Is Item data in listentries is ActionItem.
  43. //if False its of type CBaseAz*
  44. COL_FOR_LV *m_pColForLv;
  45. BOOL m_bCheckBox; //LVS_EX_CHECKBOXES style is used
  46. WTL::CImageList m_imageList;
  47. DECLARE_MESSAGE_MAP()
  48. };
  49. class CHelpEnabledDialog: public CDialog
  50. {
  51. public:
  52. CHelpEnabledDialog(UINT nIDTemplate)
  53. :CDialog(nIDTemplate),
  54. m_nDialogId(nIDTemplate)
  55. {
  56. }
  57. INT_PTR DoModal();
  58. protected:
  59. afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
  60. afx_msg BOOL OnHelp(WPARAM wParam, LPARAM lParam);
  61. DECLARE_MESSAGE_MAP()
  62. private:
  63. ULONG m_nDialogId;
  64. };
  65. /******************************************************************************
  66. Class: CNewBaseDlg
  67. Purpose: Base Dialog Class For creation of new objects
  68. ******************************************************************************/
  69. class CNewBaseDlg : public CHelpEnabledDialog
  70. {
  71. public:
  72. CNewBaseDlg(IN CComponentDataObject* pComponentData,
  73. IN CBaseContainerNode * pBaseContainerNode,
  74. IN ATTR_MAP* pAttrMap,
  75. IN ULONG IDD_DIALOG,
  76. IN OBJECT_TYPE_AZ eObjectType);
  77. ~CNewBaseDlg();
  78. protected:
  79. virtual BOOL
  80. OnInitDialog();
  81. afx_msg void
  82. OnEditChangeName();
  83. virtual void
  84. OnOK();
  85. //This Function should be implemented by derived classes which want to
  86. //implement object type specific properties
  87. virtual HRESULT
  88. SetObjectTypeSpecificProperties(IN CBaseAz* /*pBaseAz*/,
  89. OUT BOOL& /*bErrorDisplayed*/){return S_OK;}
  90. virtual VOID
  91. DisplayError(HRESULT hr);
  92. HRESULT
  93. CreateObjectNodeAndAddToUI(CBaseAz* pBaseAz);
  94. CString
  95. GetNameText();
  96. void
  97. SetNameText(const CString& strName);
  98. CRoleRootData* GetRootData()
  99. {
  100. return static_cast<CRoleRootData*>(m_pComponentData->GetRootData());
  101. }
  102. CComponentDataObject* GetComponentData(){return m_pComponentData;}
  103. CBaseContainerNode* GetBaseContainerNode(){return m_pBaseContainerNode;}
  104. CContainerAz* GetContainerAzObject()
  105. {
  106. CBaseContainerNode* pBaseContainerNode = GetBaseContainerNode();
  107. if(pBaseContainerNode)
  108. {
  109. return pBaseContainerNode->GetContainerAzObject();
  110. }
  111. return NULL;
  112. }
  113. DECLARE_MESSAGE_MAP()
  114. private:
  115. CComponentDataObject* m_pComponentData;
  116. CBaseContainerNode * m_pBaseContainerNode;
  117. //Type of object created by this new dialog
  118. OBJECT_TYPE_AZ m_eObjectType;
  119. ATTR_MAP* m_pAttrMap;
  120. };
  121. /******************************************************************************
  122. Class: CNewApplicationDlg
  123. Purpose: Dlg Class for creating new application
  124. ******************************************************************************/
  125. class CNewApplicationDlg: public CNewBaseDlg
  126. {
  127. public:
  128. CNewApplicationDlg(IN CComponentDataObject* pComponentData,
  129. IN CBaseContainerNode* pBaseContainerNode);
  130. ~CNewApplicationDlg();
  131. private:
  132. DECLARE_MESSAGE_MAP()
  133. };
  134. /******************************************************************************
  135. Class: CNewScopeDlg
  136. Purpose: Dlg Class for creating new scope
  137. ******************************************************************************/
  138. class CNewScopeDlg: public CNewBaseDlg
  139. {
  140. public:
  141. CNewScopeDlg(IN CComponentDataObject* pComponentData,
  142. IN CBaseContainerNode* pApplicationContainer);
  143. ~CNewScopeDlg();
  144. private:
  145. DECLARE_MESSAGE_MAP()
  146. };
  147. /******************************************************************************
  148. Class: CNewGroupDlg
  149. Purpose: Dlg Class for creating new group
  150. ******************************************************************************/
  151. class CNewGroupDlg: public CNewBaseDlg
  152. {
  153. public:
  154. CNewGroupDlg(IN CComponentDataObject* pComponentData,
  155. IN CBaseContainerNode* pApplicationContainer);
  156. ~CNewGroupDlg();
  157. private:
  158. virtual BOOL
  159. OnInitDialog();
  160. //Helper Functions For Creation of New Object
  161. virtual HRESULT
  162. SetObjectTypeSpecificProperties(CBaseAz* pBaseAz,
  163. BOOL& bSilent);
  164. DECLARE_MESSAGE_MAP()
  165. };
  166. /******************************************************************************
  167. Class: CNewTaskDlg
  168. Purpose: Dlg Class for creating new Task/Role Definition
  169. ******************************************************************************/
  170. class CNewTaskDlg: public CNewBaseDlg
  171. {
  172. public:
  173. CNewTaskDlg(IN CComponentDataObject* pComponentData,
  174. IN CBaseContainerNode* pApplicationContainer,
  175. IN ULONG IDD_DIALOG,
  176. IN BOOL bRoleDefinition);
  177. ~CNewTaskDlg();
  178. private:
  179. virtual BOOL
  180. OnInitDialog();
  181. afx_msg void
  182. OnButtonAdd();
  183. afx_msg void
  184. OnButtonRemove();
  185. afx_msg void
  186. OnButtonEditScript();
  187. afx_msg void
  188. OnListCtrlItemChanged(NMHDR* /*pNotifyStruct*/, LRESULT* pResult);
  189. afx_msg void
  190. OnListCtrlItemDeleted(NMHDR* /*pNotifyStruct*/, LRESULT* pResult);
  191. virtual VOID
  192. DisplayError(HRESULT hr);
  193. void
  194. SetRemoveButton();
  195. //Helper Functions For Creation of New Object
  196. virtual HRESULT
  197. SetObjectTypeSpecificProperties(CBaseAz* pBaseAz,
  198. BOOL& bSilent);
  199. CButton*
  200. GetRemoveButton(){return (CButton*)GetDlgItem(IDC_REMOVE);}
  201. DECLARE_MESSAGE_MAP()
  202. CSortListCtrl m_listCtrl;
  203. BOOL m_bRoleDefinition;
  204. CString m_strFilePath;
  205. CString m_strScript;
  206. CString m_strScriptLanguage;
  207. };
  208. /******************************************************************************
  209. Class: CNewOperationDlg
  210. Purpose: Dlg Class for creating new Operation
  211. ******************************************************************************/
  212. class CNewOperationDlg: public CNewBaseDlg
  213. {
  214. public:
  215. CNewOperationDlg(IN CComponentDataObject* pComponentData,
  216. IN CBaseContainerNode* pBaseContainerNode);
  217. ~CNewOperationDlg();
  218. private:
  219. DECLARE_MESSAGE_MAP()
  220. };
  221. class CNewAuthorizationStoreDlg: public CNewBaseDlg
  222. {
  223. public:
  224. CNewAuthorizationStoreDlg(CComponentDataObject* pComponentData);
  225. ~CNewAuthorizationStoreDlg();
  226. private:
  227. virtual BOOL
  228. OnInitDialog();
  229. virtual void
  230. OnOK();
  231. afx_msg void
  232. OnButtonBrowse();
  233. afx_msg void
  234. OnRadioChange();
  235. ULONG
  236. GetStoreType();
  237. DECLARE_MESSAGE_MAP()
  238. //User can switch between AD and XML store type.
  239. //These two variable stores the last setting of radio button
  240. //and text box. These are used to toggle the textbox values as
  241. //user toggle the radio buttons.
  242. CString m_strLastStoreName;
  243. LONG m_lLastRadioSelection;
  244. BOOL m_bADAvailable;
  245. };
  246. class COpenAuthorizationStoreDlg: public CNewBaseDlg
  247. {
  248. public:
  249. COpenAuthorizationStoreDlg(CComponentDataObject* pComponentData);
  250. ~COpenAuthorizationStoreDlg();
  251. private:
  252. virtual BOOL
  253. OnInitDialog();
  254. virtual void
  255. OnOK();
  256. afx_msg void
  257. OnButtonBrowse();
  258. afx_msg void
  259. OnRadioChange();
  260. ULONG
  261. GetStoreType();
  262. DECLARE_MESSAGE_MAP()
  263. //User can switch between AD and XML store type.
  264. //These two variable stores the last setting of radio button
  265. //and text box. These are used to toggle the textbox values as
  266. //user toggle the radio buttons.
  267. CString m_strLastStoreName;
  268. LONG m_lLastRadioSelection;
  269. BOOL m_bADAvailable;
  270. };
  271. /******************************************************************************
  272. Class: CScriptDialog
  273. Purpose: Dialog for Reading the script
  274. ******************************************************************************/
  275. class CScriptDialog : public CHelpEnabledDialog
  276. {
  277. public:
  278. CScriptDialog(BOOL bReadOnly,
  279. CAdminManagerNode& adminManagerNode,
  280. CString& strFileName,
  281. CString& strScriptLanguage,
  282. CString& strScript);
  283. ~CScriptDialog();
  284. virtual BOOL
  285. OnInitDialog();
  286. void
  287. OnOK();
  288. BOOL
  289. IsDirty(){ return m_bDirty;}
  290. private:
  291. afx_msg void
  292. OnBrowse();
  293. afx_msg void
  294. OnReload();
  295. afx_msg void
  296. OnClear();
  297. afx_msg void
  298. OnRadioChange();
  299. afx_msg void
  300. OnEditChangePath();
  301. afx_msg HBRUSH
  302. OnCtlColor(CDC* pDC,
  303. CWnd* pWnd,
  304. UINT nCtlColor);
  305. BOOL
  306. ReloadScript(const CString& strFileName);
  307. void
  308. MatchRadioWithExtension(const CString& strFileName);
  309. DECLARE_MESSAGE_MAP()
  310. //DATA MEMBERS
  311. BOOL m_bDirty;
  312. //These is refrence to strings passed by client. We change them only
  313. //if ok is pressed
  314. CString& m_strRetFileName;
  315. CString& m_strRetScriptLanguage;
  316. CString& m_strRetScript;
  317. //We work on these strings during the lifetime of dialog
  318. CString m_strFileName;
  319. CString m_strScriptLanguage;
  320. CString m_strScript;
  321. BOOL m_bReadOnly;
  322. BOOL m_bInit;
  323. CAdminManagerNode& m_adminManagerNode;
  324. };
  325. //+----------------------------------------------------------------------------
  326. // Function:GetAuthorizationScriptData
  327. // Synopsis:Gets the authorization script data for a Task
  328. //-----------------------------------------------------------------------------
  329. HRESULT
  330. GetAuthorizationScriptData(IN CTaskAz& refTaskAz,
  331. OUT CString& strFilePath,
  332. OUT CString& strScriptLanguage,
  333. OUT CString& strScript);
  334. //+----------------------------------------------------------------------------
  335. // Function:SaveAuthorizationScriptData
  336. // Synopsis:Saves the authorization script information for a task
  337. //-----------------------------------------------------------------------------
  338. HRESULT
  339. SaveAuthorizationScriptData(IN HWND hWnd,
  340. IN CTaskAz& refTaskAz,
  341. IN const CString& strFilePath,
  342. IN const CString& strScriptLanguage,
  343. IN const CString& strScript,
  344. IN BOOL& bErrorDisplayed);
  345. //+----------------------------------------------------------------------------
  346. // Function:GetScriptData
  347. // Synopsis:Displays the script Dialog. Dialog is initialized with info
  348. // passed to the function and any changes made are returned.
  349. //-----------------------------------------------------------------------------
  350. BOOL
  351. GetScriptData(IN BOOL bReadOnly,
  352. IN CAdminManagerNode& adminManagerNode,
  353. IN OUT CString& strFilePath,
  354. IN OUT CString& strScriptLanguage,
  355. IN OUT CString& strScript);
  356. /******************************************************************************
  357. Class: COptionDlg
  358. Purpose: Dialog for Selecting authorization manager options
  359. ******************************************************************************/
  360. class COptionDlg : public CHelpEnabledDialog
  361. {
  362. public:
  363. COptionDlg(IN BOOL & refDeveloperMode)
  364. :CHelpEnabledDialog(IDD_OPTIONS),
  365. m_refDeveloperMode(refDeveloperMode)
  366. {
  367. }
  368. void
  369. OnOK();
  370. BOOL
  371. OnInitDialog();
  372. private:
  373. BOOL& m_refDeveloperMode;
  374. DECLARE_MESSAGE_MAP()
  375. };