• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_IAM_STUB_H
17 #define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_IAM_STUB_H
18 
19 #include "iaccount_iam.h"
20 
21 #include <map>
22 #include "account_error_no.h"
23 #include "account_permission_manager.h"
24 #include "iremote_stub.h"
25 
26 namespace OHOS {
27 namespace AccountSA {
28 class AccountIAMMgrStub : public IRemoteStub<IAccountIAM> {
29 public:
30     using MessageProcFunction = ErrCode (AccountIAMMgrStub::*)(MessageParcel &data, MessageParcel &reply);
31     typedef struct AccountIAMMessageProc {
32         MessageProcFunction messageProcFunction;
33         bool isSyetemApi = false;
34     } AccountIAMMessageProc;
35     AccountIAMMgrStub();
36     ~AccountIAMMgrStub() override;
37     int OnRemoteRequest(
38         uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
39 
40 public:
41     ErrCode ProcOpenSession(MessageParcel &data, MessageParcel &reply);
42     ErrCode ProcCloseSession(MessageParcel &data, MessageParcel &reply);
43     ErrCode ProcAddCredential(MessageParcel &data, MessageParcel &reply);
44     ErrCode ProcUpdateCredential(MessageParcel &data, MessageParcel &reply);
45     ErrCode ProcDelCred(MessageParcel &data, MessageParcel &reply);
46     ErrCode ProcDelUser(MessageParcel &data, MessageParcel &reply);
47     ErrCode ProcCancel(MessageParcel &data, MessageParcel &reply);
48     ErrCode ProcGetCredentialInfo(MessageParcel &data, MessageParcel &reply);
49     ErrCode ProcAuthUser(MessageParcel &data, MessageParcel &reply);
50     ErrCode ProcCancelAuth(MessageParcel &data, MessageParcel &reply);
51     ErrCode ProcGetAvailableStatus(MessageParcel &data, MessageParcel &reply);
52     ErrCode ProcGetProperty(MessageParcel &data, MessageParcel &reply);
53     ErrCode ProcSetProperty(MessageParcel &data, MessageParcel &reply);
54     ErrCode ProcGetAccountState(MessageParcel &data, MessageParcel &reply);
55     ErrCode ReadUserIdAndAuthType(MessageParcel &data, int32_t &userId, int32_t &authType);
56     ErrCode AddOrUpdateCredential(MessageParcel &data, MessageParcel &reply, bool isAdd = true);
57     bool CheckPermission(const std::string &permission);
58 
59 private:
60     std::map<uint32_t, AccountIAMMessageProc> messageProcMap_;
61     DISALLOW_COPY_AND_MOVE(AccountIAMMgrStub);
62 };
63 }  // namespace AccountSA
64 }  // namespace OHOS
65 #endif  // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_IAM_STUB_H