PECengine/ListLibrary2/AuthSrc/CPEngAuthorizationRequest.h
branchRCL_3
changeset 17 a941bc465d9f
parent 0 094583676ce7
equal deleted inserted replaced
16:6ca72c0fe49a 17:a941bc465d9f
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Container of the one reactive authorization request
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __CPENGAUTHORIZATIONREQUEST_H__
       
    19 #define __CPENGAUTHORIZATIONREQUEST_H__
       
    20 
       
    21 //  INCLUDES
       
    22 #include "CPEngAuthorizationItem.h"
       
    23 #include "MPEngAuthorizationRequest.h"
       
    24 #include <e32base.h>
       
    25 
       
    26 
       
    27 // FORWARD DECLARATION
       
    28 class MPEngAuthorizationManagerSet;
       
    29 
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33  * Container of the one reactive authorization request
       
    34  *
       
    35  * @lib PEngListLib2
       
    36  * @since 3.0
       
    37  */
       
    38 class CPEngAuthorizationRequest : public CPEngAuthorizationItem,
       
    39             public MPEngAuthorizationRequest
       
    40     {
       
    41     public:  // Constructors and destructor
       
    42 
       
    43         /**
       
    44          * Two-phased constructor,
       
    45          */
       
    46         static CPEngAuthorizationRequest* NewLC( const TDesC& aUserId,
       
    47                                                  TInt& aSize );
       
    48 
       
    49         /**
       
    50          * Two-phased constructor, constructs class from the Stream
       
    51          */
       
    52         static CPEngAuthorizationRequest* NewLC( RReadStream& aStream,
       
    53                                                  TInt& aSize );
       
    54 
       
    55         /**
       
    56          * Destructor.
       
    57          */
       
    58         virtual ~CPEngAuthorizationRequest();
       
    59 
       
    60 
       
    61     public: // From CPEngAuthorizationItem
       
    62 
       
    63         /**
       
    64          * Update local flag.
       
    65          * @see <CPEngAuthorizationItem.h>
       
    66          */
       
    67         void DoUpdateLocalFlags( const CPEngAuthorizationItem& aSource );
       
    68 
       
    69 
       
    70 
       
    71     public: // From MPEngAuthorizationRequest
       
    72 
       
    73         /**
       
    74          * User id of the user who requested authorization
       
    75          * @see <MPEngAuthorizationRequest.h>
       
    76          */
       
    77         const TDesC& UserId() const;
       
    78 
       
    79 
       
    80         /**
       
    81          * List of request attributes
       
    82          * @see <MPEngAuthorizationRequest.h>
       
    83          */
       
    84         const RArray<TUint32>& RequestedAttributes() const;
       
    85 
       
    86 
       
    87         /**
       
    88          * State of the authorization
       
    89          * @see <MPEngAuthorizationRequest.h>
       
    90          */
       
    91         MPEngAuthorizationRequest::TPEngAuthorizationRequestState AuthorizationState() const;
       
    92 
       
    93 
       
    94         /**
       
    95          * State of the authorization response
       
    96          * @see <MPEngAuthorizationRequest.h>
       
    97          */
       
    98         MPEngAuthorizationRequest::TPEngAuthorizationResponseType AuthorizationResponse() const;
       
    99 
       
   100 
       
   101         /**
       
   102          * List of authorized attributes
       
   103          * @see <MPEngAuthorizationRequest.h>
       
   104          */
       
   105         const RArray<TUint32>& AuthorizedAttributes() const;
       
   106 
       
   107 
       
   108         /**
       
   109          * Set authorization response
       
   110          * @see <MPEngAuthorizationRequest.h>
       
   111          */
       
   112         void SetAuthorizedAttributesL( TArray<TUint32>& aAttributes,
       
   113                                        TBool aKeepOldAuthorization = ETrue );
       
   114 
       
   115         void DenyAuthorizationL();
       
   116 
       
   117         void CancelAuthorizationL();
       
   118 
       
   119 
       
   120 
       
   121         /**
       
   122          * Removes buffered authorization response
       
   123          * @see <MPEngAuthorizationRequest.h>
       
   124          */
       
   125         void RemoveAuthorizationResponse();
       
   126 
       
   127 
       
   128         /**
       
   129          * Extension interface.
       
   130          * @see <MPEngAuthorizationRequest.h>
       
   131          */
       
   132         MPEngAuthorizationRequestExt* Extension() {
       
   133             return NULL;
       
   134             };
       
   135         const MPEngAuthorizationRequestExt* Extension() const {
       
   136             return NULL;
       
   137             };
       
   138 
       
   139 
       
   140 
       
   141     public: // Authorization update
       
   142 
       
   143         /**
       
   144          * Set Authorization manager pointer
       
   145          *
       
   146          * @since 3.0
       
   147          * @param aAuthManager authorization manager
       
   148          */
       
   149         void SetAuthorizationManager( MPEngAuthorizationManagerSet* aAuthManager );
       
   150 
       
   151 
       
   152         /**
       
   153          * Update authorization state
       
   154          *
       
   155          * @since 3.0
       
   156          * @param aState new state of authorization request
       
   157          */
       
   158         void SetAuthState( TPEngAuthorizationRequestState aState );
       
   159 
       
   160 
       
   161         /**
       
   162          * Update authorization response
       
   163          *
       
   164          * @since 3.0
       
   165          * @param aResponse new response of authorization request
       
   166          */
       
   167         void SetAuthResponse( TPEngAuthorizationResponseType aResponse );
       
   168 
       
   169         /**
       
   170          * Update authorized Attributes
       
   171          *
       
   172          * @since 3.0
       
   173          * @param aAuthorizedAttr authorized attributes
       
   174          */
       
   175         void UpdateAuthorizedAttributesL( const RArray<TUint32>& aAuthorizedAttr );
       
   176 
       
   177 
       
   178         /**
       
   179          * Set requested attributes for authorization
       
   180          *
       
   181          * @since 3.0
       
   182          * @param aRequestedAttr
       
   183          */
       
   184         void UpdateRequestedAttributesL( const RArray<TUint32>& aRequestedAttr );
       
   185 
       
   186 
       
   187         /**
       
   188          * Add Attribute to the requested attributes
       
   189          *
       
   190          * @since 3.0
       
   191          * @param aAttribute attribute to add to requested attributes
       
   192          */
       
   193         void AddRequestedAttributeL( TUint32 aAttribute );
       
   194 
       
   195 
       
   196         /**
       
   197          * Externalize to the given stream
       
   198          * @since 3.0
       
   199          * @param aStream write stream
       
   200          */
       
   201         void ExternalizeL( RWriteStream& aStream ) const ;
       
   202 
       
   203 
       
   204         /**
       
   205          * Internalize from the given stream
       
   206          * @since 3.0
       
   207          * @param aStream read stream
       
   208          */
       
   209         void InternalizeL( RReadStream& aStream );
       
   210 
       
   211 
       
   212 
       
   213         /**
       
   214          * Compare function toe use with RPointerArray.
       
   215          *
       
   216          * Two instances are compared based on the TDesC.CompareF function
       
   217          * of the requesting Id
       
   218          *
       
   219          * @since 3.0
       
   220          * @param aFirst fist class for comparison
       
   221          * @param aSecond second class for comparison
       
   222          * @return -1 if fist is smaller,
       
   223          *         +1 is second is smaller,
       
   224          *         0 if they are same
       
   225          */
       
   226         static TInt Compare( const CPEngAuthorizationRequest& aFirst,
       
   227                              const CPEngAuthorizationRequest& aSecond );
       
   228 
       
   229 
       
   230     private: // constructors
       
   231 
       
   232         /**
       
   233          * C++ constructor.
       
   234          */
       
   235         CPEngAuthorizationRequest( TInt& aSize );
       
   236 
       
   237         /**
       
   238          * Symbian constructor
       
   239          */
       
   240         void ConstructL( const TDesC& aUserId );
       
   241 
       
   242 
       
   243     private:    // Data
       
   244 
       
   245         /// OWN: State of authorization
       
   246         TPEngAuthorizationRequestState      iState;
       
   247 
       
   248         /// OWN: Authorization response type
       
   249         TPEngAuthorizationResponseType      iResponseType;
       
   250 
       
   251         /// OWN: Request Attributes
       
   252         RArray<TUint32>                     iRequestedAttr;
       
   253 
       
   254         /// OWN: Authorized Attributes
       
   255         RArray<TUint32>                     iAuthorizedAttr;
       
   256 
       
   257         /// REF: Authorization manager
       
   258         MPEngAuthorizationManagerSet*       iAuthManager;
       
   259     };
       
   260 
       
   261 #endif      // __CPENGAUTHORIZATIONREQUEST_H__
       
   262 
       
   263 // End of File
       
   264