UserAuth SA侧自定义事件没有权限控制,需要增加发送方的发送权限和接收方的权限校验

Signed-off-by: lyf <liyongfei13@h-partners.com>
Change-Id: I80dfb12f3a2447bbd8453774e4db49cccecee0dd
This commit is contained in:
lyf 2024-08-24 02:17:33 +00:00
parent fa99756008
commit 3015a6182c
2 changed files with 7 additions and 1 deletions

View File

@ -19,7 +19,9 @@
"ohos.permission.ACCESS_SERVICE_DM",
"ohos.permission.sec.ACCESS_UDID",
"ohos.permission.MANAGE_SECURE_SETTINGS",
"ohos.permission.PERMISSION_USED_STATS"
"ohos.permission.PERMISSION_USED_STATS",
"ohos.permission.MANAGE_USER_IDM",
"ohos.permission.USE_USER_IDM"
],
"permission_acls" : [
"ohos.permission.ACCESS_AUTH_RESPOOL",

View File

@ -32,10 +32,14 @@ const std::string USER_PIN_CREATED_EVENT = "USER_PIN_CREATED_EVENT";
const std::string USER_PIN_DELETED_EVENT = "USER_PIN_DELETED_EVENT";
const std::string USER_PIN_UPDATED_EVENT = "USER_PIN_UPDATED_EVENT";
const std::string USER_CREDENTIAL_UPDATED_EVENT = "USER_CREDENTIAL_UPDATED_EVENT";
const std::string USERIAM_COMMON_EVENT_PERMISSION = "ohos.permission.USE_USER_IDM";
void PublishEvent(EventFwk::CommonEventData data)
{
EventFwk::CommonEventPublishInfo publishInfo;
std::vector<std::string> permissions;
permissions.push_back(USERIAM_COMMON_EVENT_PERMISSION);
publishInfo.SetSubscriberPermissions(permissions);
publishInfo.SetSticky(false);
if (!EventFwk::CommonEventManager::PublishCommonEvent(data, publishInfo)) {
IAM_LOGE("PublishCommonEvent failed, eventAction is %{public}s", data.GetWant().GetAction().c_str());