sechandler.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #pragma warning( disable : 4786)
  14. #ifndef _SECHANDLER_HPP__
  15. #define _SECHANDLER_HPP__
  16. #include "jliball.hpp"
  17. #include "seclib.hpp"
  18. #include "esp.hpp"
  19. #include "sechandler.hpp"
  20. #include "espsecurecontext.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. Owned<IEspSecureContext> m_secureContext;
  28. private:
  29. bool authorizeTrial(ISecUser& user,const char* pszFeatureUrl, SecAccessFlags & required_access);
  30. void AuditMessage(AuditType type, const char *filterType, const char *title, const char *parms, ...) __attribute__((format(printf, 5, 6)));
  31. void AuditMessage(AuditType type, const char *filterType, const char *title);
  32. public:
  33. IMPLEMENT_IINTERFACE;
  34. SecHandler();
  35. virtual ~SecHandler();
  36. bool authorizeSecFeature(const char* pszFeatureUrl, SecAccessFlags& access);
  37. bool authorizeSecFeatures(StringArray & features, IEspStringIntMap & pmap);
  38. bool validateSecFeatureAccess(const char* pszFeatureUrl, unsigned required, bool throwExcpt);
  39. bool validateSecFeaturesAccess(MapStringTo<SecAccessFlags> & accessmap, bool throwExcpt);
  40. bool authorizeSecReqFeatures(StringArray & features, IEspStringIntMap & pmap, unsigned *required);
  41. bool authorizeSecFeature(const char * pszFeatureUrl, const char* UserID, const char* CompanyID, SecAccessFlags & access,bool bCheckTrial,int DebitUnits, SecUserStatus & user_status);
  42. void setSecManger(ISecManager* mgr);
  43. void setResources(ISecResourceList* rlist);
  44. void setUser(ISecUser* user);
  45. void setFeatureAuthMap(IAuthMap * map);
  46. void setSecureContext(IEspSecureContext* secureContext);
  47. };
  48. #endif // !defined(_SECHANDLER_HPP__)