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 std::string permission; 41 uint32_t callerTokenId = 0; 42 std::string callerBundleName; 43 std::string calledBundleName; 44 std::string calledModuleName; 45 std::string calledStoreName; 46 std::string calledTableName; 47 std::string calledSourceDir; // the dir of db 48 std::string secretMetaKey; 49 int version = -1; 50 int errCode = -1; 51 bool isRead = false; 52 bool isAllowCrossPer = false; // can cross permission check, for special SA 53 bool needAutoLoadCallerBundleName = false; 54 bool isEncryptDb = false; 55 AccessSystemMode accessSystemMode = AccessSystemMode::UNDEFINED; 56 BundleConfig bundleInfo; 57 std::string type = "rdb"; 58 }; 59 } // namespace OHOS::DataShare 60 #endif // DATASHARESERVICE_CONTEXT_H 61