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 "parcel_macro.h" 28 29 namespace OHOS { 30 namespace EDM { 31 struct AdminInfo { 32 std::string packageName_; 33 std::string className_; 34 EntInfo entInfo_; 35 std::vector<std::string> permission_; 36 std::vector<ManagedEvent> managedEvents_; 37 std::string parentAdminName_; 38 std::vector<std::string> accessiblePolicies_; 39 AdminType adminType_ = AdminType::UNKNOWN; 40 bool isDebug_ = false; 41 }; 42 43 class Admin { 44 public: 45 Admin() = default; 46 Admin(const AppExecFwk::ExtensionAbilityInfo &abilityInfo, AdminType type, const EntInfo &entInfo, 47 const std::vector<std::string> &permissions, bool isDebug); 48 Admin(const std::string &bundleName, AdminType type, const std::vector<std::string> &permissions); 49 void SetParentAdminName(const std::string &parentAdminName); 50 void SetAccessiblePolicies(const std::vector<std::string> &accessiblePolicies); 51 virtual bool CheckPermission(const std::string &permission); 52 virtual AdminType GetAdminType() const; 53 virtual std::string GetParentAdminName() const; 54 virtual ~Admin() = default; 55 AdminInfo adminInfo_; 56 }; 57 } // namespace EDM 58 } // namespace OHOS 59 60 #endif // SERVICES_EDM_INCLUDE_ADMIN_H 61