• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 #include "access_token_helper.h"
17 #include "mock_constant.h"
18 
19 namespace OHOS {
20 namespace EventFwk {
21 using namespace OHOS::Security;
22 
VerifyNativeToken(const AccessToken::AccessTokenID & callerToken)23 bool AccessTokenHelper::VerifyNativeToken(const AccessToken::AccessTokenID &callerToken)
24 {
25     return callerToken == PERMISSION_GRANTED;
26 }
27 
VerifyAccessToken(const AccessToken::AccessTokenID & callerToken,const std::string & permission)28 bool AccessTokenHelper::VerifyAccessToken(const AccessToken::AccessTokenID &callerToken, const std::string &permission)
29 {
30     return callerToken == PERMISSION_GRANTED;
31 }
32 
RecordSensitivePermissionUsage(const AccessToken::AccessTokenID & callerToken,const std::string & event)33 void AccessTokenHelper::RecordSensitivePermissionUsage(const AccessToken::AccessTokenID &callerToken,
34     const std::string &event)
35 {}
36 
IsDlpHap(const AccessToken::AccessTokenID & callerToken)37 bool AccessTokenHelper::IsDlpHap(const AccessToken::AccessTokenID &callerToken)
38 {
39     return callerToken == DLP_PERMISSION_GRANTED;
40 }
41 
IsSystemApp()42 bool AccessTokenHelper::IsSystemApp()
43 {
44     return true;
45 }
46 }  // namespace EventFwk
47 }  // namespace OHOS
48