• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IINNER_OS_ACCOUNT_H
17 #define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IINNER_OS_ACCOUNT_H
18 
19 #include <string>
20 #include "account_error_no.h"
21 #include "os_account_info.h"
22 #include "iremote_object.h"
23 #include "os_account_subscribe_info.h"
24 
25 namespace OHOS {
26 namespace AccountSA {
27 class IInnerOsAccount {
28 public:
29     virtual void Init() = 0;
30     virtual ErrCode CreateOsAccount(
31         const std::string &name, const OsAccountType &type, OsAccountInfo &osAccountInfo) = 0;
32     virtual ErrCode CreateOsAccountForDomain(
33         const OsAccountType &type, const DomainAccountInfo &domainInfo, OsAccountInfo &osAccountInfo) = 0;
34     virtual ErrCode RemoveOsAccount(const int id) = 0;
35     virtual ErrCode IsOsAccountExists(const int id, bool &isOsAccountExits) = 0;
36     virtual ErrCode IsOsAccountActived(const int id, bool &isOsAccountActived) = 0;
37     virtual ErrCode IsOsAccountConstraintEnable(
38         const int id, const std::string &constraint, bool &isOsAccountConstraintEnable) = 0;
39     virtual ErrCode IsOsAccountVerified(const int id, bool &isVerified) = 0;
40     virtual ErrCode GetCreatedOsAccountsCount(unsigned int &createdOsAccountCount) = 0;
41     virtual ErrCode QueryMaxOsAccountNumber(int &maxOsAccountNumber) = 0;
42     virtual ErrCode GetOsAccountAllConstraints(const int id, std::vector<std::string> &constraints) = 0;
43     virtual ErrCode QueryAllCreatedOsAccounts(std::vector<OsAccountInfo> &osAccountInfos) = 0;
44     virtual ErrCode QueryOsAccountById(const int id, OsAccountInfo &osAccountInfo) = 0;
45     virtual ErrCode GetOsAccountType(const int id, OsAccountType &type) = 0;
46     virtual ErrCode GetOsAccountProfilePhoto(const int id, std::string &photo) = 0;
47     virtual ErrCode IsMultiOsAccountEnable(bool &isMultiOsAccountEnable) = 0;
48     virtual ErrCode SetOsAccountName(const int id, const std::string &name) = 0;
49     virtual ErrCode SetOsAccountConstraints(
50         const int id, const std::vector<std::string> &constraints, const bool enable) = 0;
51     virtual ErrCode SetOsAccountProfilePhoto(const int id, const std::string &photo) = 0;
52     virtual ErrCode ActivateOsAccount(const int id) = 0;
53     virtual ErrCode StartOsAccount(const int id) = 0;
54     virtual ErrCode StopOsAccount(const int id) = 0;
55     virtual ErrCode GetOsAccountLocalIdBySerialNumber(const int64_t serialNumber, int &id) = 0;
56     virtual ErrCode GetSerialNumberByOsAccountLocalId(const int &id, int64_t &serialNumber) = 0;
57     virtual ErrCode SubscribeOsAccount(
58         const OsAccountSubscribeInfo &subscribeInfo, const sptr<IRemoteObject> &eventListener) = 0;
59     virtual ErrCode UnsubscribeOsAccount(const sptr<IRemoteObject> &eventListener) = 0;
60     virtual OS_ACCOUNT_SWITCH_MOD GetOsAccountSwitchMod() = 0;
61     virtual ErrCode IsOsAccountCompleted(const int id, bool &isOsAccountCompleted) = 0;
62     virtual ErrCode SetOsAccountIsVerified(const int id, const bool isVerified) = 0;
63     virtual ErrCode IsAllowedCreateAdmin(bool &isAllowedCreateAdmin) = 0;
64     virtual ErrCode GetOsAccountLocalIdFromDomain(const DomainAccountInfo &domainInfo, int &id) = 0;
65     virtual ErrCode GetCreatedOsAccountNumFromDatabase(const std::string& storeID,
66         int &createdOsAccountNum) = 0;
67     virtual ErrCode GetSerialNumberFromDatabase(const std::string& storeID, int64_t &serialNumber) = 0;
68     virtual ErrCode GetMaxAllowCreateIdFromDatabase(const std::string& storeID, int &id) = 0;
69     virtual ErrCode GetOsAccountFromDatabase(const std::string& storeID, const int id,
70         OsAccountInfo &osAccountInfo) = 0;
71     virtual ErrCode GetOsAccountListFromDatabase(const std::string& storeID,
72         std::vector<OsAccountInfo> &osAccountList) = 0;
73     virtual ErrCode QueryActiveOsAccountIds(std::vector<int32_t>& ids) = 0;
74     virtual ErrCode QueryOsAccountConstraintSourceTypes(const int32_t id,
75         const std::string &constraint, std::vector<ConstraintSourceTypeInfo> &constraintSourceTypeInfos) = 0;
76     virtual ErrCode SetGlobalOsAccountConstraints(const std::vector<std::string> &constraints,
77         const bool enable, const int32_t enforcerId, const bool isDeviceOwner) = 0;
78     virtual ErrCode SetSpecificOsAccountConstraints(const std::vector<std::string> &constraints,
79         const bool enable, const int32_t targetId, const int32_t enforcerId, const bool isDeviceOwner) = 0;
80     virtual ErrCode SetBaseOsAccountConstraints(const int32_t id,
81         const std::vector<std::string> &constraints, const bool enable) = 0;
82 };
83 }  // namespace AccountSA
84 }  // namespace OHOS
85 
86 #endif  // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_OSACCOUNT_IINNER_OS_ACCOUNT_H
87