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.

34 lines
933 B

  1. #include "stdafx.h"
  2. #include "roles.h"
  3. #include "csdisp.h" // certsrv picker
  4. #define __dwFILE__ __dwFILE_CERTMMC_ROLES_CPP__
  5. #ifdef _DEBUG
  6. #undef THIS_FILE
  7. #define THIS_FILE __FILE__
  8. #endif
  9. bool CRolesSupportInPropPage::RoleCanUseThisControl(int nID)
  10. {
  11. DWORD dwCrtUserRoles = m_pCA->GetMyRoles();
  12. for(int i=0; i<m_nRoleMapEntries; i++)
  13. {
  14. if(nID==m_pRoleMap[i].nIDDlgItem)
  15. return (dwCrtUserRoles & m_pRoleMap[i].dwRoles)?true:false;
  16. }
  17. CSASSERT(0 && "Found a control with no matching role access defined");
  18. return false;
  19. }
  20. BOOL CRolesSupportInPropPage::EnableControl(HWND hwnd, int nID, BOOL bEnable)
  21. {
  22. // If current user's roles don't allow it to use the control, disable it
  23. if(RoleCanUseThisControl(nID))
  24. return ::EnableWindow(GetDlgItem(hwnd, nID), bEnable);
  25. else
  26. return ::EnableWindow(GetDlgItem(hwnd, nID), FALSE);
  27. }