Microsoft Information Protection (MIP) SDK for C++: Reference 1.16
Doxygen-generated documentation for MIP SDK written in C++
Loading...
Searching...
No Matches
license_rights_data.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) Microsoft Corporation.
4 * All rights reserved.
5 *
6 * This code is licensed under the MIT License.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files(the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions :
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 *
26 */
27/**
28 * @brief Defines LicenseRightstData interface
29 *
30 * @file license_rights_data.h
31 */
32
33#ifndef API_MIP_PROTECTION_LICENSE_RIGHTS_DATA_H_
34#define API_MIP_PROTECTION_LICENSE_RIGHTS_DATA_H_
35
36#include <chrono>
37#include <string>
38#include <vector>
39
40#include "mip/mip_namespace.h"
42
43MIP_NAMESPACE_BEGIN
44
45/**
46 * @brief The directory object information which includes- type, email, objectId and PUID
47 */
49public:
50 /**
51 * @brief Describes the type of directory object
52 */
54 UNKNOWN = 0,
55 INTERNAL = 1, /**< Internal user - ANYONE */
56 USER = 2, /**< individual user */
57 GROUP = 3 /**< group object */
58 };
59
60 /**
61 * @brief DirectoryObject constructor
62 *
63 * @param type The type of directory object
64 * @param email The email of directory object
65 * @param objectId The object ID of directory object
66 * @param puid The PUID of directory object
67 */
69 const DirectoryObjectType type, const std::string& email, const std::string& objectId, const std::string& puid)
70 : mType(type), mEmail(email), mObjectId(objectId), mPuid(puid){};
71
72 /**
73 * @brief Gets type of directory object
74 *
75 * @return Type of directory object
76 */
78
79 /**
80 * @brief Gets email address of directory object
81 *
82 * @return Email address of directory object
83 */
84 const std::string& GetEmail() const { return mEmail; };
85
86 /**
87 * @brief Gets object ID of directory object
88 *
89 * @return object ID of directory object
90 */
91 const std::string& GetObjectId() const { return mObjectId; };
92
93 /**
94 * @brief Gets GUID of directory object
95 *
96 * @return GUID of directory object
97 */
98 const std::string& GetPuid() const { return mPuid; };
99
100private:
102 std::string mEmail;
103 std::string mObjectId;
104 std::string mPuid;
105};
106
107/**
108 * @brief The directory object and rights associated with it
109 */
111public:
112 /**
113 * @brief DirectoryObjectRights constructor
114 *
115 * @param directoryObject The directory object
116 * @param rights Rights associated with the directory object
117 */
118 DirectoryObjectRights(const DirectoryObject& directoryObject, const std::vector<std::string>& rights)
119 : mDirectoryObject(directoryObject), mRights(rights){};
120
121 /**
122 * @brief Gets directory object
123 *
124 * @return The directory object
125 */
127
128 /**
129 * @brief Gets rights associated with the directory object
130 *
131 * @return Rights associated with the directory object
132 */
133 const std::vector<std::string>& GetRights() const { return mRights; };
134
135private:
137 std::vector<std::string> mRights;
138};
139
140/**
141 * @brief The rights related information of the publishing license
142 */
144public:
145 /**
146 * @brief LicenseRightsData constructor
147 *
148 * @param type The type of protection, whether it originated from protection SDK template or not
149 * @param directoryObjectsRights The set of directory objects and the rights associated with them
150 * @param contentValidUtil Protection expiration time
151 */
153 const std::vector<DirectoryObjectRights>& directoryObjectsRights,
154 const std::chrono::time_point<std::chrono::system_clock>& contentValidUntil)
155 : mType(type), mDirectoryObjectsRights(directoryObjectsRights), mContentValidUntil(contentValidUntil){};
156
157 /**
158 * @brief Gets type of protection, whether it originated from protection SDK template or not
159 *
160 * @return Type of protection
161 */
163
164 /**
165 * @brief Gets the set of directory objects and the rights associated with them
166 *
167 * @return The set of directory objects and the rights associated with them
168 */
169 const std::vector<DirectoryObjectRights>& GetDirectoryObjectsRights() const { return mDirectoryObjectsRights; };
170
171 /**
172 * @brief Checks if content has an expiration time or not
173 *
174 * @return True if content can expire, else false
175 */
176 bool DoesContentExpire() { return mContentValidUntil.time_since_epoch().count() != 0; };
177
178 /**
179 * @brief Gets protection expiration time
180 *
181 * @return Protection expiration time
182 */
183 const std::chrono::time_point<std::chrono::system_clock> GetContentValidUntil() const { return mContentValidUntil; };
184
185private:
187 std::vector<DirectoryObjectRights> mDirectoryObjectsRights;
188 std::chrono::time_point<std::chrono::system_clock> mContentValidUntil;
189};
190
191MIP_NAMESPACE_END
192
193#endif //API_MIP_PROTECTION_LICENSE_RIGHTS_DATA_H_
The directory object and rights associated with it.
DirectoryObject mDirectoryObject
const std::vector< std::string > & GetRights() const
Gets rights associated with the directory object.
std::vector< std::string > mRights
const DirectoryObject & GetDirectoryObject() const
Gets directory object.
DirectoryObjectRights(const DirectoryObject &directoryObject, const std::vector< std::string > &rights)
DirectoryObjectRights constructor.
The directory object information which includes- type, email, objectId and PUID.
const std::string & GetPuid() const
Gets GUID of directory object.
DirectoryObjectType GetDirectoryObjectType() const
Gets type of directory object.
DirectoryObjectType
Describes the type of directory object.
DirectoryObject(const DirectoryObjectType type, const std::string &email, const std::string &objectId, const std::string &puid)
DirectoryObject constructor.
const std::string & GetObjectId() const
Gets object ID of directory object.
const std::string & GetEmail() const
Gets email address of directory object.
DirectoryObjectType mType
The rights related information of the publishing license.
LicenseRightsData(const ProtectionType type, const std::vector< DirectoryObjectRights > &directoryObjectsRights, const std::chrono::time_point< std::chrono::system_clock > &contentValidUntil)
LicenseRightsData constructor.
std::chrono::time_point< std::chrono::system_clock > mContentValidUntil
ProtectionType GetProtectionType() const
Gets type of protection, whether it originated from protection SDK template or not.
bool DoesContentExpire()
Checks if content has an expiration time or not.
const std::chrono::time_point< std::chrono::system_clock > GetContentValidUntil() const
Gets protection expiration time.
std::vector< DirectoryObjectRights > mDirectoryObjectsRights
const std::vector< DirectoryObjectRights > & GetDirectoryObjectsRights() const
Gets the set of directory objects and the rights associated with them.
MIP namespace macros.
Defines ProtectionDescriptor interface.
ProtectionType
Describes whether protection is based off a template or ad-hoc (custom)