• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 #include "iplugin.h"
17 #include <string_ex.h>
18 
19 namespace OHOS {
20 namespace EDM {
GetPolicyName()21 std::string IPlugin::GetPolicyName()
22 {
23     return policyName_;
24 }
25 
NeedSavePolicy()26 bool IPlugin::NeedSavePolicy()
27 {
28     return needSave_;
29 }
30 
IsGlobalPolicy()31 bool IPlugin::IsGlobalPolicy()
32 {
33     return isGlobal_;
34 }
35 
GetPermission(FuncOperateType operaType)36 std::string IPlugin::GetPermission(FuncOperateType operaType)
37 {
38     if (permission_.empty() && permissionMap_.count(operaType) > 0) {
39         return permissionMap_[operaType].first;
40     }
41     return permission_;
42 }
43 
GetPermissionType(FuncOperateType operaType)44 IPlugin::PermissionType IPlugin::GetPermissionType(FuncOperateType operaType)
45 {
46     if (permissionType_ == PermissionType::UNKNOWN && permissionMap_.count(operaType) > 0) {
47         return permissionMap_[operaType].second;
48     }
49     return permissionType_;
50 }
51 
GetCode()52 std::uint32_t IPlugin::GetCode()
53 {
54     return policyCode_;
55 }
56 
MergePolicyData(const std::string & adminName,std::string & mergeJsonData)57 ErrCode IPlugin::MergePolicyData(const std::string &adminName, std::string &mergeJsonData)
58 {
59     return ERR_OK;
60 }
61 
WritePolicyToParcel(const std::string & policyJsonData,MessageParcel & reply)62 ErrCode IPlugin::WritePolicyToParcel(const std::string &policyJsonData, MessageParcel &reply)
63 {
64     return reply.WriteString(policyJsonData) ? ERR_OK : ERR_EDM_OPERATE_PARCEL;
65 }
66 
~IPlugin()67 IPlugin::~IPlugin() {}
68 } // namespace EDM
69 } // namespace OHOS
70