1 /*
2  * Copyright (c) 2022 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 #ifndef FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_OS_ACCOUNT_MANAGER_HELPER_H
17 #define FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_OS_ACCOUNT_MANAGER_HELPER_H
18 
19 #include <vector>
20 
21 #include "errors.h"
22 #include "singleton.h"
23 
24 namespace OHOS {
25 namespace EventFwk {
26 class OsAccountManagerHelper : public DelayedSingleton<OsAccountManagerHelper> {
27 public:
OsAccountManagerHelper()28     OsAccountManagerHelper() {}
~OsAccountManagerHelper()29     virtual ~OsAccountManagerHelper() {}
30 
31     /**
32     * @brief check is system account
33     */
34     static bool IsSystemAccount(int32_t userId);
35 
36     /**
37      * Queries active operating system account IDs.
38      *
39      * @param ids Indicates the account IDs.
40      * @return Returns result code.
41      */
42     ErrCode QueryActiveOsAccountIds(std::vector<int32_t>& ids);
43 
44     /**
45      * Gets operating system account local ID from uid.
46      *
47      * @param uid Indicates the uid.
48      * @param ids Indicates the account ID.
49      * @return Returns result code.
50      */
51     ErrCode GetOsAccountLocalIdFromUid(const int32_t uid, int32_t &id);
52 
53     /**
54      * Check the userId whether exists in OsAccount service.
55      *
56      * @param userId Indicates the current active account ID.
57      * @return Returns result.
58      */
59     bool CheckUserExists(const int32_t &userId);
60 };
61 }  // namespace EventFwk
62 }  // namespace OHOS
63 
64 #endif  // FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_OS_ACCOUNT_MANAGER_HELPER_H