Merge "Update deprecated libprivilege-control API functions." into tizen
[platform/framework/native/appfw.git] / src / security / FSecAccessController.cpp
index 0249383..fbc43b9 100644 (file)
@@ -28,6 +28,8 @@
 #include <FBaseSysLog.h>
 #include <FBaseString.h>
 #include <FBaseColArrayList.h>
+#include <FBaseColArrayListT.h>
+#include <FBaseColIEnumeratorT.h>
 #include <FIoFile.h>
 #include <FIo_IpcClient.h>
 #include <FSecAccessController.h>
@@ -101,18 +103,32 @@ AccessController::Initialize(void)
        std::unique_ptr<String> pChecksum(new (std::nothrow) String());
        SysTryReturnVoidResult(NID_SEC, pChecksum != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
-       std::unique_ptr<ArrayList> pPrivilegeList(new ArrayList());
-       SysTryReturnVoidResult(NID_SEC, pPrivilegeList != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+       std::unique_ptr< ArrayListT< String > > pPrivilegeListT(new ArrayListT< String >());
+       SysTryReturnVoidResult(NID_SEC, pPrivilegeListT != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
-       pPrivilegeList->Construct();
+       pPrivilegeListT->Construct();
 
-       std::unique_ptr<IPC::Message> pCipherPrivilegeMessage(new (std::nothrow) PrivilegeManagerMsg_retrieve(pEncryptedPrivileges.get(), pChecksum.get(), pPrivilegeList.get(), &r));
+       std::unique_ptr<IPC::Message> pCipherPrivilegeMessage(new (std::nothrow) PrivilegeManagerMsg_retrieve(pEncryptedPrivileges.get(), pChecksum.get(), pPrivilegeListT.get(), &r));
        SysTryReturnVoidResult(NID_SEC, pCipherPrivilegeMessage != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
 
        result ipcResult = pIpcClient->SendRequest(pCipherPrivilegeMessage.get());
        SysTryReturnVoidResult(NID_SEC, ipcResult == E_SUCCESS, E_SYSTEM, "Failed to send IPC message.");
        SysTryReturnVoidResult(NID_SEC, r == E_SUCCESS, r, "Failed to retrieve privilege information");
 
+       std::unique_ptr<ArrayList> pPrivilegeList(new ArrayList());
+       SysTryReturnVoidResult(NID_SEC, pPrivilegeList != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
+
+       pPrivilegeList->Construct();
+
+       std::unique_ptr<IEnumeratorT< String > > pEnum(pPrivilegeListT->GetEnumeratorN());
+       while (pEnum->MoveNext() == E_SUCCESS)
+       {
+               String tempString;
+               pEnum->GetCurrent(tempString);
+               pPrivilegeList->Add(new String(tempString));
+       }
+       pPrivilegeListT->RemoveAll();
+
        std::unique_ptr<String> pEncryptedVisibility(new (std::nothrow) String());
        SysTryReturnVoidResult(NID_SEC, pEncryptedVisibility != null, E_OUT_OF_MEMORY, "The memory is insufficient.");