Virtru SDK for C++  2.8.0
Virtru C++ SDK library - Create, Read, and Manage TDF3 Files
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
virtru_policy.h
Go to the documentation of this file.
1 /*
2 * Copyright © 2018 - 2019 Virtru Corporation
3 *
4 * SPDX - License - Identifier: MIT
5 *
6 */
7 //
8 // Virtru TDF3 SDK
9 //
10 // Created by Sujan Reddy on 2019/07/17.
11 //
12 
13 #ifndef VIRTRU_TDF3_SDK_VIRTRU_POLICY_H
14 #define VIRTRU_TDF3_SDK_VIRTRU_POLICY_H
15 
16 #include <string>
17 #include <vector>
18 #include <unordered_set>
19 #include <memory>
20 
21 namespace virtru {
22 
24  class Client;
25  class VirtruPolicyObject;
26 
27  class Policy {
28  public:
30  Policy();
31 
33  ~Policy();
34 
36  Policy(const Policy& policy);
37 
39  Policy& operator=(const Policy& policy);
40 
42  Policy(Policy&& policy) noexcept ;
43 
45  Policy& operator=(Policy&& policy);
46 
47  public: // Virtru controls
52  void setOwner(const std::string& owner);
53 
57  std::string getOwner() const;
58 
61  void shareWithUsers(const std::vector<std::string>& users);
62 
65  void removeUsers(const std::vector<std::string>& users);
66 
69  std::vector<std::string> getSharedUsers() const;
70 
72  void enableReshare();
73 
75  void disableReshare();
76 
79  bool isReshareEnabled() const;
80 
82  void enableWatermarking();
83 
85  void disableWatermarking();
86 
89  bool isWatermarkingEnabled() const;
90 
92  void enablePrint();
93 
95  void disablePrint();
96 
99  bool isPrintEnabled() const;
100 
102  void enableCopy();
103 
105  void disableCopy();
106 
109  bool isCopyEnabled() const;
110 
113 
116 
119  bool isPersistentProtectionEnabled() const;
120 
122  void enablePreventDownload();
123 
125  void disablePreventDownload();
126 
129  bool isPreventDownloadEnabled() const;
130 
134  void expireInMins(unsigned mins);
135 
139  void expireInDays(unsigned days);
140 
144  void addExpiration(const std::string& expirationDate);
145 
147  void removeExpiration();
148 
152  std::string getExpiration() const;
153 
156  std::string toString() const;
157 
158  private:
161  std::string toJsonStringForKas() const;
162 
165  void applyPolicy(VirtruPolicyObject& policyObject) const;
166 
167  private: // Not supported yet
169  void enableOneClick();
170 
172  void disableOneClick();
173 
174  private:
175  friend Client;
177 
178  struct Impl;
179  std::unique_ptr<Impl> m_impl;
180  };
181 }
182 
183 #endif //VIRTRU_TDF3_SDK_VIRTRU_POLICY_H
std::string toString() const
void shareWithUsers(const std::vector< std::string > &users)
Definition: virtru_policy.h:27
std::string getOwner() const
std::string toJsonStringForKas() const
Policy & operator=(const Policy &policy)
Assignment operator.
void removeUsers(const std::vector< std::string > &users)
void enablePersistentProtection()
Turns on persistent protection policy control flag.
Policy()
Constructor.
void enablePrint()
Turns on print policy control flag.
void disablePersistentProtection()
Turns off persistent protection policy control flag.
void enableOneClick()
Turns on one-click flag.
void enableReshare()
Turns on reshare policy control flag.
void expireInDays(unsigned days)
void disablePreventDownload()
Turns off prevent download policy control flag.
void disablePrint()
Turns off print policy control flag.
std::string getExpiration() const
bool isCopyEnabled() const
void enableWatermarking()
Turns on watermarking policy control flag.
std::unique_ptr< Impl > m_impl
Definition: virtru_policy.h:178
void disableWatermarking()
Turns off watermarking policy control flag.
void disableOneClick()
Turns off one-click flag.
void disableCopy()
Turns off copy policy control flag.
void setOwner(const std::string &owner)
void enablePreventDownload()
Turns on prevent download policy control flag.
void expireInMins(unsigned mins)
bool isPrintEnabled() const
bool isPreventDownloadEnabled() const
void applyPolicy(VirtruPolicyObject &policyObject) const
bool isWatermarkingEnabled() const
std::vector< std::string > getSharedUsers() const
void enableCopy()
Turns on copy policy control flag.
friend Client
Definition: virtru_policy.h:175
~Policy()
Destructor.
void addExpiration(const std::string &expirationDate)
bool isReshareEnabled() const
friend VirtruPolicyObject
Definition: virtru_policy.h:176
void disableReshare()
Turns off reshare policy control flag.
bool isPersistentProtectionEnabled() const
void removeExpiration()
Remove the expiration.