1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef DATASHARESERVICE_CONTEXT_H 17 #define DATASHARESERVICE_CONTEXT_H 18 19 #include <list> 20 #include <memory> 21 #include <string> 22 #include <vector> 23 24 #include "bundle_mgr_proxy.h" 25 26 namespace OHOS::DataShare { 27 enum AccessSystemMode : uint8_t { 28 UNDEFINED, 29 USER_SHARED_MODE, 30 USER_SINGLE_MODE, 31 MAX, 32 }; 33 class Context { 34 public: Context()35 explicit Context() {} Context(const std::string & uri)36 explicit Context(const std::string &uri) : uri(uri) {} 37 virtual ~Context() = default; 38 std::string uri; 39 int32_t currentUserId = -1; 40 int32_t appIndex = 0; 41 int32_t haMode = 0; 42 std::string permission; 43 uint32_t callerTokenId = 0; 44 uint32_t calledTokenId = 0; 45 std::string callerBundleName; 46 std::string calledBundleName; 47 std::string calledModuleName; 48 std::string calledStoreName; 49 std::string calledTableName; 50 std::string calledSourceDir; // the dir of db 51 std::string secretMetaKey; 52 int version = -1; 53 int errCode = -1; 54 bool isRead = false; 55 bool isAllowCrossPer = false; // can cross permission check, for special SA 56 bool needAutoLoadCallerBundleName = false; 57 bool isEncryptDb = false; 58 AccessSystemMode accessSystemMode = AccessSystemMode::UNDEFINED; 59 BundleConfig bundleInfo; 60 std::string type = "rdb"; 61 }; 62 } // namespace OHOS::DataShare 63 #endif // DATASHARESERVICE_CONTEXT_H 64