xref: /haiku/src/apps/haikudepot/server/UserDetailVerifierProcess.h (revision 10cd325cfafb80353704ef021205ff5e5523d3a3)
1 /*
2  * Copyright 2020, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 
6 #ifndef USER_DETAIL_VERIFIER_PROCESS_H
7 #define USER_DETAIL_VERIFIER_PROCESS_H
8 
9 #include <String.h>
10 
11 #include "AbstractProcess.h"
12 #include "Model.h"
13 
14 
15 class UserDetailVerifierListener {
16 public:
17 	virtual	void				UserUsageConditionsNotLatest(
18 									const UserDetail& userDetail) = 0;
19 	virtual	void				UserCredentialsFailed() = 0;
20 };
21 
22 
23 /*!	This service has the purpose of querying the application server (HDS)
24 	for details of the authenticated user.  This will check that the user
25 	has the correct username / password and also that the user has agreed
26 	to the current terms and conditions.
27  */
28 
29 class UserDetailVerifierProcess : public AbstractProcess {
30 public:
31 								UserDetailVerifierProcess(
32 									Model* model,
33 									UserDetailVerifierListener* listener);
34 	virtual						~UserDetailVerifierProcess();
35 
36 	virtual	const char*			Name() const;
37 	virtual	const char*			Description() const;
38 
39 protected:
40 	virtual	status_t			RunInternal();
41 
42 private:
43 			status_t			_TryFetchUserDetail(UserDetail& userDetail);
44 			bool				_ShouldVerify();
45 
46 private:
47 			Model*				fModel;
48 			UserDetailVerifierListener*
49 								fListener;
50 };
51 
52 
53 #endif // USER_DETAIL_VERIFIER_PROCESS_H
54