mirror of
https://gitee.com/openharmony/account_os_account
synced 2024-11-23 02:00:01 +00:00
add check id tobeRemove
Signed-off-by: xuqian <xuqian65@huawei.com>
This commit is contained in:
parent
2f13af0102
commit
02b1d328fb
@ -1155,6 +1155,14 @@ ErrCode OsAccountManagerService::GetBackgroundOsAccountLocalIds(std::vector<int3
|
||||
|
||||
ErrCode OsAccountManagerService::SetOsAccountToBeRemoved(int32_t localId, bool toBeRemoved)
|
||||
{
|
||||
ErrCode res = CheckLocalId(localId);
|
||||
if (res != ERR_OK) {
|
||||
return res;
|
||||
}
|
||||
if ((localId == Constants::START_USER_ID) || (localId == Constants::ADMIN_LOCAL_ID)) {
|
||||
ACCOUNT_LOGE("Cannot remove system preinstalled user.");
|
||||
return ERR_OSACCOUNT_SERVICE_MANAGER_ID_ERROR;
|
||||
}
|
||||
if (!PermissionCheck(MANAGE_LOCAL_ACCOUNTS, "")) {
|
||||
ACCOUNT_LOGE("Permission denied.");
|
||||
return ERR_ACCOUNT_COMMON_PERMISSION_DENIED;
|
||||
|
Loading…
Reference in New Issue
Block a user