diff --git a/README.md b/README.md index 22202f2..4136ec2 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,22 @@ The accesscontrol_cangjie_wrapper is a Cangjie API encapsulated on OpenHarmony b As shown in the architecture diagram: -- requestPermissionsFromUser: Developers can request user authorization, and the result of this permission application will be returned. +interface: Provides APIs for developers. + - checkAccessToken: accesscontrol_cangjie_wrapper provides permission verification and management capabilities for applications. Developers can check whether an application has been authorized. -- Cangjie Accesscontrol FFI interface: Based on cross-language interoperability via C interfaces to implement accesscontrol Cangjie API. +- requestPermissions: Developers can request user authorization, and the result of this permission application will be returned. + +frameworks: + +- checkAccessToken wrapper: Encapsulates the checkAccessToken interface, providing developers with the ability to check whether an application has been authorized. +- requestPermissions wrapper: Encapsulates the requestPermissionsFromUser interface, providing developers with the ability to request permissions from users. + +Dependency Component Introduction in Architecture: + - access_token: It is responsible for providing basic functions of application access control, and encapsulates C interfaces to provide interoperability for Cangjie. -- ability_cangjie_wrapper: Responsible for providing UIAbilityContext to the authorization interface for launching permission request dialogs to users. - hiviewdfx_cangjie_wrapper: Responsible for providing HiLog APIs, used for printing logs at critical paths. - cangjie_ark_interop: Responsible for providing APILevel definitions, used for annotating APIs. Also provides the BusinessException exception class definition that is thrown to users. +- ability_cangjie_wrapper: Responsible for providing UIAbilityContext to the authorization interface for launching permission request dialogs to users. ## Directory Structure @@ -55,6 +64,14 @@ For Accesscontrol-related APIs, please refer to [ohos.ability_access_ctrl (Appli Developers are welcome to contribute code, documentation, etc. For specific contribution processes and methods, please refer to [Code Contribution](https://gitcode.com/openharmony/docs/blob/master/en/contribute/code-contribution.md). +## Constraints + +The following features are not provided yet: + + - Check the status of application permissions. + - Displays a dialog box for setting a global swich. + - Displays a permission settings dialog box to grant permissions the second time. + ## Repositories Involved [security_access_token](https://gitcode.com/openharmony/security_access_token) diff --git a/README_zh.md b/README_zh.md index 7b43c78..a7446d3 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1,8 +1,8 @@ -# 访问控制仓颉接口 +# 访问控制仓颉封装 ## 简介 -访问控制仓颉接口是在OpenHarmony上基于AccessToken能力之上封装的仓颉API。应用的Accesstoken信息主要包括应用身份标识APPID、用户ID、应用分身索引、应用APL(Ability Privilege Level)等级、应用权限信息等。每个应用的Accesstoken信息由一个32bits的设备内唯一标识符TokenID(Token identity)来标识。仓颉接口提供应用程序的权限校验、申请和管理能力。当前开放的访问控制仓颉接口仅支持standard设备。 +访问控制仓颉封装提供应用程序的权限校验、申请能力。当前开放的访问控制仓颉接口仅支持standard设备。 ## 系统架构 @@ -12,13 +12,22 @@ 如架构图所示: -- 授权接口:开发者可请求用户授权,并返回此次权限申请的结果。访问控制提供应用程序的权限校验和管理能力。 -- 鉴权接口: 开发者可查看应用是否被授权。 -- 仓颉访问控制FFI接口定义:负责定义C语言互操作仓颉接口,用于实现仓颉访问控制能力。 +接口层: + +- 鉴权接口:面向开发者提供的鉴权API,开发者可查看应用是否被授权。 +- 授权接口:面向开发者提供的授权API,开发者可请求用户授权,并返回此次权限申请的结果。访问控制提供应用程序的权限校验和管理能力。 + +框架层: + +- 鉴权接口功能封装:封装checkAccessToken接口,实现鉴权能力。 +- 授权接口功能封装:封装requestPermissionsFromUser接口,实现授权能力。 + +架构图中的依赖部件引入说明: + - 访问控制模块:负责提供访问控制基础功能,封装C语言接口提供给仓颉进行互操作。 +- hiviewdfx_cangjie_wrapper:负责提供日志接口。访问控制仓颉封装依赖此部件用于在关键路径处打印日志。 +- cangjie_ark_interop:负责提供仓颉注解类定义和BusinessException异常类定义。访问控制仓颉封装依赖此部件用于对API进行标注,及在错误分支向用户抛出异常。 - ability_cangjie_wrapper:负责提供UIAbility上下文给授权接口拉起弹窗请求用户授权。 -- hiviewdfx_cangjie_wrapper:负责提供日志接口,用于在关键路径处打印日志。 -- cangjie_ark_interop:负责提供仓颉注解类定义,用于对API进行标注。以及提供抛向用户的BusinessException异常类定义。 ## 目录 @@ -49,9 +58,16 @@ base/accesscontrol/accesscontrol_cangjie_wrapper - 拉起全局开关设置。 - 二次拉起权限设置弹窗。 - 访问控制相关API请参见[仓颉访问控制API文档](https://gitcode.com/openharmony-sig/arkcompiler_cangjie_ark_interop/blob/master/doc/API_Reference/source_zh_cn/apis/AbilityKit/cj-apis-ability_access_ctrl.md),相关指导请参见[访问控制概述](https://gitcode.com/openharmony-sig/arkcompiler_cangjie_ark_interop/blob/master/doc/Dev_Guide/source_zh_cn/security/AccessToken/cj-access-token-overview.md)。 +## 约束 + +与ArkTS提供的API能力相比,暂不支持以下功能: + + - 查询应用权限状态。 + - 拉起全局开关设置。 + - 二次拉起权限设置弹窗。 + ## 参与贡献 欢迎广大开发者代码,文档等,具体的贡献流程和方式请参见[参与贡献](https://gitcode.com/openharmony/docs/blob/master/zh-cn/contribute/%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE.md)。 diff --git a/figures/accesscontrol_cangjie_wrapper_architecture.png b/figures/accesscontrol_cangjie_wrapper_architecture.png index d73b5db..3005b82 100644 Binary files a/figures/accesscontrol_cangjie_wrapper_architecture.png and b/figures/accesscontrol_cangjie_wrapper_architecture.png differ diff --git a/figures/accesscontrol_cangjie_wrapper_architecture_en.png b/figures/accesscontrol_cangjie_wrapper_architecture_en.png index e63c91b..f636619 100644 Binary files a/figures/accesscontrol_cangjie_wrapper_architecture_en.png and b/figures/accesscontrol_cangjie_wrapper_architecture_en.png differ