9 #ifndef _RMS_LIB_POLICYDESCRIPTOR_H_
10 #define _RMS_LIB_POLICYDESCRIPTOR_H_
13 #include <unordered_map>
17 #include "ModernAPIExport.h"
19 #include "UserRoles.h"
20 #include "UserRights.h"
24 class ProtectionPolicy;
31 struct HashConstString
33 long operator()(
const std::string& str)
const {
34 return static_cast<long>(std::hash<std::string>()(str));
39 using HashMapString = std::unordered_map<std::string, T, HashConstString>;
43 using AppDataHashMap = detail::HashMapString<std::string>;
76 void Name(
const std::string& value)
86 return this->description_;
95 this->description_ = value;
109 return this->userRightsList_;
117 return this->userRolesList_;
125 return this->contentValidUntil_;
133 const std::chrono::time_point<std::chrono::system_clock>& value)
135 this->contentValidUntil_ = value;
143 return this->bAllowOfflineAccess_;
152 this->bAllowOfflineAccess_ = value;
160 return this->referrer_;
169 this->referrer_ = uri;
177 return this->encryptedAppData_;
186 this->encryptedAppData_ = value;
194 return this->signedAppData_;
203 this->signedAppData_ = value;
213 std::string description_;
215 std::vector<UserRights> userRightsList_;
216 std::vector<UserRoles> userRolesList_;
218 std::chrono::time_point<std::chrono::system_clock> contentValidUntil_;
219 bool bAllowOfflineAccess_;
221 std::shared_ptr<std::string> referrer_;
222 AppDataHashMap encryptedAppData_;
223 AppDataHashMap signedAppData_;
227 static void ValidateUserRightsList(
228 const std::vector<UserRights>& userRightsList);
229 static void ValidateUserRolesList(
230 const std::vector<UserRoles>& userRolesList);
236 enum OfflineCacheLifetimeConstants {
246 CacheNeverExpires = -1
251 #endif // _RMS_LIB_POLICYDESCRIPTOR_H_
bool AllowOfflineAccess()
Gets the setting of the offline access allowance control; True or False.
Definition: PolicyDescriptor.h:141
void Name(const std::string &value)
Sets the name of the PolicyDescriptor.
Definition: PolicyDescriptor.h:76
const std::chrono::time_point< std::chrono::system_clock > & ContentValidUntil()
Gets the date that the content is valid until.
Definition: PolicyDescriptor.h:123
void Referrer(std::shared_ptr< std::string >uri)
Sets the referral URI of the PolicyDescriptor.
Definition: PolicyDescriptor.h:167
Definition: AuthenticationCallbackImpl.h:16
void Description(const std::string &value)
Sets the description of the PolicyDescriptor.
Definition: PolicyDescriptor.h:93
void EncryptedAppData(const AppDataHashMap &value)
Sets the encrypted app data.
Definition: PolicyDescriptor.h:184
Specifies users and rights assigned for a file. This is information used for custom protection...
Definition: PolicyDescriptor.h:49
const std::vector< UserRights > & UserRightsList() const
Gets the user's rights list.
Definition: PolicyDescriptor.h:107
void AllowOfflineAccess(bool value)
Sets the True or False setting of the offline access allowance control.
Definition: PolicyDescriptor.h:150
const std::vector< UserRoles > & UserRolesList()
Gets the user's roles list.
Definition: PolicyDescriptor.h:115
const std::string & Name()
Gets the name of the PolicyDescriptor.
Definition: PolicyDescriptor.h:67
void ContentValidUntil(const std::chrono::time_point< std::chrono::system_clock > &value)
Sets the date that the content is valid until.
Definition: PolicyDescriptor.h:132
std::shared_ptr< std::string > Referrer() const
Gets the referral URI of the PolicyDescriptor.
Definition: PolicyDescriptor.h:158
void SignedAppData(const AppDataHashMap &value)
Sets the signed app data.
Definition: PolicyDescriptor.h:201
const AppDataHashMap & EncryptedAppData()
Gets the encrypted app data.
Definition: PolicyDescriptor.h:175
const std::string & Description()
Gets the description of the PolicyDescriptor.
Definition: PolicyDescriptor.h:84
const AppDataHashMap & SignedAppData()
Gets the signed app data.
Definition: PolicyDescriptor.h:192