Microsoft Information Protection SDK - C++ 1.17
API Reference Documentation for 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 */
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
49public:
54 UNKNOWN = 0,
55 INTERNAL = 1,
56 USER = 2,
57 GROUP = 3
58 };
59
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
78
84 const std::string& GetEmail() const { return mEmail; };
85
91 const std::string& GetObjectId() const { return mObjectId; };
92
98 const std::string& GetPuid() const { return mPuid; };
99
100private:
102 std::string mEmail;
103 std::string mObjectId;
104 std::string mPuid;
105};
106
111public:
118 DirectoryObjectRights(const DirectoryObject& directoryObject, const std::vector<std::string>& rights)
119 : mDirectoryObject(directoryObject), mRights(rights){};
120
127
133 const std::vector<std::string>& GetRights() const { return mRights; };
134
135private:
137 std::vector<std::string> mRights;
138};
139
144public:
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
163
169 const std::vector<DirectoryObjectRights>& GetDirectoryObjectsRights() const { return mDirectoryObjectsRights; };
170
176 bool DoesContentExpire() { return mContentValidUntil.time_since_epoch().count() != 0; };
177
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.
Definition license_rights_data.h:110
DirectoryObject mDirectoryObject
Definition license_rights_data.h:136
const std::vector< std::string > & GetRights() const
Gets rights associated with the directory object.
Definition license_rights_data.h:133
std::vector< std::string > mRights
Definition license_rights_data.h:137
const DirectoryObject & GetDirectoryObject() const
Gets directory object.
Definition license_rights_data.h:126
DirectoryObjectRights(const DirectoryObject &directoryObject, const std::vector< std::string > &rights)
DirectoryObjectRights constructor.
Definition license_rights_data.h:118
The directory object information which includes- type, email, objectId and PUID.
Definition license_rights_data.h:48
const std::string & GetPuid() const
Gets GUID of directory object.
Definition license_rights_data.h:98
std::string mEmail
Definition license_rights_data.h:102
std::string mObjectId
Definition license_rights_data.h:103
DirectoryObjectType GetDirectoryObjectType() const
Gets type of directory object.
Definition license_rights_data.h:77
DirectoryObjectType
Describes the type of directory object.
Definition license_rights_data.h:53
DirectoryObject(const DirectoryObjectType type, const std::string &email, const std::string &objectId, const std::string &puid)
DirectoryObject constructor.
Definition license_rights_data.h:68
const std::string & GetObjectId() const
Gets object ID of directory object.
Definition license_rights_data.h:91
std::string mPuid
Definition license_rights_data.h:104
const std::string & GetEmail() const
Gets email address of directory object.
Definition license_rights_data.h:84
DirectoryObjectType mType
Definition license_rights_data.h:101
The rights related information of the publishing license.
Definition license_rights_data.h:143
LicenseRightsData(const ProtectionType type, const std::vector< DirectoryObjectRights > &directoryObjectsRights, const std::chrono::time_point< std::chrono::system_clock > &contentValidUntil)
LicenseRightsData constructor.
Definition license_rights_data.h:152
std::chrono::time_point< std::chrono::system_clock > mContentValidUntil
Definition license_rights_data.h:188
ProtectionType mType
Definition license_rights_data.h:186
ProtectionType GetProtectionType() const
Gets type of protection, whether it originated from protection SDK template or not.
Definition license_rights_data.h:162
bool DoesContentExpire()
Checks if content has an expiration time or not.
Definition license_rights_data.h:176
const std::chrono::time_point< std::chrono::system_clock > GetContentValidUntil() const
Gets protection expiration time.
Definition license_rights_data.h:183
std::vector< DirectoryObjectRights > mDirectoryObjectsRights
Definition license_rights_data.h:187
const std::vector< DirectoryObjectRights > & GetDirectoryObjectsRights() const
Gets the set of directory objects and the rights associated with them.
Definition license_rights_data.h:169
MIP namespace macros.
Definition rights.h:43
Defines ProtectionDescriptor interface.
ProtectionType
Describes whether protection is based off a template or ad-hoc (custom)
Definition protection_descriptor.h:51