Source code of Windows XP (NT5)
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.

160 lines
7.7 KiB

  1. /*---------------------------------------------------------------------------
  2. File: TAcctReplNode.hpp
  3. Comments: implementation/Definition of the TAcctReplNode class.
  4. (c) Copyright 1999, Mission Critical Software, Inc., All Rights Reserved
  5. Proprietary and confidential to Mission Critical Software, Inc.
  6. REVISION LOG ENTRY
  7. Revision By: Sham Chauthani
  8. Revised on 07/02/99 12:40:00
  9. ---------------------------------------------------------------------------
  10. */
  11. #ifndef __TACCTREPLNODE_HPP__
  12. #define __TACCTREPLNODE_HPP__
  13. //#pragma title("TAcctReplNode.hpp- class definitions for Account replication code")
  14. #include <lmcons.h>
  15. #include "Common.hpp"
  16. #include "EaLen.hpp"
  17. #include "Err.hpp"
  18. #include "UString.hpp"
  19. #include "CommaLog.hpp"
  20. #include "WorkObj.h"
  21. #include <COMDEF.h>
  22. #define AR_Status_Created (0x00000001)
  23. #define AR_Status_Replaced (0x00000002)
  24. #define AR_Status_AlreadyExisted (0x00000004)
  25. #define AR_Status_RightsUpdated (0x00000008)
  26. #define AR_Status_DomainChanged (0x00000010)
  27. #define AR_Status_Rebooted (0x00000020)
  28. #define AR_Status_Special (0x00000040)
  29. #define AR_Status_Critical (0x00000080)
  30. #define AR_Status_Warning (0x40000000)
  31. #define AR_Status_Error (0x80000000)
  32. // Opertation flags to be performed on the Account
  33. #define OPS_Create_Account (0x00000001)
  34. #define OPS_Copy_Properties (0x00000002)
  35. #define OPS_Process_Members (0x00000004)
  36. #define OPS_Process_MemberOf (0x00000008)
  37. #define OPS_Call_Extensions (0x00000010)
  38. #define OPS_Move_Object (0x00000020)
  39. #define OPS_All OPS_Create_Account | OPS_Copy_Properties | OPS_Process_Members | OPS_Process_MemberOf | OPS_Call_Extensions
  40. #define OPS_Copy OPS_Create_Account | OPS_Copy_Properties
  41. class TAcctReplNode:public TNode
  42. {
  43. _bstr_t name;
  44. _bstr_t newName;
  45. _bstr_t sourcePath;
  46. _bstr_t targetPath;
  47. _bstr_t type; // Account Type
  48. DWORD status;
  49. DWORD ridSrc;
  50. DWORD ridTgt;
  51. _bstr_t sSourceSamName;
  52. _bstr_t sTargetSamName;
  53. _bstr_t sSrcProfilePath;
  54. _bstr_t sTgtProfilePath;
  55. _bstr_t sTargetGUID;
  56. _bstr_t sSourceUPN;
  57. PSID srcSid;
  58. HRESULT hr;
  59. long lGroupType;
  60. public:
  61. DWORD operations; // BitMask Specifies what operations to perform on a pirticular account
  62. bool IsFilled; // Tells us if we need to process this account node any further to fill in required info
  63. bool IsProfPathFilled;
  64. bool bExpanded;
  65. bool bChangedType;
  66. // following two properties are added to support UpdateMemberToGroups function to just be able to add
  67. // migrated objects to the groups that they belong to.
  68. _bstr_t sMemberName; // This contains the sam name to the member of this group object
  69. _bstr_t sMemberType; // This contains the type of the member.
  70. long lFlags;
  71. long lExpDate;
  72. BOOL bUPNConflicted;
  73. public:
  74. TAcctReplNode() :
  75. status(0),
  76. ridSrc(0),
  77. ridTgt(0),
  78. srcSid(NULL),
  79. hr(-1),
  80. lGroupType(0),
  81. operations(OPS_All),
  82. IsFilled(false),
  83. IsProfPathFilled(false),
  84. bExpanded(false),
  85. bChangedType(false),
  86. sMemberName(L""),
  87. sMemberType(L""),
  88. lFlags(0),
  89. lExpDate(0),
  90. bUPNConflicted(FALSE)
  91. {
  92. }
  93. WCHAR const * GetName() const { return !name ? L"" : name; }
  94. WCHAR const * GetTargetName() const { return !newName ? !name ? L"" : name : newName; }
  95. WCHAR const * GetTargetPath() const { return !targetPath ? L"" : targetPath; }
  96. WCHAR const * GetSourcePath() const { return !sourcePath ? L"" : sourcePath; }
  97. WCHAR const * GetType() const { return !type ? L"" : type; }
  98. WCHAR const * GetSourceSam() const { return !sSourceSamName ? L"" : sSourceSamName; }
  99. WCHAR const * GetTargetSam() const { return !sTargetSamName ? L"" : sTargetSamName; }
  100. WCHAR const * GetTargetProfile() const { return !sTgtProfilePath ? L"" : sTgtProfilePath; }
  101. WCHAR const * GetSourceProfile() const { return !sSrcProfilePath ? L"" : sSrcProfilePath; }
  102. WCHAR const * GetTargetGUID() const { return !sTargetGUID ? L"" : sTargetGUID; }
  103. WCHAR const * GetSourceUPN() const { return !sSourceUPN ? L"" : sSourceUPN; }
  104. PSID GetSourceSid() { return srcSid; }
  105. DWORD GetStatus() const { return status; }
  106. DWORD GetSourceRid() const { return ridSrc; }
  107. DWORD GetTargetRid() const { return ridTgt; }
  108. long GetGroupType() { return lGroupType; }
  109. HRESULT GetHr() const { return hr; }
  110. void SetName(const TCHAR * newname) { name = newname; }
  111. void SetTargetName(const WCHAR * name) { newName = name; }
  112. void SetTargetPath(const WCHAR * sPath) { targetPath = sPath; }
  113. void SetSourcePath(const WCHAR * sPath) { sourcePath = sPath; }
  114. void SetSourceSam(const WCHAR * sName) { sSourceSamName = sName; }
  115. void SetTargetSam(const WCHAR * sName) { sTargetSamName = sName; }
  116. void SetSourceProfile(const WCHAR * sPath) { sSrcProfilePath = sPath; IsProfPathFilled = true; }
  117. void SetTargetProfile(const WCHAR * sPath) { sTgtProfilePath = sPath; }
  118. void SetTargetGUID(const WCHAR * sGUID) { sTargetGUID = sGUID; }
  119. void SetType(const WCHAR * newtype) { type = newtype; }
  120. void SetSourceUPN(const WCHAR * sName) { sSourceUPN = sName; }
  121. void SetSourceSid(PSID sSid) { srcSid = sSid; }
  122. void SetStatus(DWORD val) { status = val; }
  123. void SetGroupType(long type) { lGroupType = type; }
  124. void SetSourceRid(DWORD val) { ridSrc = val; }
  125. void SetTargetRid(DWORD val) { ridTgt = val; }
  126. void SetHr(const HRESULT hrRes) { hr = hrRes; }
  127. void MarkCreated() { status |= AR_Status_Created; }
  128. void MarkReplaced() { status |= AR_Status_Replaced; }
  129. void MarkAlreadyThere() { status |= AR_Status_AlreadyExisted; }
  130. void MarkError() { status |= AR_Status_Error; }
  131. void MarkWarning() { status |= AR_Status_Warning; }
  132. void MarkRightsUpdated() { status |= AR_Status_RightsUpdated; }
  133. void MarkDomainChanged() { status |= AR_Status_DomainChanged; }
  134. void MarkRebooted() { status |= AR_Status_Rebooted; }
  135. void MarkCritical() { status = AR_Status_Critical; }
  136. BOOL WasCreated() { return status & AR_Status_Created; }
  137. BOOL WasReplaced() { return status & AR_Status_Replaced; }
  138. BOOL IsCritical() { return status & AR_Status_Critical; }
  139. BOOL CreateAccount() { return operations & OPS_Create_Account; }
  140. BOOL CopyProps() { return operations & OPS_Copy_Properties; }
  141. BOOL ProcessMem() { return operations & OPS_Process_Members; }
  142. BOOL ProcessMemOf() { return operations & OPS_Process_MemberOf; }
  143. BOOL CallExt() { return operations & OPS_Call_Extensions; }
  144. };
  145. #endif