Description:add permission check

Feature or Bugfix:Bugfix
Bunary Source:No

Signed-off-by: yyh <yangyinghua1@huawei.com>
This commit is contained in:
yyh 2024-11-15 17:47:48 +08:00
parent ac049f302c
commit 2849a0a1e7

View File

@ -1132,6 +1132,7 @@ void PasteboardService::CheckAppUriPermission(PasteData &data)
std::vector<std::string> uris;
std::vector<size_t> indexs;
std::vector<bool> checkResults;
pid_t callingUid = IPCSkeleton::GetCallingUid();
for (size_t i = 0; i < data.GetRecordCount(); i++) {
auto item = data.GetRecordAt(i);
if (item == nullptr || item->GetOrginUri() == nullptr) {
@ -1163,7 +1164,8 @@ void PasteboardService::CheckAppUriPermission(PasteData &data)
if (item == nullptr || item->GetOrginUri() == nullptr) {
continue;
}
item->SetGrantUriPermission(checkResults[i]);
bool result = (uid_ != -1 && callingUid == uid_) ? true : checkResults[i];
item->SetGrantUriPermission(result);
}
}