Modifty getting method of undefined privilege description
[platform/framework/native/appfw.git] / src / security / inc / FSec_PrivilegeInfoImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FSec_PrivilegeInfoImpl.h
20  * @brief       This is the header file for the _PrivilegeInfoImpl class.
21  */
22
23 #ifndef _FSEC_INTERNAL_PRIVILEGE_INFO_IMPL_H_
24 #define _FSEC_INTERNAL_PRIVILEGE_INFO_IMPL_H_
25
26
27 #include <FBaseObject.h>
28 #include <FBaseString.h>
29 #include <FOspConfig.h>
30 #include <FBaseInternalTypes.h>
31
32 namespace Tizen { namespace Io
33 {
34 class Database;
35 class DbStatement;
36 class DbEnumerator;
37 }}
38
39 namespace Tizen { namespace Security
40 {
41
42 class PrivilegeInfo;
43
44 static const int MAX_DATABASE_RETRY_COUNT = 30;
45 static const wchar_t PRIVILEGE_DESCRIPTION_DATABASE_FILE_NAME[] = L"/usr/share/osp/.privilege-description.db";
46 static const wchar_t EXTERNAL_PRIVILEGE_DATABASE_FILE_NAME[] = L"/opt/dbspace/.privilegelist.db";
47
48 class _OSP_EXPORT_ _PrivilegeInfoImpl
49         : public Tizen::Base::Object
50 {
51 public:
52         Tizen::Base::String GetDescription(const Tizen::Base::String& privilege) const;
53         Tizen::Base::String GetName(const Tizen::Base::String& privilege) const;
54
55         static _PrivilegeInfoImpl* GetInstance(void);
56
57         _PrivilegeInfoImpl(void);
58         virtual ~_PrivilegeInfoImpl(void);
59         result Construct(void);
60         result Construct(const Tizen::Base::String& privilegeId);
61         Tizen::Base::String GetId(void) const;
62         Tizen::Base::String GetDisplayName(void) const;
63         Tizen::Base::String GetDescription(void) const;
64
65 private:
66
67         Tizen::Io::Database* __pDb;
68
69         static _PrivilegeInfoImpl* __pPrivilegeInfoImplInstance;
70
71         result CheckDatabase(void);
72         static void InitInstance(void);
73
74         bool CheckExternalPrivilege(const Tizen::Base::String& privilegeId);
75
76         static Tizen::Io::DbStatement* CreateStatementN(Tizen::Io::Database& db, const Tizen::Base::String& query);
77         static Tizen::Io::DbEnumerator* ExecuteStatementN(Tizen::Io::Database& db, const Tizen::Io::DbStatement* pStmt);
78
79         friend class PrivilegeInfo;
80
81 private:
82         Tizen::Base::String __privilegeId;
83
84
85 }; // _PrivilegeInfoImpl
86
87 } } // Tizen::Security
88
89 #endif // _FSEC_INTERNAL_PRIVILEGE_INFO_IMPL_H_