omadm/omadmextensions/adapters/dcmodmadapter/src/dcmodmadapter.cpp
changeset 4 75a71fdb4c92
parent 3 ecc2fefbdf1d
equal deleted inserted replaced
3:ecc2fefbdf1d 4:75a71fdb4c92
    21 #include <data_caging_path_literals.hrh>
    21 #include <data_caging_path_literals.hrh>
    22 #include <centralrepository.h>
    22 #include <centralrepository.h>
    23 #include <e32base.h>
    23 #include <e32base.h>
    24 #include <ecom.h>
    24 #include <ecom.h>
    25 #include <utf.h>
    25 #include <utf.h>
       
    26 #include <SettingEnforcementInfo.h> // DCMO Enforcement
    26 #include "nsmldebug.h"
    27 #include "nsmldebug.h"
    27 #include "dcmodmadapter.h"
    28 #include "dcmodmadapter.h"
    28 #include "dcmointerface.h"
    29 #include "dcmointerface.h"
    29 
    30 
    30 // CONSTANTS
    31 // CONSTANTS
   272 								        TInt aStatusRef )
   273 								        TInt aStatusRef )
   273     {
   274     {
   274     _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectL - begin"  );
   275     _DBG_FILE( "CDcmoDMAdapter::FetchLeafObjectL - begin"  );
   275     MSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; 
   276     MSmlDmAdapter::TError retValue = CSmlDmAdapter::EOk; 
   276 		TDCMOStatus err (EDcmoFail);
   277 		TDCMOStatus err (EDcmoFail);
       
   278 		
       
   279     TBool dcmoEnforce=EFalse;
       
   280 	  TRAPD(eError, dcmoEnforce =CheckEnforcementL())
       
   281 	  if(!(eError==KErrNone && dcmoEnforce))
       
   282 	  {
       
   283 	  	 // Respond
       
   284 	  	retValue = CSmlDmAdapter::ENotAllowed;
       
   285   		Callback().SetStatusL( aStatusRef, retValue );
       
   286   		return;
       
   287 	  }
       
   288     
   277 		TBuf<MAXBUFLEN> iName;
   289 		TBuf<MAXBUFLEN> iName;
   278 		
   290 		
   279 		TPtrC8 category = GetCategoryFromUriL( aURI );
   291 		TPtrC8 category = GetCategoryFromUriL( aURI );
   280 		iName.Copy ( category );
   292 		iName.Copy ( category );
   281 
   293 
   510 								      TInt aStatusRef )
   522 								      TInt aStatusRef )
   511     {
   523     {
   512     _DBG_FILE( "CDcmoDMAdapter::ExecuteCommandL - begin"  );
   524     _DBG_FILE( "CDcmoDMAdapter::ExecuteCommandL - begin"  );
   513    	MSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
   525    	MSmlDmAdapter::TError status = CSmlDmAdapter::EOk;
   514     TInt err (EDcmoFail);
   526     TInt err (EDcmoFail);
       
   527     
       
   528     TBool dcmoEnforce=EFalse;
       
   529 	  TRAPD(eError, dcmoEnforce =CheckEnforcementL())
       
   530 	  if(!(eError==KErrNone && dcmoEnforce))
       
   531 	  {
       
   532 	  	 // Respond
       
   533 	  	status = CSmlDmAdapter::ENotAllowed;
       
   534   		Callback().SetStatusL( aStatusRef, status );
       
   535   		return;
       
   536 	  }
       
   537 	  
   515 		TBuf<MAXBUFLEN> iName;
   538 		TBuf<MAXBUFLEN> iName;
   516 		TPtrC8 category = GetCategoryFromUriL( aURI );
   539 		TPtrC8 category = GetCategoryFromUriL( aURI );
   517 		iName.Copy ( category );		
   540 		iName.Copy ( category );		
   518 		
   541 		
   519 		if((category.Compare( KNSmlBluetooth ) == KErrNone ) && (aURI.Find( KNSmlDdfOpExtSemiEnable ) != KErrNotFound ))
   542 		if((category.Compare( KNSmlBluetooth ) == KErrNone ) && (aURI.Find( KNSmlDdfOpExtSemiEnable ) != KErrNotFound ))
   884 	return ( aURI.Mid ( flag+1 , count-(flag+1) ));	
   907 	return ( aURI.Mid ( flag+1 , count-(flag+1) ));	
   885 
   908 
   886 
   909 
   887 }
   910 }
   888 
   911 
       
   912 //----------------------------------------------------------------------
       
   913 // TBool CDcmoDMAdapter::CheckEnforcementL()
       
   914 // If DCMO policy is enforced true is returned else false
       
   915 //----------------------------------------------------------------------
       
   916 TBool CDcmoDMAdapter::CheckEnforcementL()
       
   917 {
       
   918     CSettingEnforcementInfo* info = CSettingEnforcementInfo::NewL();
       
   919     CleanupStack::PushL(info);
       
   920     TBool enforceActive ( EFalse );
       
   921     User::LeaveIfError(info->EnforcementActive(EDCMOEnforcement, enforceActive));
       
   922     CleanupStack::PopAndDestroy(info);
       
   923     return enforceActive;
       
   924 }
       
   925     
   889 // End of File  
   926 // End of File