• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 PERMISSION_UTIL_H
17 #define PERMISSION_UTIL_H
18 
19 #include <string>
20 
21 namespace OHOS {
22 namespace Telephony {
23 namespace Permission {
24 /**
25  * This permission indicates being allowed to set state of telephony.
26  */
27 static constexpr const char *SET_TELEPHONY_STATE = "ohos.permission.SET_TELEPHONY_STATE";
28 /**
29  * This permission indicates being allowed to get state of telephony.
30  */
31 static constexpr const char *GET_TELEPHONY_STATE = "ohos.permission.GET_TELEPHONY_STATE";
32 /**
33  * This permission indicates being allowed to read messages.
34  */
35 static constexpr const char *READ_MESSAGES = "ohos.permission.READ_MESSAGES";
36 } // namespace Permission
37 
38 class PermissionUtil {
39 public:
40     /**
41      * @brief Permission check by callingUid.
42      *
43      * @param permissionName permission name.
44      * @return Return {@code true} on success, {@code false} on failure.
45      */
46     static bool CheckPermission(const std::string &permissionName);
47 };
48 } // namespace Telephony
49 } // namespace OHOS
50 #endif // PERMISSION_UTIL_H
51