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 #include "dfsu_access_token_helper_mock.h"
17 #include "dfs_error.h"
18
19 namespace OHOS::FileManagement {
20 using namespace std;
CheckCallerPermission(const std::string & permissionName)21 bool DfsuAccessTokenHelper::CheckCallerPermission(const std::string &permissionName)
22 {
23 return FileManagement::CloudSync::DfsuAccessToken::dfsuAccessToken->CheckCallerPermission(permissionName);
24 }
25
CheckPermission(uint32_t tokenId,const std::string & permissionName)26 bool DfsuAccessTokenHelper::CheckPermission(uint32_t tokenId, const std::string &permissionName)
27 {
28 return FileManagement::CloudSync::DfsuAccessToken::dfsuAccessToken->CheckPermission(tokenId, permissionName);
29 }
30
GetCallerBundleName(std::string & bundleName)31 int32_t DfsuAccessTokenHelper::GetCallerBundleName(std::string &bundleName)
32 {
33 return FileManagement::CloudSync::DfsuAccessToken::dfsuAccessToken->GetCallerBundleName(bundleName);
34 }
35
GetBundleNameByToken(uint32_t tokenId,std::string & bundleName)36 int32_t DfsuAccessTokenHelper::GetBundleNameByToken(uint32_t tokenId, std::string &bundleName)
37 {
38 return FileManagement::CloudSync::DfsuAccessToken::dfsuAccessToken->GetBundleNameByToken(tokenId, bundleName);
39 }
IsSystemApp()40 bool DfsuAccessTokenHelper::IsSystemApp()
41 {
42 return FileManagement::CloudSync::DfsuAccessToken::dfsuAccessToken->IsSystemApp();
43 }
44
GetUserId()45 int32_t DfsuAccessTokenHelper::GetUserId()
46 {
47 return FileManagement::CloudSync::DfsuAccessToken::dfsuAccessToken->GetUserId();
48 }
49
GetPid()50 int32_t DfsuAccessTokenHelper::GetPid()
51 {
52 return FileManagement::CloudSync::DfsuAccessToken::dfsuAccessToken->GetPid();
53 }
54
CheckUriPermission(const std::string & uri)55 bool DfsuAccessTokenHelper::CheckUriPermission(const std::string &uri)
56 {
57 return FileManagement::CloudSync::DfsuAccessToken::dfsuAccessToken->CheckUriPermission(uri);
58 }
59
60 } // namespace OHOS::FileManagement