From 70931799c1ac5f9f142be4ed8478af98c16f7b4a Mon Sep 17 00:00:00 2001 From: zhouyan Date: Fri, 16 Aug 2024 15:25:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ndk=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=A3=B0=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhouyan Change-Id: Ie4d1f638c840238ba53bc5db79b01823533ccbe9 --- security/access_token/BUILD.gn | 29 +++++++++ .../include/ability_access_control.h | 61 +++++++++++++++++++ security/access_token/libaccesstoken.ndk.json | 5 ++ 3 files changed, 95 insertions(+) create mode 100644 security/access_token/BUILD.gn create mode 100644 security/access_token/include/ability_access_control.h create mode 100644 security/access_token/libaccesstoken.ndk.json diff --git a/security/access_token/BUILD.gn b/security/access_token/BUILD.gn new file mode 100644 index 000000000..c9b63739f --- /dev/null +++ b/security/access_token/BUILD.gn @@ -0,0 +1,29 @@ +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") + +ohos_ndk_headers("accesstoken_header") { + dest_dir = "$ndk_headers_out_dir/accesstoken" + sources = [ "./include/ability_access_control.h" ] +} + +ohos_ndk_library("libability_access_control") { + ndk_description_file = "./libaccesstoken.ndk.json" + min_compact_version = "12" + output_name = "ability_access_control" + output_extension = "so" + + system_capability = "SystemCapability.Security.AccessToken" + system_capability_headers = [ "accesstoken/ability_access_control.h" ] +} diff --git a/security/access_token/include/ability_access_control.h b/security/access_token/include/ability_access_control.h new file mode 100644 index 000000000..121e5b983 --- /dev/null +++ b/security/access_token/include/ability_access_control.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup AbilityAccessControl + * @{ + * + * @brief Provides the capability to manage access token. + * + * @since 12 + */ + +/** + * @file ability_access_control.h + * + * @brief Declares the APIs for managing access token. + * + * @library ability_access_control.so + * @kit AbilityKit + * @syscap SystemCapability.Security.AccessToken + * @since 12 + */ + +#ifndef ABILITY_ACCESS_CONTROL_H +#define ABILITY_ACCESS_CONTROL_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Checks whether this application has been granted the given permission. + * + * @param permission - Name of the permission to be granted. + * @return true - The permission has been granted to this application. + * false - The permission has not been granted to this application. + * @since 12 + */ +bool OH_AT_CheckSelfPermission(const char *permission); + +#ifdef __cplusplus +} +#endif + +/** @} */ +#endif /* ABILITY_ACCESS_CONTROL_H */ diff --git a/security/access_token/libaccesstoken.ndk.json b/security/access_token/libaccesstoken.ndk.json new file mode 100644 index 000000000..3f1d12c5e --- /dev/null +++ b/security/access_token/libaccesstoken.ndk.json @@ -0,0 +1,5 @@ +[ + { + "name": "OH_AT_CheckSelfPermission" + } +] \ No newline at end of file -- Gitee