1 /*
2  * Copyright (c) 2021-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 /**
17  * @addtogroup AccessToken
18  * @{
19  *
20  * @brief Provides permission management interfaces.
21  *
22  * Provides tokenID-based application permission verification mechanism.
23  * When an application accesses sensitive data or APIs, this module can check
24  * whether the application has the corresponding permission. Allows applications
25  * to query their access token information or APL levcels based on token IDs.
26  *
27  * @since 7.0
28  * @version 7.0
29  */
30 
31 /**
32  * @file permission_def.h
33  *
34  * @brief Declares permission definition.
35  *
36  * @since 7.0
37  * @version 7.0
38  */
39 
40 #ifndef INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_DEF_H
41 #define INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_DEF_H
42 
43 #include <string>
44 
45 #include "access_token.h"
46 
47 namespace OHOS {
48 namespace Security {
49 namespace AccessToken {
50 /**
51  * @brief Declares permission definition class
52  */
53 class PermissionDef final {
54 public:
55     /** permission name */
56     std::string permissionName;
57     /** bundle name */
58     std::string bundleName = "";
59     /**
60      * grant mode, for details about the valid values,
61      * see the definition of GrantMode in the access_token.h file.
62      */
63     int grantMode;
64     /** which SDK version can use this permission to develop app */
65     ATokenAplEnum availableLevel;
66     /** indicats whether this permission can be access control list permission */
67     bool provisionEnable;
68     /**
69      * indicates whether the distributed scene can use this permission or not
70      */
71     bool distributedSceneEnable;
72     std::string label = "";
73     int labelId = 0;
74     std::string description = "";
75     int descriptionId = 0;
76     ATokenAvailableTypeEnum availableType = NORMAL;
77 };
78 
79 /**
80  * @brief Declares permission definition data class
81  */
82 class PermissionDefData final {
83 public:
84     AccessTokenID tokenId;
85     PermissionDef permDef;
86 };
87 } // namespace AccessToken
88 } // namespace Security
89 } // namespace OHOS
90 
91 #endif // INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_DEF_H
92