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.

987 lines
33 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2000 - 2001.
  5. //
  6. // File: baseaz.h
  7. //
  8. // Contents: Wrapper classes for IAzInterfaces
  9. //
  10. // History: 9-2001 Hiteshr Created
  11. //
  12. //----------------------------------------------------------------------------
  13. //
  14. //Enumeration For AzObject Types
  15. //
  16. enum OBJECT_TYPE_AZ
  17. {
  18. ADMIN_MANAGER_AZ,
  19. APPLICATION_AZ,
  20. SCOPE_AZ,
  21. GROUP_AZ,
  22. ROLE_DEFINITION_AZ,
  23. TASK_AZ,
  24. ROLE_AZ,
  25. OPERATION_AZ,
  26. SIDCACHE_AZ,
  27. //
  28. //Below are not the acutal AZ Object Types. But
  29. //they are needed in UI to represent various
  30. //collection objects.
  31. //
  32. GROUP_COLLECTION_AZ,
  33. ROLE_DEFINITION_COLLECTION_AZ,
  34. TASK_COLLECTION_AZ,
  35. ROLE_COLLECTION_AZ,
  36. OPERATION_COLLECTION_AZ,
  37. DEFINITION_COLLECTION_AZ,
  38. AZ_ENUM_END,
  39. };
  40. //AZ STORES TYPES
  41. #define AZ_ADMIN_STORE_AD 0x1
  42. #define AZ_ADMIN_STORE_XML 0x2
  43. #define AZ_ADMIN_STORE_INVALID 0x3
  44. //Forward Declaration
  45. class CContainerAz;
  46. class CAdminManagerAz;
  47. /******************************************************************************
  48. Class: CBaseAz
  49. Purpose: This is the base class for all AzObject classes.
  50. ******************************************************************************/
  51. class CBaseAz
  52. {
  53. public:
  54. CBaseAz(OBJECT_TYPE_AZ eObjectType,
  55. CContainerAz* pParentContainerAz)
  56. :m_eObjectType(eObjectType),
  57. m_pParentContainerAz(pParentContainerAz)
  58. {
  59. }
  60. virtual ~CBaseAz(){}
  61. //
  62. //Generic Get/Set Property Methods. They are overloaded for
  63. //various datatypes
  64. //
  65. virtual HRESULT SetProperty(IN LONG lPropId,
  66. IN const CString& strPropName) = 0;
  67. virtual HRESULT GetProperty(IN LONG lPropId,
  68. OUT CString* strPropName) = 0;
  69. virtual HRESULT SetProperty(IN LONG lPropId,
  70. IN BOOL bValue) = 0;
  71. virtual HRESULT GetProperty(IN LONG lPropId,
  72. OUT BOOL *pbValue) = 0;
  73. virtual HRESULT SetProperty(IN LONG lPropId,
  74. IN LONG lValue) = 0;
  75. virtual HRESULT GetProperty(IN LONG lPropId,
  76. OUT LONG* lValue) = 0;
  77. //
  78. //Most of the objects have some properties which are list
  79. //Following are generic methods to handle such properties
  80. //
  81. virtual HRESULT
  82. GetMembers(IN LONG /*lPropId*/,
  83. OUT CList<CBaseAz*,CBaseAz*>& /*listMembers*/)
  84. {
  85. return E_NOTIMPL;
  86. }
  87. virtual HRESULT
  88. AddMember(IN LONG /*lPropId*/,
  89. IN CBaseAz* /*pBaseAz*/)
  90. {
  91. return E_NOTIMPL;
  92. }
  93. virtual HRESULT
  94. RemoveMember(IN LONG /*lPropId*/,
  95. IN CBaseAz* /*pBaseAz*/)
  96. {
  97. return E_NOTIMPL;
  98. }
  99. //
  100. //Get Name and Description Method. They are frequently needed
  101. //so providing separate methods for them instead of using
  102. //Get/Set Property methods
  103. //
  104. virtual const CString&
  105. GetName()=0;
  106. virtual HRESULT
  107. SetName(IN const CString& strName)=0;
  108. virtual const
  109. CString& GetDescription()=0;
  110. virtual HRESULT
  111. SetDescription(IN const CString& strDesc)=0;
  112. virtual int
  113. GetImageIndex() = 0;
  114. //Is This object writable by current user.
  115. virtual HRESULT
  116. IsWritable(BOOL& brefWrite);
  117. //Submit all the changes done to object
  118. virtual HRESULT
  119. Submit() = 0;
  120. //Clear All the changes done to object.
  121. virtual HRESULT
  122. Clear() = 0;
  123. CContainerAz* GetParentAz()
  124. {
  125. return m_pParentContainerAz;
  126. }
  127. virtual
  128. CString
  129. GetParentType();
  130. OBJECT_TYPE_AZ
  131. GetObjectType()
  132. {
  133. return m_eObjectType;
  134. }
  135. virtual const
  136. CString& GetType()
  137. {
  138. return m_strType;
  139. }
  140. virtual CSidHandler*
  141. GetSidHandler();
  142. virtual CAdminManagerAz*
  143. GetAdminManager();
  144. protected:
  145. virtual VOID
  146. SetType(UINT nTypeStringId)
  147. {
  148. VERIFY(m_strType.LoadString(nTypeStringId));
  149. }
  150. //Type of object
  151. OBJECT_TYPE_AZ m_eObjectType;
  152. //Parent AzObject
  153. CContainerAz* m_pParentContainerAz;
  154. CString m_strName;
  155. CString m_strDescription;
  156. CString m_strType;
  157. };
  158. /******************************************************************************
  159. Class: CBaseAzImpl
  160. Purpose: A templated class which implements CBaseAz methods
  161. ******************************************************************************/
  162. template<class IAzInterface>
  163. class CBaseAzImpl: public CBaseAz
  164. {
  165. public:
  166. CBaseAzImpl(CComPtr<IAzInterface>& pAzInterface,
  167. OBJECT_TYPE_AZ eObjectType,
  168. CContainerAz* pParentContainerAz);
  169. virtual ~CBaseAzImpl();
  170. //
  171. //CBaseAz overrides
  172. //
  173. virtual HRESULT SetProperty(IN LONG lPropId,
  174. IN const CString& strPropName);
  175. virtual HRESULT GetProperty(IN LONG lPropId,
  176. OUT CString* strPropName);
  177. virtual HRESULT SetProperty(IN LONG lPropId,
  178. IN BOOL bValue);
  179. virtual HRESULT GetProperty(IN LONG lPropId,
  180. OUT BOOL *pbValue);
  181. virtual HRESULT SetProperty(IN LONG lPropId,
  182. IN LONG lValue);
  183. virtual HRESULT GetProperty(IN LONG lPropId,
  184. OUT LONG* lValue);
  185. virtual const CString& GetName();
  186. virtual HRESULT SetName(IN const CString& strName);
  187. virtual const CString& GetDescription();
  188. virtual HRESULT SetDescription(IN const CString& strDesc);
  189. virtual HRESULT Submit();
  190. virtual HRESULT Clear();
  191. protected:
  192. CComPtr<IAzInterface> m_spAzInterface;
  193. };
  194. /******************************************************************************
  195. Class: CContainerAz
  196. Purpose: AdminManagerAz, ApplicationAz and ScopeAz can contain child objects.
  197. All of them can contain group objects. CContainerAz is base class
  198. for all AzObjects which are container
  199. ******************************************************************************/
  200. class CContainerAz :public CBaseAz
  201. {
  202. public:
  203. CContainerAz(OBJECT_TYPE_AZ eObjectType,
  204. CContainerAz* pParentContainerAz)
  205. :CBaseAz(eObjectType,
  206. pParentContainerAz)
  207. {
  208. }
  209. virtual ~CContainerAz(){}
  210. //
  211. //Create/Delete/Open an object of type eObjectType
  212. //
  213. virtual HRESULT
  214. CreateAzObject(IN OBJECT_TYPE_AZ eObjectType,
  215. IN const CString& strName,
  216. OUT CBaseAz** ppBaseAz) = 0;
  217. virtual HRESULT
  218. DeleteAzObject(IN OBJECT_TYPE_AZ eObjectType,
  219. IN const CString& strName) = 0;
  220. virtual HRESULT
  221. OpenObject(IN OBJECT_TYPE_AZ eObjectType,
  222. IN const CString& strName,
  223. OUT CBaseAz** ppBaseAz) = 0;
  224. //returns Child AzObject of type eObjectType
  225. HRESULT
  226. GetAzChildObjects(IN OBJECT_TYPE_AZ eObjectType,
  227. IN OUT CList<CBaseAz*,CBaseAz*>& ListChildObjects);
  228. //
  229. //Group Methods
  230. //
  231. virtual HRESULT CreateGroup(IN const CString& strName,
  232. OUT CGroupAz** ppGroupAz) = 0;
  233. virtual HRESULT DeleteGroup(IN const CString& strName) =0;
  234. virtual HRESULT OpenGroup(IN const CString& strGroupName,
  235. OUT CGroupAz** ppGroupAz) =0;
  236. virtual HRESULT GetGroupCollection(OUT GROUP_COLLECTION** ppGroupCollection) =0;
  237. //
  238. //Check if child objects can be created under this container, i.e.
  239. //if current user has access to create child objects
  240. //
  241. virtual HRESULT
  242. CanCreateChildObject(BOOL& bCahCreateChild);
  243. virtual BOOL
  244. IsSecurable() = 0;
  245. virtual BOOL
  246. IsDelegatorSupported();
  247. virtual BOOL
  248. IsAuditingSupported();
  249. //
  250. //Policy Reader and AdminProperty
  251. //
  252. virtual HRESULT
  253. GetPolicyUsers( IN LONG lPropId,
  254. OUT CList<CBaseAz*,CBaseAz*>& pListAdmins) = 0;
  255. virtual HRESULT
  256. AddPolicyUser(LONG lPropId,
  257. IN CBaseAz* pBaseAz) = 0;
  258. virtual HRESULT
  259. RemovePolicyUser(LONG lPropId,
  260. IN CBaseAz* pBaseAz) = 0;
  261. //
  262. //CBaseAz Overrides
  263. //
  264. virtual HRESULT
  265. GetMembers(IN LONG lPropId,
  266. OUT CList<CBaseAz*,CBaseAz*>& listMembers);
  267. virtual HRESULT
  268. AddMember(IN LONG lPropId,
  269. IN CBaseAz* pBaseAz);
  270. virtual HRESULT
  271. RemoveMember(IN LONG lPropId,
  272. IN CBaseAz* pBaseAz);
  273. protected:
  274. //Get collection of object of type eObjectType
  275. virtual HRESULT
  276. GetAzObjectCollection(IN OBJECT_TYPE_AZ eObjectType,
  277. OUT CBaseAzCollection **ppBaseAzCollection) = 0;
  278. };
  279. /******************************************************************************
  280. Class: CContainerAzImpl
  281. Purpose: A templated class which implements CContainerAz methods
  282. ******************************************************************************/
  283. template<class IAzInterface>
  284. class CContainerAzImpl: public CContainerAz
  285. {
  286. public:
  287. CContainerAzImpl(CComPtr<IAzInterface>& pAzInterface,
  288. OBJECT_TYPE_AZ eObjectType,
  289. CContainerAz* pParentContainerAz);
  290. virtual ~CContainerAzImpl();
  291. //
  292. //CContainerAz Overrides
  293. //
  294. virtual HRESULT CreateGroup(IN const CString& strName,
  295. OUT CGroupAz** ppGroupAz);
  296. virtual HRESULT DeleteGroup(IN const CString& strName);
  297. virtual HRESULT GetGroupCollection(OUT GROUP_COLLECTION** ppGroupCollection);
  298. virtual HRESULT OpenGroup(IN const CString& strGroupName,
  299. OUT CGroupAz** ppGroupAz);
  300. virtual HRESULT
  301. GetPolicyUsers(IN LONG lPropId,
  302. OUT CList<CBaseAz*,CBaseAz*>& pListAdmins);
  303. virtual HRESULT
  304. AddPolicyUser(LONG lPropId,
  305. IN CBaseAz* pBaseAz);
  306. virtual HRESULT
  307. RemovePolicyUser(LONG lPropId,
  308. IN CBaseAz* pBaseAz);
  309. virtual BOOL
  310. IsSecurable();
  311. //
  312. //CBaseAz overrides
  313. //
  314. virtual HRESULT SetProperty(IN LONG lPropId,
  315. IN const CString& strPropName);
  316. virtual HRESULT GetProperty(IN LONG lPropId,
  317. OUT CString* strPropName);
  318. virtual HRESULT SetProperty(IN LONG lPropId,
  319. IN BOOL bValue);
  320. virtual HRESULT GetProperty(IN LONG lPropId,
  321. OUT BOOL *pbValue);
  322. virtual HRESULT SetProperty(IN LONG lPropId,
  323. IN LONG lValue);
  324. virtual HRESULT GetProperty(IN LONG lPropId,
  325. OUT LONG* lValue);
  326. virtual const CString& GetName();
  327. virtual HRESULT SetName(IN const CString& strName);
  328. virtual const CString& GetDescription();
  329. virtual HRESULT SetDescription(IN const CString& strDesc);
  330. virtual HRESULT Submit();
  331. virtual HRESULT Clear();
  332. protected:
  333. CComPtr<IAzInterface> m_spAzInterface;
  334. };
  335. /******************************************************************************
  336. Class: CRoleTaskContainerAz
  337. Purpose: Base class for cotnaiers which can contain role and task.
  338. CScopeAz and CApplicationAz will be derived from this
  339. ******************************************************************************/
  340. class CRoleTaskContainerAz :public CContainerAz
  341. {
  342. public:
  343. CRoleTaskContainerAz(OBJECT_TYPE_AZ eObjectType,
  344. CContainerAz* pParentContainerAz)
  345. :CContainerAz(eObjectType,
  346. pParentContainerAz)
  347. {
  348. }
  349. virtual ~CRoleTaskContainerAz(){}
  350. //
  351. //Role and Task Methods
  352. //
  353. virtual HRESULT CreateRole(IN const CString& strName,
  354. OUT CRoleAz** ppRoleAz)= 0;
  355. virtual HRESULT CreateTask(IN const CString& strName,
  356. OUT CTaskAz** ppTaskAz)= 0;
  357. virtual HRESULT DeleteRole(IN const CString& strName)= 0;
  358. virtual HRESULT DeleteTask(IN const CString& strName)= 0;
  359. virtual HRESULT GetTaskCollection(OUT TASK_COLLECTION** ppTaskCollection)= 0;
  360. virtual HRESULT GetRoleCollection(OUT ROLE_COLLECTION** ppRoleCollection)= 0;
  361. virtual HRESULT OpenTask(IN const CString& strTaskName,
  362. OUT CTaskAz** ppTaskAz)= 0;
  363. virtual HRESULT OpenRole(IN const CString& strRoleName,
  364. OUT CRoleAz** ppRoleAz)= 0;
  365. };
  366. /******************************************************************************
  367. Class: CRoleTaskContainerAzImpl
  368. Purpose: A templated class which implements CRoleTaskContainerAz methods
  369. ******************************************************************************/
  370. template<class IAzInterface>
  371. class CRoleTaskContainerAzImpl: public CRoleTaskContainerAz
  372. {
  373. public:
  374. CRoleTaskContainerAzImpl(CComPtr<IAzInterface>& pAzInterface,
  375. OBJECT_TYPE_AZ eObjectType,
  376. CContainerAz* pParentContainerAz);
  377. virtual ~CRoleTaskContainerAzImpl();
  378. //
  379. //CRoleTaskContainerAz Overrides
  380. //
  381. virtual HRESULT CreateRole(IN const CString& strName,
  382. OUT CRoleAz** ppRoleAz);
  383. virtual HRESULT CreateTask(IN const CString& strName,
  384. OUT CTaskAz** ppTaskAz);
  385. virtual HRESULT DeleteRole(IN const CString& strName);
  386. virtual HRESULT DeleteTask(IN const CString& strName);
  387. virtual HRESULT GetTaskCollection(OUT TASK_COLLECTION** ppTaskCollection);
  388. virtual HRESULT GetRoleCollection(OUT ROLE_COLLECTION** ppRoleCollection);
  389. virtual HRESULT OpenTask(IN const CString& strTaskName,
  390. OUT CTaskAz** ppTaskAz);
  391. virtual HRESULT OpenRole(IN const CString& strRoleName,
  392. OUT CRoleAz** ppRoleAz);
  393. //
  394. //CContainerAz Overrides
  395. //
  396. virtual HRESULT CreateGroup(IN const CString& strName,
  397. OUT CGroupAz** ppGroupAz);
  398. virtual HRESULT DeleteGroup(IN const CString& strName);
  399. virtual HRESULT GetGroupCollection(OUT GROUP_COLLECTION** ppGroupCollection);
  400. virtual HRESULT OpenGroup(IN const CString& strGroupName,
  401. OUT CGroupAz** ppGroupAz);
  402. virtual HRESULT
  403. GetPolicyUsers(IN LONG lPropId,
  404. OUT CList<CBaseAz*,CBaseAz*>& pListAdmins);
  405. virtual HRESULT
  406. AddPolicyUser(LONG lPropId,
  407. IN CBaseAz* pBaseAz);
  408. virtual HRESULT
  409. RemovePolicyUser(LONG lPropId,
  410. IN CBaseAz* pBaseAz);
  411. virtual BOOL
  412. IsSecurable();
  413. //
  414. //CBaseAz overrides
  415. //
  416. virtual HRESULT SetProperty(IN LONG lPropId,
  417. IN const CString& strPropName);
  418. virtual HRESULT GetProperty(IN LONG lPropId,
  419. OUT CString* strPropName);
  420. virtual HRESULT SetProperty(IN LONG lPropId,
  421. IN BOOL bValue);
  422. virtual HRESULT GetProperty(IN LONG lPropId,
  423. OUT BOOL *pbValue);
  424. virtual HRESULT SetProperty(IN LONG lPropId,
  425. IN LONG lValue);
  426. virtual HRESULT GetProperty(IN LONG lPropId,
  427. OUT LONG* lValue);
  428. virtual const CString& GetName();
  429. virtual HRESULT SetName(IN const CString& strName);
  430. virtual const CString& GetDescription();
  431. virtual HRESULT SetDescription(IN const CString& strDesc);
  432. virtual HRESULT Submit();
  433. virtual HRESULT Clear();
  434. protected:
  435. CComPtr<IAzInterface> m_spAzInterface;
  436. };
  437. /******************************************************************************
  438. Class: CAdminManagerAz
  439. Purpose: class for IAzAdminManager interface
  440. ******************************************************************************/
  441. class CAdminManagerAz : public CContainerAzImpl<IAzAuthorizationStore>
  442. {
  443. public:
  444. CAdminManagerAz(CComPtr<IAzAuthorizationStore>& spAzInterface);
  445. virtual ~CAdminManagerAz();
  446. //
  447. //Functions for creating a new or opening an existing AdminManager
  448. //object
  449. //
  450. HRESULT Initialize(IN ULONG lStoreType,
  451. IN ULONG lFlags,
  452. IN const CString& strPolicyURL);
  453. HRESULT OpenPolicyStore(IN ULONG lStoreType,
  454. IN const CString& strPolicyURL);
  455. HRESULT CreatePolicyStore(IN ULONG lStoreType,
  456. IN const CString& strPolicyURL);
  457. HRESULT DeleteSelf();
  458. HRESULT UpdateCache();
  459. //
  460. //Application Methods
  461. //
  462. HRESULT CreateApplication(const CString& strApplicationName,CApplicationAz ** ppApplicationAz);
  463. HRESULT DeleteApplication(const CString& strApplicationName);
  464. HRESULT GetApplicationCollection(APPLICATION_COLLECTION** ppApplicationCollection);
  465. //CContainerAz Overrides
  466. virtual HRESULT CreateAzObject(IN OBJECT_TYPE_AZ eObjectType,
  467. IN const CString& strName,
  468. OUT CBaseAz** ppBaseAz);
  469. virtual HRESULT DeleteAzObject(IN OBJECT_TYPE_AZ eObjectType,
  470. IN const CString& strName);
  471. virtual HRESULT OpenObject(IN OBJECT_TYPE_AZ eObjectType,
  472. IN const CString& strName,
  473. OUT CBaseAz** ppBaseAz);
  474. virtual HRESULT GetAzObjectCollection(IN OBJECT_TYPE_AZ eObjectType,
  475. OUT CBaseAzCollection **ppBaseAzCollection);
  476. virtual const CString& GetName(){return m_strPolicyURL;}
  477. virtual const CString& GetDisplayName(){ return m_strAdminManagerName;}
  478. //XML Store or AD
  479. ULONG GetStoreType(){return m_ulStoreType;}
  480. HRESULT
  481. CreateSidHandler(const CString& strTargetComputerName);
  482. CSidHandler*
  483. GetSidHandler()
  484. {
  485. return m_pSidHandler;
  486. }
  487. CAdminManagerAz*
  488. GetAdminManager()
  489. {
  490. return this;
  491. }
  492. int
  493. GetImageIndex(){ return iIconStore;}
  494. private:
  495. CString m_strPolicyURL; //Entire path
  496. CString m_strAdminManagerName; //leaf element which is used for display
  497. ULONG m_ulStoreType;
  498. CSidHandler* m_pSidHandler;
  499. };
  500. /******************************************************************************
  501. Class: CApplicationAz
  502. Purpose: class for IAzApplication interface
  503. ******************************************************************************/
  504. class CApplicationAz : public CRoleTaskContainerAzImpl<IAzApplication>
  505. {
  506. public:
  507. CApplicationAz(CComPtr<IAzApplication>& spAzInterface,
  508. CContainerAz* pParentContainerAz);
  509. virtual ~CApplicationAz();
  510. //
  511. //Scope Methods
  512. //
  513. virtual HRESULT CreateScope(IN const CString& strScopeName,
  514. OUT CScopeAz** ppScopeAz);
  515. virtual HRESULT DeleteScope(IN const CString& strScopeName);
  516. virtual HRESULT GetScopeCollection(OUT SCOPE_COLLECTION** ppScopeCollection);
  517. //
  518. //Methods for Operation,
  519. //
  520. virtual HRESULT CreateOperation(IN const CString& strOperationName,
  521. OUT COperationAz** ppOperationAz);
  522. virtual HRESULT DeleteOperation(IN const CString& strOperationName);
  523. virtual HRESULT OpenOperation(IN const CString& strOperationName,
  524. OUT COperationAz** ppOperationAz);
  525. virtual HRESULT GetOperationCollection(OUT OPERATION_COLLECTION** ppOperationCollection);
  526. //
  527. //CContainerAz Overrides
  528. //
  529. virtual HRESULT CreateAzObject(IN OBJECT_TYPE_AZ eObjectType,
  530. IN const CString& strName,
  531. OUT CBaseAz** ppBaseAz);
  532. virtual HRESULT DeleteAzObject(IN OBJECT_TYPE_AZ eObjectType,
  533. IN const CString& strName);
  534. virtual HRESULT OpenObject(IN OBJECT_TYPE_AZ eObjectType,
  535. IN const CString& strName,
  536. OUT CBaseAz** ppBaseAz);
  537. virtual HRESULT GetAzObjectCollection(IN OBJECT_TYPE_AZ eObjectType,
  538. OUT CBaseAzCollection **ppBaseAzCollection);
  539. int
  540. GetImageIndex(){ return iIconApplication;}
  541. };
  542. /******************************************************************************
  543. Class: CScopeAz
  544. Purpose: class for IAzScope interface
  545. ******************************************************************************/
  546. class CScopeAz: public CRoleTaskContainerAzImpl<IAzScope>
  547. {
  548. public:
  549. CScopeAz(CComPtr<IAzScope>& spAzInterface,
  550. CContainerAz* pParentContainerAz);
  551. virtual ~CScopeAz();
  552. //
  553. //CContainerAz Override
  554. //
  555. virtual HRESULT
  556. CreateAzObject(IN OBJECT_TYPE_AZ eObjectType,
  557. IN const CString& strName,
  558. OUT CBaseAz** ppBaseAz);
  559. virtual HRESULT
  560. DeleteAzObject(IN OBJECT_TYPE_AZ eObjectType,
  561. IN const CString& strName);
  562. virtual HRESULT
  563. OpenObject(IN OBJECT_TYPE_AZ eObjectType,
  564. IN const CString& strName,
  565. OUT CBaseAz** ppBaseAz);
  566. virtual HRESULT
  567. GetAzObjectCollection(IN OBJECT_TYPE_AZ eObjectType,
  568. OUT CBaseAzCollection **ppBaseAzCollection);
  569. int
  570. GetImageIndex(){ return iIconScope;}
  571. HRESULT
  572. CanScopeBeDelegated(BOOL & bDelegatable);
  573. HRESULT
  574. BizRulesWritable(BOOL &bBizRuleWritable);
  575. };
  576. /******************************************************************************
  577. Class: CTaskAz
  578. Purpose: class for IAzTask interface
  579. ******************************************************************************/
  580. class CTaskAz: public CBaseAzImpl<IAzTask>
  581. {
  582. public:
  583. CTaskAz(CComPtr<IAzTask>& spAzInterface,
  584. CContainerAz* pParentContainerAz);
  585. virtual ~CTaskAz();
  586. BOOL IsRoleDefinition();
  587. HRESULT MakeRoleDefinition();
  588. //CBaseAz Overrides
  589. virtual HRESULT
  590. GetMembers(IN LONG lPropId,
  591. OUT CList<CBaseAz*,CBaseAz*>& listMembers);
  592. virtual HRESULT
  593. AddMember(IN LONG lPropId,
  594. IN CBaseAz* pBaseAz);
  595. virtual HRESULT
  596. RemoveMember(IN LONG lPropId,
  597. IN CBaseAz* pBaseAz);
  598. int
  599. GetImageIndex();
  600. private:
  601. //Get Memeber Operations
  602. HRESULT GetOperations(OUT CList<CBaseAz*,CBaseAz*>& listOperationAz);
  603. //Get Member Tasks
  604. HRESULT GetTasks(OUT CList<CBaseAz*,CBaseAz*>& listTaskAz);
  605. };
  606. /******************************************************************************
  607. Class: CGroupAz
  608. Purpose: class for IAzApplicationGroup interface
  609. ******************************************************************************/
  610. class CGroupAz: public CBaseAzImpl<IAzApplicationGroup>
  611. {
  612. public:
  613. CGroupAz(CComPtr<IAzApplicationGroup>& spAzInterface,
  614. CContainerAz* pParentContainerAz);
  615. virtual ~CGroupAz();
  616. HRESULT GetGroupType(OUT LONG* plGroupType);
  617. HRESULT SetGroupType(IN LONG plGroupType);
  618. //Get Member groups of this group which are Windows Groups.
  619. HRESULT
  620. GetWindowsGroups(OUT CList<CBaseAz*, CBaseAz*>& listWindowsGroups,
  621. IN BOOL bMember);
  622. //Add new windows group to member list
  623. HRESULT AddWindowsGroup(IN CBaseAz* pBaseAz,
  624. IN BOOL bMember);
  625. //Get Member Groups of this group which are Application Groups
  626. HRESULT GetApplicationGroups(OUT CList<CBaseAz*,CBaseAz*>& listGroupAz,
  627. IN BOOL bMember);
  628. //Add new Application group to member list
  629. HRESULT AddApplicationGroup(IN CBaseAz* pGroupAz,
  630. IN BOOL bMember);
  631. //CBaseAz Overrides
  632. virtual HRESULT
  633. GetMembers(IN LONG lPropId,
  634. OUT CList<CBaseAz*,CBaseAz*>& listMembers);
  635. virtual HRESULT
  636. AddMember(IN LONG lPropId,
  637. IN CBaseAz* pBaseAz);
  638. virtual HRESULT
  639. RemoveMember(IN LONG lPropId,
  640. IN CBaseAz* pBaseAz);
  641. int
  642. GetImageIndex();
  643. };
  644. /******************************************************************************
  645. Class: CRoleAz
  646. Purpose: class for IAzRole interface
  647. ******************************************************************************/
  648. class CRoleAz: public CBaseAzImpl<IAzRole>
  649. {
  650. public:
  651. CRoleAz(CComPtr<IAzRole>& spAzInterface,
  652. CContainerAz* pParentContainerAz);
  653. virtual ~CRoleAz();
  654. //CBaseAz Overrides
  655. virtual HRESULT
  656. GetMembers(IN LONG lPropId,
  657. OUT CList<CBaseAz*,CBaseAz*>& listMembers);
  658. virtual HRESULT
  659. AddMember(IN LONG lPropId,
  660. IN CBaseAz* pBaseAz);
  661. virtual HRESULT
  662. RemoveMember(IN LONG lPropId,
  663. IN CBaseAz* pBaseAz);
  664. int
  665. GetImageIndex(){ return iIconRole;}
  666. private:
  667. //Get Member operations
  668. HRESULT
  669. GetOperations(OUT CList<CBaseAz*,CBaseAz*>& listOperationAz);
  670. //Get Member Tasks
  671. HRESULT GetTasks(CList<CBaseAz*,CBaseAz*>& listTaskAz);
  672. //Get Member groups of this group which are Windows Groups.
  673. HRESULT GetWindowsGroups(OUT CList<CBaseAz*,CBaseAz*>& listUsers);
  674. //Get Member Groups of this group which are Application Groups
  675. HRESULT GetApplicationGroups(OUT CList<CBaseAz*,CBaseAz*>& listGroupAz);
  676. };
  677. /******************************************************************************
  678. Class: COperationAz
  679. Purpose: class for IAzOperation interface
  680. ******************************************************************************/
  681. class COperationAz: public CBaseAzImpl<IAzOperation>
  682. {
  683. public:
  684. COperationAz(CComPtr<IAzOperation>& spAzInterface,
  685. CContainerAz* pParentContainerAz);
  686. virtual ~COperationAz();
  687. int
  688. GetImageIndex(){ return iIconOperation;}
  689. private:
  690. };
  691. /******************************************************************************
  692. Class: CSidCacheAz
  693. Purpose: class for IAzOperation interface
  694. ******************************************************************************/
  695. class CSidCacheAz: public CBaseAz
  696. {
  697. public:
  698. CSidCacheAz(SID_CACHE_ENTRY *pSidCacheEntry,
  699. CBaseAz* pOwnerBaseAz);
  700. virtual ~CSidCacheAz();
  701. PSID GetSid()
  702. {
  703. return m_pSidCacheEntry->GetSid();
  704. }
  705. CBaseAz* GetOwnerAz()
  706. {
  707. return m_pOwnerBaseAz;
  708. }
  709. //
  710. //CBaseAz Override
  711. //
  712. CString GetParentType()
  713. {
  714. return m_pOwnerBaseAz->GetType();
  715. }
  716. virtual HRESULT SetProperty(IN LONG /*lPropId*/,
  717. IN const CString& /*strPropName*/){return E_NOTIMPL;};
  718. virtual HRESULT GetProperty(IN LONG /*lPropId*/,
  719. OUT CString* /*strPropName*/){return E_NOTIMPL;};
  720. virtual HRESULT SetProperty(IN LONG /*lPropId*/,
  721. IN BOOL /*bValue*/){return E_NOTIMPL;};
  722. virtual HRESULT GetProperty(IN LONG /*lPropId*/,
  723. OUT BOOL* /*pbValue*/){return E_NOTIMPL;};
  724. virtual HRESULT SetProperty(IN LONG /*lPropId*/,
  725. IN LONG /*lValue*/){return E_NOTIMPL;};
  726. virtual HRESULT GetProperty(IN LONG /*lPropId*/,
  727. OUT LONG* /*lValue*/){return E_NOTIMPL;};
  728. //
  729. //Get Name and Description Method. They are frequently needed
  730. //so providing separate methods for them instead of using
  731. //Get/Set Property methods
  732. //
  733. virtual const
  734. CString& GetName()
  735. {
  736. return m_pSidCacheEntry->GetNameToDisplay();
  737. }
  738. virtual const
  739. CString& GetType()
  740. {
  741. return m_pSidCacheEntry->GetSidType();
  742. }
  743. virtual HRESULT SetName(IN const CString& /*strName*/){return E_NOTIMPL;}
  744. virtual const CString& GetDescription(){return m_strDescription;}
  745. virtual HRESULT SetDescription(IN const CString& /*strDesc*/){return E_NOTIMPL;}
  746. //Is This object writable by current user.
  747. virtual HRESULT
  748. IsWritable(BOOL& brefWrite)
  749. {
  750. brefWrite = FALSE;
  751. return S_OK;
  752. }
  753. int
  754. GetImageIndex();
  755. //Submit all the changes done to object
  756. virtual HRESULT Submit(){return E_NOTIMPL;};
  757. //Clear All the changes done to object.
  758. virtual HRESULT Clear(){return E_NOTIMPL;};
  759. private:
  760. SID_CACHE_ENTRY *m_pSidCacheEntry;
  761. //
  762. //CSidCacheAz is not a real object in AZ Schema. Its an object to represent
  763. //SIDS. SIDs appear in various member properties of BaseAz objects.
  764. //m_pOwnerBaseAz is back pointer to owner object which has this CSidCacheAz
  765. //object in member list of one of its property
  766. //
  767. CBaseAz* m_pOwnerBaseAz;
  768. };
  769. //+----------------------------------------------------------------------------
  770. // Function: GetAllAzChildObjects
  771. // Synopsis: Functions gets the child objects of type eObjectType and appends
  772. // them to ListChildObjects. It gets the childobjects from
  773. // pParentContainerAz and from parent/grandparent of
  774. // pParentContainerAz.
  775. //-----------------------------------------------------------------------------
  776. HRESULT GetAllAzChildObjects(IN CContainerAz* pParentContainerAz,
  777. IN OBJECT_TYPE_AZ eObjectType,
  778. OUT CList<CBaseAz*,CBaseAz*>& ListChildObjects);
  779. //+----------------------------------------------------------------------------
  780. // Function: GetPolicyUsersFromAllLevel
  781. // Synopsis: Functions gets the PolicyUsers and appends
  782. // them to listPolicyUsers. It gets the PolicyUsers from
  783. // pContainerAz and from parent/grandparent of
  784. // pContainerAz.
  785. //-----------------------------------------------------------------------------
  786. HRESULT GetPolicyUsersFromAllLevel(IN LONG lPropId,
  787. IN CContainerAz* pContainerAz,
  788. OUT CList<CBaseAz*,CBaseAz*>& listPolicyUsers);
  789. //+----------------------------------------------------------------------------
  790. // Function: OpenObjectFromAllLevels
  791. // Synopsis: Opens an object of type eObjectType and name strName. If object
  792. // cannot be opened at pParentContainerAz, function tries at
  793. // parent/grandparent of pParentContainerAz
  794. //-----------------------------------------------------------------------------
  795. HRESULT OpenObjectFromAllLevels(IN CContainerAz* pParentContainerAz,
  796. IN OBJECT_TYPE_AZ eObjectType,
  797. IN const CString& strName,
  798. OUT CBaseAz** ppBaseAz);
  799. //+----------------------------------------------------------------------------
  800. // Function:SafeArrayToAzObjectList
  801. // Synopsis:Input to function is a safearray of BSTR. Each BSTR in array is
  802. // name of object of type eObjectType. Function converts this safe
  803. // array into a list of corresponding CBaseAz objects.
  804. // Arguments:var: Varaint of type VT_ARRAY|VT_BSTR
  805. // pParentContainerAz: Pointer of parent which contains objects
  806. // in safe array.
  807. // eObjectType: Type of object in safe array
  808. // listAzObject: Gets list of CBaseAz objects
  809. // Returns:
  810. //-----------------------------------------------------------------------------
  811. HRESULT SafeArrayToAzObjectList(IN CComVariant& var,
  812. IN CContainerAz* pParentContainerAz,
  813. IN OBJECT_TYPE_AZ eObjectType,
  814. OUT CList<CBaseAz*,CBaseAz*>& listAzObject);
  815. HRESULT
  816. SafeArrayToSidList(IN CComVariant& var,
  817. OUT CList<PSID,PSID>& listSid);