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.

97 lines
2.7 KiB

  1. // LoginCtx.cpp -- Login Context class definition
  2. // (c) Copyright Schlumberger Technology Corp., unpublished work, created
  3. // 1999. This computer program includes Confidential, Proprietary
  4. // Information and is a Trade Secret of Schlumberger Technology Corp. All
  5. // use, disclosure, and/or reproduction is prohibited unless authorized
  6. // in writing. All Rights Reserved.
  7. #include "NoWarning.h"
  8. #include "ForceLib.h"
  9. #include <algorithm>
  10. #include "LoginCtx.h"
  11. #include "LoginTask.h"
  12. using namespace std;
  13. /////////////////////////// LOCAL/HELPER /////////////////////////////////
  14. /////////////////////////// PUBLIC /////////////////////////////////
  15. // Types
  16. // C'tors/D'tors
  17. LoginContext::LoginContext(HCardContext const &rhcardctx,
  18. LoginIdentity const &rlid)
  19. : m_fIsActive(false),
  20. m_at(rhcardctx, rlid)
  21. {}
  22. LoginContext::~LoginContext()
  23. {}
  24. // Operators
  25. // Operations
  26. void
  27. LoginContext::Activate(LoginTask &rlt)
  28. {
  29. m_fIsActive = false;
  30. rlt(m_at);
  31. m_fIsActive = true;
  32. }
  33. void
  34. LoginContext::Deactivate()
  35. {
  36. if (m_fIsActive)
  37. {
  38. m_fIsActive = false;
  39. m_at.CardContext()->Card()->Logout();
  40. }
  41. }
  42. void
  43. LoginContext::Nullify()
  44. {
  45. try
  46. {
  47. m_at.FlushPin();
  48. }
  49. catch(...)
  50. {
  51. }
  52. Deactivate();
  53. }
  54. // Access
  55. // Predicates
  56. bool
  57. LoginContext::IsActive() const
  58. {
  59. return m_fIsActive;
  60. }
  61. // Static Variables
  62. /////////////////////////// PROTECTED /////////////////////////////////
  63. // C'tors/D'tors
  64. // Operators
  65. // Operations
  66. // Access
  67. // Predicates
  68. // Static Variables
  69. /////////////////////////// PRIVATE /////////////////////////////////
  70. // C'tors/D'tors
  71. // Operators
  72. // Operations
  73. // Access
  74. // Predicates
  75. // Static Variables