1 /*
2  * Copyright (C) 2021-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 OHOS_MEDIALIBRARY_DEVICE_PERMISSION_VERIFICATION_H
17 #define OHOS_MEDIALIBRARY_DEVICE_PERMISSION_VERIFICATION_H
18 
19 #include <string>
20 #include <string>
21 #include "device_security_defines.h"
22 #include "device_security_info.h"
23 
24 namespace OHOS {
25 namespace Media {
26 struct TrustedRelationshipGroupInfo {
27     std::string groupName;
28     std::string groupId;
29     std::string groupOwner;
30     int32_t groupType;
TrustedRelationshipGroupInfoTrustedRelationshipGroupInfo31     TrustedRelationshipGroupInfo() : groupType(0) {}
TrustedRelationshipGroupInfoTrustedRelationshipGroupInfo32     TrustedRelationshipGroupInfo(std::string name, std::string id, std::string owner, int32_t type)
33         : groupName(name), groupId(id), groupOwner(owner), groupType(type)
34     {
35     }
36 };
37 
38 class DevicePermissionVerification final {
39 public:
40     DevicePermissionVerification() = delete;
41     ~DevicePermissionVerification() = delete;
42     DevicePermissionVerification(const DevicePermissionVerification&) = delete;
43     DevicePermissionVerification(DevicePermissionVerification&&) = delete;
44     DevicePermissionVerification& operator=(const DevicePermissionVerification&) = delete;
45     DevicePermissionVerification& operator=(DevicePermissionVerification&&) = delete;
46 
47     static bool CheckPermission(const std::string &udid);
48     static void MLDevSecInfoCb(const DeviceIdentify *identify, struct DeviceSecurityInfo *info);
49     static bool ReqDestDevSecLevel(const std::string &udid);
50 private:
51     static bool QueryTrustedRelationship(const std::string &udid);
52     static bool CheckIsSameAccount();
53 };
54 } // namespace Media
55 } // namespace OHOS
56 #endif // OHOS_MEDIALIBRARY_DEVICE_PERMISSION_VERIFICATION_H
57