diff --git a/security/access_token/BUILD.gn b/security/access_token/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c9b63739f9478c7f650b571ff4387367efc27d8e --- /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 0000000000000000000000000000000000000000..121e5b9836d58e0c0d4163d900614acfd5668894 --- /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 0000000000000000000000000000000000000000..3f1d12c5ea8c0a71d8a677aa54381be887406e89 --- /dev/null +++ b/security/access_token/libaccesstoken.ndk.json @@ -0,0 +1,5 @@ +[ + { + "name": "OH_AT_CheckSelfPermission" + } +] \ No newline at end of file