1 /* 2 * Copyright (c) 2022 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 SERVICES_EDM_INCLUDE_ADMIN_H 17 #define SERVICES_EDM_INCLUDE_ADMIN_H 18 19 #include <string> 20 #include <vector> 21 22 #include "ability_info.h" 23 #include "admin_type.h" 24 #include "edm_errors.h" 25 #include "ent_info.h" 26 #include "managed_event.h" 27 #include "running_mode.h" 28 #include "parcel_macro.h" 29 30 namespace OHOS { 31 namespace EDM { 32 struct AdminInfo { 33 std::string packageName_; 34 std::string className_; 35 EntInfo entInfo_; 36 std::vector<std::string> permission_; 37 std::vector<ManagedEvent> managedEvents_; 38 std::string parentAdminName_; 39 std::vector<std::string> accessiblePolicies_; 40 AdminType adminType_ = AdminType::UNKNOWN; 41 bool isDebug_ = false; 42 RunningMode runningMode_ = RunningMode::DEFAULT; 43 }; 44 45 class Admin { 46 public: 47 Admin() = default; 48 Admin(const Admin& other); 49 Admin& operator=(const Admin& other); 50 Admin(const AppExecFwk::ExtensionAbilityInfo &abilityInfo, AdminType type, const EntInfo &entInfo, 51 const std::vector<std::string> &permissions, bool isDebug); 52 Admin(const std::string &bundleName, AdminType type, const std::vector<std::string> &permissions); 53 void SetParentAdminName(const std::string &parentAdminName); 54 void SetAccessiblePolicies(const std::vector<std::string> &accessiblePolicies); 55 virtual bool CheckPermission(const std::string &permission); 56 virtual AdminType GetAdminType() const; 57 virtual std::string GetParentAdminName() const; 58 virtual ~Admin() = default; 59 AdminInfo adminInfo_; 60 }; 61 } // namespace EDM 62 } // namespace OHOS 63 64 #endif // SERVICES_EDM_INCLUDE_ADMIN_H 65