• 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 /**
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_state_change_info.h
33  *
34  * @brief Declares PermStateChangeInfo and PermStateChangeScope struct.
35  *
36  * @since 7.0
37  * @version 7.0
38  */
39 
40 #ifndef INTERFACES_INNER_KITS_PERMISSION_STATE_CHANGE_INFO_H
41 #define INTERFACES_INNER_KITS_PERMISSION_STATE_CHANGE_INFO_H
42 
43 #include <string>
44 #include <vector>
45 
46 #include "access_token.h"
47 
48 namespace OHOS {
49 namespace Security {
50 namespace AccessToken {
51 /** define tokenID list max size */
52 #define TOKENIDS_LIST_SIZE_MAX 1024
53 /** define permission list max size */
54 #define PERMS_LIST_SIZE_MAX 1024
55 
56 /**
57  * @brief Declares permission state change info struct
58  */
59 struct PermStateChangeInfo {
60     /**
61      * permission state change type, for details about the valid values,
62      * see the definition of ActiveChangeType in the active_change_response_info.h file.
63      */
64     int32_t permStateChangeType;
65     AccessTokenID tokenID;
66     std::string permissionName;
67 };
68 
69 /**
70  * @brief Declares permission state change scope struct
71  */
72 struct PermStateChangeScope {
73     /**
74      * indicates which tokenID to listen the permission state change,
75      * empty means listen all tokenIDs in the device
76      */
77     std::vector<AccessTokenID> tokenIDs;
78     /**
79      * indicates which permission to listen the state change,
80      * empty means listen all permission state changes in the device
81      */
82     std::vector<std::string> permList;
83 };
84 } // namespace AccessToken
85 } // namespace Security
86 } // namespace OHOS
87 
88 #endif // INTERFACES_INNER_KITS_PERMISSION_STATE_CHANGE_INFO_H
89