1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "edm_os_account_manager_impl.h"
17 #include "edm_log.h"
18
19 namespace OHOS {
20 namespace EDM {
QueryActiveOsAccountIds(std::vector<int32_t> & ids)21 ErrCode EdmOsAccountManagerImpl::QueryActiveOsAccountIds(std::vector<int32_t> &ids)
22 {
23 #ifdef OS_ACCOUNT_EDM_ENABLE
24 return AccountSA::OsAccountManager::QueryActiveOsAccountIds(ids);
25 #else
26 EDMLOGW("EdmOsAccountManagerImpl::QueryActiveOsAccountIds Unsupported Capabilities.");
27 return EdmReturnErrCode::SYSTEM_ABNORMALLY;
28 #endif
29 }
30
IsOsAccountExists(int32_t id,bool & isExist)31 ErrCode EdmOsAccountManagerImpl::IsOsAccountExists(int32_t id, bool &isExist)
32 {
33 #ifdef OS_ACCOUNT_EDM_ENABLE
34 return AccountSA::OsAccountManager::IsOsAccountExists(id, isExist);
35 #else
36 EDMLOGW("EdmOsAccountManagerImpl::IsOsAccountExists Unsupported Capabilities.");
37 return EdmReturnErrCode::SYSTEM_ABNORMALLY;
38 #endif
39 }
40
41 #ifdef OS_ACCOUNT_EDM_ENABLE
CreateOsAccount(const std::string & name,const OHOS::AccountSA::OsAccountType & type,OHOS::AccountSA::OsAccountInfo & osAccountInfo)42 ErrCode EdmOsAccountManagerImpl::CreateOsAccount(const std::string &name, const OHOS::AccountSA::OsAccountType &type,
43 OHOS::AccountSA::OsAccountInfo &osAccountInfo)
44 {
45 EDMLOGI("EdmOsAccountManagerImpl::CreateOsAccount.");
46 return OHOS::AccountSA::OsAccountManager::CreateOsAccount(name, type, osAccountInfo);
47 }
48 #endif
49 } // namespace EDM
50 } // namespace OHOS