|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Reactive authorization request interface. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __MPENGAUTHORIZATIONREQUEST_H |
|
19 #define __MPENGAUTHORIZATIONREQUEST_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <E32Std.h> |
|
23 |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class MPEngAuthorizationRequestExt; |
|
27 |
|
28 |
|
29 // CLASS DECLARATION |
|
30 /** |
|
31 * Interface for reactive authorization request. |
|
32 * |
|
33 * @since 3.0 |
|
34 */ |
|
35 class MPEngAuthorizationRequest |
|
36 { |
|
37 public: // Authorization Request State |
|
38 |
|
39 /** |
|
40 * Reactive authorization request state. |
|
41 * |
|
42 * @since 3.0 |
|
43 */ |
|
44 enum TPEngAuthorizationRequestState |
|
45 { |
|
46 // Authorization request is waiting for answer |
|
47 EPEngAuthPending = 0x00001, |
|
48 |
|
49 // Authorization request was already answered |
|
50 EPEngAuthAnswered = 0x00002 |
|
51 }; |
|
52 |
|
53 |
|
54 /** |
|
55 * Reactive authorization responses. |
|
56 * |
|
57 * @since 3.0 |
|
58 */ |
|
59 enum TPEngAuthorizationResponseType |
|
60 { |
|
61 //Authorization isn't yet responded |
|
62 EPEngAuthUndefined = 0x00000, |
|
63 |
|
64 //Authorization was accepted |
|
65 EPEngAuthAccepted = 0x00001, |
|
66 |
|
67 //Authorization was denied |
|
68 EPEngAuthDenied = 0x00002, |
|
69 |
|
70 //Authorization was canceled |
|
71 EPEngAuthCanceled = 0x00003 |
|
72 }; |
|
73 |
|
74 |
|
75 |
|
76 public: // Access to authorization request details |
|
77 |
|
78 /** |
|
79 * Identification of requesting user. |
|
80 * |
|
81 * Gets identification of requesting user. |
|
82 * |
|
83 * @since 3.0 |
|
84 * @return Id of the requesting user. |
|
85 */ |
|
86 virtual const TDesC& UserId() const = 0; |
|
87 |
|
88 |
|
89 /** |
|
90 * List of requested attributes. |
|
91 * |
|
92 * Gets list of requested attributes. |
|
93 * |
|
94 * @since 3.0 |
|
95 * @return Array of requested attributes. |
|
96 */ |
|
97 virtual const RArray<TUint32>& RequestedAttributes() const = 0; |
|
98 |
|
99 |
|
100 /** |
|
101 * State of the authorization request. |
|
102 * |
|
103 * Gets state of the authorization request. |
|
104 * |
|
105 * @since 3.0 |
|
106 * @return State of the authorization request. |
|
107 */ |
|
108 virtual TPEngAuthorizationRequestState AuthorizationState() const = 0; |
|
109 |
|
110 |
|
111 /** |
|
112 * State of the authorization response |
|
113 * |
|
114 * Gets state of the authorization response. |
|
115 * |
|
116 * If authorization response state is EPEngAuthUndefined, |
|
117 * it means that there has not been yet any response to this |
|
118 * authorization request. |
|
119 * |
|
120 * If authorization request was reissued by networ server, |
|
121 * authorization is put again in EPEngAuthPending state, |
|
122 * and response state remains in last authorization response. |
|
123 * |
|
124 * @since 3.0 |
|
125 * @return state of the authorization |
|
126 */ |
|
127 virtual TPEngAuthorizationResponseType AuthorizationResponse() const = 0; |
|
128 |
|
129 |
|
130 /** |
|
131 * List of authorized attributes. |
|
132 * |
|
133 * Gets the list of currently authorized attributes. |
|
134 * |
|
135 * @since 3.0 |
|
136 * @return The list of currently authorized attributes. |
|
137 */ |
|
138 virtual const RArray<TUint32>& AuthorizedAttributes() const = 0; |
|
139 |
|
140 |
|
141 |
|
142 public: //Authorization response handling |
|
143 |
|
144 /** |
|
145 * Authorizes the request with given attribute set. |
|
146 * |
|
147 * Authorizes the request with attribute set. |
|
148 * Pending authorization request can be: |
|
149 * - Authorized with SetAuthorizedAttributesL() |
|
150 * - Denied with DenyAuthorizationL() |
|
151 * |
|
152 * Already responded authorization request can be: |
|
153 * - Reauthorized: SetAuthorizedAttributesL() |
|
154 * New authorization overwrites previous response. |
|
155 * - Canceled: CancelAuthorizationL() |
|
156 * |
|
157 * Prior client can perform response handling operations, |
|
158 * it needs to have open MPEngAuthorizationRespond object. |
|
159 * Individual authorization responses are buffered to |
|
160 * MPEngAuthorizationRespond object from which thay are |
|
161 * published to network at once. |
|
162 * |
|
163 * @since 3.0 |
|
164 * @param aAttributes Attributes to be authorized. |
|
165 * @param aKeepOldAuthorization If ETrue, then |
|
166 * already authorized attributes are kept. |
|
167 * If EFalse, new attribute set overwrites |
|
168 * previous attribute set. |
|
169 */ |
|
170 virtual void SetAuthorizedAttributesL( |
|
171 TArray<TUint32>& aAttributes, |
|
172 TBool aKeepOldAuthorization = ETrue ) = 0; |
|
173 |
|
174 |
|
175 /** |
|
176 * Denies authorization request. |
|
177 * |
|
178 * @since 3.0 |
|
179 * @see SetAuthorizedAttributesL() |
|
180 */ |
|
181 virtual void DenyAuthorizationL() = 0; |
|
182 |
|
183 |
|
184 /** |
|
185 * Cancels existing authorization. |
|
186 * |
|
187 * @since 3.0 |
|
188 * @see SetAuthorizedAttributesL() |
|
189 */ |
|
190 virtual void CancelAuthorizationL() = 0; |
|
191 |
|
192 |
|
193 /** |
|
194 * Undo the authorization response. |
|
195 * |
|
196 * Undo the authorization response. |
|
197 * Removes response from among other |
|
198 * buffered responses. |
|
199 * |
|
200 * @since 3.0 |
|
201 */ |
|
202 virtual void RemoveAuthorizationResponse() = 0; |
|
203 |
|
204 |
|
205 |
|
206 private: //Extensions interfaces |
|
207 |
|
208 /** |
|
209 * Reactive authorization request extension interface. |
|
210 * |
|
211 * @since 3.0 |
|
212 * @return Reactive authorization request extension. |
|
213 */ |
|
214 virtual MPEngAuthorizationRequestExt* Extension() = 0; |
|
215 virtual const MPEngAuthorizationRequestExt* Extension() const = 0; |
|
216 |
|
217 |
|
218 |
|
219 protected: //Destructor |
|
220 |
|
221 /** |
|
222 * Virtual inline destructor. |
|
223 * Protected destructor to prohibits deletion |
|
224 * through the interface. |
|
225 */ |
|
226 virtual ~MPEngAuthorizationRequest() {}; |
|
227 |
|
228 }; |
|
229 #endif // __MPENGAUTHORIZATIONREQUEST_H |
|
230 |
|
231 // End of File |
|
232 |