sechandler.hpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*##############################################################################
  2. Copyright (C) 2011 HPCC Systems.
  3. All rights reserved. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ############################################################################## */
  14. #pragma warning( disable : 4786)
  15. #ifndef _SECHANDLER_HPP__
  16. #define _SECHANDLER_HPP__
  17. #include "jliball.hpp"
  18. #include "seclib.hpp"
  19. #include "esp.hpp"
  20. #include "sechandler.hpp"
  21. class SecHandler : public CInterface
  22. {
  23. Owned<ISecManager> m_secmgr;
  24. Owned<ISecResourceList> m_resources;
  25. Owned<ISecUser> m_user;
  26. Owned<IAuthMap> m_feature_authmap;
  27. private:
  28. bool authorizeTrial(ISecUser& user,const char* pszFeatureUrl, SecAccessFlags & required_access);
  29. void AuditMessage(AuditType type, const char *filterType, const char *title, const char *parms, ...) __attribute__((format(printf, 5, 6)));
  30. public:
  31. IMPLEMENT_IINTERFACE;
  32. SecHandler();
  33. virtual ~SecHandler();
  34. bool authorizeSecFeature(const char* pszFeatureUrl, SecAccessFlags& access);
  35. bool authorizeSecFeatures(StringArray & features, IEspStringIntMap & pmap);
  36. bool validateSecFeatureAccess(const char* pszFeatureUrl, unsigned required, bool throwExcpt);
  37. bool authorizeSecReqFeatures(StringArray & features, IEspStringIntMap & pmap, unsigned *required);
  38. bool authorizeSecFeature(const char * pszFeatureUrl, const char* UserID, const char* CompanyID, SecAccessFlags & access,bool bCheckTrial,int DebitUnits, SecUserStatus & user_status);
  39. void setSecManger(ISecManager* mgr);
  40. void setResources(ISecResourceList* rlist);
  41. void setUser(ISecUser* user);
  42. void setFeatureAuthMap(IAuthMap * map);
  43. };
  44. #endif // !defined(_SECHANDLER_HPP__)