RMS SDK for C++  0.2.1
A client library for using Microsoft RMS from Linux.
consent.h
1 /*
2  * ======================================================================
3  * Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
4  * Licensed under the MIT License.
5  * See LICENSE.md in the project root for license information.
6  * ======================================================================
7 */
8 
9 #ifndef _RMS_LIB_CONSENT_H_
10 #define _RMS_LIB_CONSENT_H_
11 
12 #include <string>
13 #include <vector>
14 #include "ModernAPIExport.h"
15 
16 namespace rmscore {
17 namespace modernapi {
18 /*
19  * @brief Enumeration for types of consent.
20  */
21 enum ConsentType {
22  /*
23  * @brief User consent for document tracking.
24  */
25  DocumentTrackingConsent = 0,
26 
27  /*
28  * @brief User consent for contacting a service URL.
29  */
30  ServiceUrlConsent = 1
31 };
32 
33 /*
34 * @brief Used for managing the user's consent information.
35 *
36 * In operation, users can accept the consent or reject it.
37 * Users can also choose to show the consent again or not.
38 * You can save a user’s decision about whether to see the consent
39 * prompt again by using the ShowAgain property.
40 */
41 class DLL_PUBLIC_RMS ConsentResult {
42 public:
43 
44  /*
45  * @brief Creates and initializes an instance of a ConsentResult object.
46  * @param accepted True or False; the user accepted
47  * @param showAgain True or false; the consent prompt should be shown to the user again.
48  * @userId The Id of the user; usually represented as an email address.
49  */
50  ConsentResult(bool accepted,
51  bool showAgain,
52  const std::string& userId);
53 
54  /*
55  * @brief Gets the Accepted flag indicating the user has consented or not.
56  */
57  bool Accepted() const {
58  return this->accepted;
59  }
60 
61  /*
62  * @brief Gets the ShowAgain flag indicating whether the user consent prompt should be shown again or not.
63  */
64  bool ShowAgain() const {
65  return this->showAgain;
66  }
67 
68  /*
69  * @brief Gets the email ID of the user giving consent.
70  */
71  const std::string& UserId() const {
72  return this->userId;
73  }
74 
75 private:
76 
77  bool accepted;
78  bool showAgain;
79  const std::string userId;
80 };
81 
82 // TODO: figure out why it's an interface
83 /*
84 * @brief Class for managing consent results.
85 */
86 class DLL_PUBLIC_RMS IConsent {
87 public:
88 
89  /*
90  * @brief Pointer to a ConsentResult object.
91  */
92  ConsentResult *Result;
93  /*
94  * @brief Type of consent.
95  */
96  ConsentType Type;
97 
98  /*
99  * @brief List of urls for consent.
100  */
101  common::UrlArray Urls;
102 
103  /*
104  * @brief The consenting user.
105  */
106  std::string User;
107 
108  /*
109  * @brief Domain information.
110  */
111  std::string Domain;
112 
113  /*
114  * @brief
115  */
116  // BRP072315 - What is this for?
117  IConsent() : Result(nullptr) {}
118 };
119 } // namespace modernapi
120 } // namespace rmscore
121 #endif // _RMS_LIB_CONSENT_H_
Definition: consent.h:41
Definition: AuthenticationCallbackImpl.h:16
Represents a user's consent/refusal to allow usage of a given URL.
Definition: consent.h:86