3using System.Collections.Generic;
4using System.Threading.Tasks;
28 private int nrReviewersToApprove = 2;
29 private int nrPhotosRequired = 1;
30 private bool allowPeerReview =
false;
31 private bool requireFirstName =
false;
32 private bool requireMiddleName =
false;
33 private bool requireLastName =
false;
34 private bool requirePersonalNumber =
false;
35 private bool requireCountry =
false;
36 private bool requireRegion =
false;
37 private bool requireCity =
false;
38 private bool requireArea =
false;
39 private bool requirePostalCode =
false;
40 private bool requireAddress =
false;
41 private bool requireIso3166Compliance =
false;
42 private bool requireNationality =
false;
43 private bool requireGender =
false;
44 private bool requireBirthDate =
false;
48 public int NrReviewersToApprove
50 get => this.nrReviewersToApprove;
51 set => this.nrReviewersToApprove = value;
54 public int NrPhotosRequired
56 get => this.nrPhotosRequired;
57 set => this.nrPhotosRequired = value;
61 public bool AllowPeerReview
63 get => this.allowPeerReview;
64 set => this.allowPeerReview = value;
68 public bool RequireFirstName
70 get => this.requireFirstName;
71 set => this.requireFirstName = value;
75 public bool RequireMiddleName
77 get => this.requireMiddleName;
78 set => this.requireMiddleName = value;
82 public bool RequireLastName
84 get => this.requireLastName;
85 set => this.requireLastName = value;
89 public bool RequirePersonalNumber
91 get => this.requirePersonalNumber;
92 set => this.requirePersonalNumber = value;
96 public bool RequireCountry
98 get => this.requireCountry;
99 set => this.requireCountry = value;
102 [DefaultValue(
false)]
103 public bool RequireRegion
105 get => this.requireRegion;
106 set => this.requireRegion = value;
109 [DefaultValue(
false)]
110 public bool RequireCity
112 get => this.requireCity;
113 set => this.requireCity = value;
116 [DefaultValue(
false)]
117 public bool RequireArea
119 get => this.requireArea;
120 set => this.requireArea = value;
123 [DefaultValue(
false)]
124 public bool RequirePostalCode
126 get => this.requirePostalCode;
127 set => this.requirePostalCode = value;
130 [DefaultValue(
false)]
131 public bool RequireAddress
133 get => this.requireAddress;
134 set => this.requireAddress = value;
137 [DefaultValue(
false)]
138 public bool RequireIso3166Compliance
140 get => this.requireIso3166Compliance;
141 set => this.requireIso3166Compliance = value;
144 [DefaultValue(
false)]
145 public bool RequireNationality
147 get => this.requireNationality;
148 set => this.requireNationality = value;
151 [DefaultValue(
false)]
152 public bool RequireGender
154 get => this.requireGender;
155 set => this.requireGender = value;
158 [DefaultValue(
false)]
159 public bool RequireBirthDate
161 get => this.requireBirthDate;
162 set => this.requireBirthDate = value;
173 public override string Resource =>
"/Settings/PeerReview.md";
195 return Task.CompletedTask;
213 this.peerReview = WebServer.
Register(
"/Settings/PeerReview",
null, this.PeerReview,
true,
false,
true);
215 return base.InitSetup(WebServer);
226 return base.UnregisterSetup(WebServer);
242 if (!(Obj is Dictionary<string, object> Form) ||
243 !Form.TryGetValue(
"allowPeerReview", out Obj) || !(Obj is
bool AllowPeerReview) ||
244 !Form.TryGetValue(
"nrReviewersToApprove", out Obj) || !(Obj is
string NrReviewersToApproveStr) ||
245 !
int.TryParse(NrReviewersToApproveStr, out
int NrReviewersToApprove) || NrReviewersToApprove <= 0 ||
246 !Form.TryGetValue(
"nrPhotosRequired", out Obj) || !(Obj is
string NrPhotosToApproveStr) ||
247 !
int.TryParse(NrPhotosToApproveStr, out
int NrPhotosToApprove) || NrPhotosToApprove <= 0 ||
248 !Form.TryGetValue(
"requireFirstName", out Obj) || !(Obj is
bool RequireFirstName) ||
249 !Form.TryGetValue(
"requireMiddleName", out Obj) || !(Obj is
bool RequireMiddleName) ||
250 !Form.TryGetValue(
"requireLastName", out Obj) || !(Obj is
bool RequireLastName) ||
251 !Form.TryGetValue(
"requirePersonalNumber", out Obj) || !(Obj is
bool RequirePersonalNumber) ||
252 !Form.TryGetValue(
"requireCountry", out Obj) || !(Obj is
bool RequireCountry) ||
253 !Form.TryGetValue(
"requireRegion", out Obj) || !(Obj is
bool RequireRegion) ||
254 !Form.TryGetValue(
"requireCity", out Obj) || !(Obj is
bool RequireCity) ||
255 !Form.TryGetValue(
"requireArea", out Obj) || !(Obj is
bool RequireArea) ||
256 !Form.TryGetValue(
"requirePostalCode", out Obj) || !(Obj is
bool RequirePostalCode) ||
257 !Form.TryGetValue(
"requireAddress", out Obj) || !(Obj is
bool RequireAddress) ||
258 !Form.TryGetValue(
"requireIso3166Compliance", out Obj) || !(Obj is
bool RequireIso3166Compliance) ||
259 !Form.TryGetValue(
"requireNationality", out Obj) || !(Obj is
bool RequireNationality) ||
260 !Form.TryGetValue(
"requireGender", out Obj) || !(Obj is
bool RequireGender) ||
261 !Form.TryGetValue(
"requireBirthDate", out Obj) || !(Obj is
bool RequireBirthDate))
266 this.allowPeerReview = AllowPeerReview;
267 this.nrReviewersToApprove = NrReviewersToApprove;
268 this.nrPhotosRequired = NrPhotosToApprove;
269 this.requireFirstName = RequireFirstName;
270 this.requireMiddleName = RequireMiddleName;
271 this.requireLastName = RequireLastName;
272 this.requirePersonalNumber = RequirePersonalNumber;
273 this.requireCountry = RequireCountry;
274 this.requireRegion = RequireRegion;
275 this.requireCity = RequireCity;
276 this.requireArea = RequireArea;
277 this.requirePostalCode = RequirePostalCode;
278 this.requireAddress = RequireAddress;
279 this.requireIso3166Compliance = RequireIso3166Compliance;
280 this.requireNationality = RequireNationality;
281 this.requireGender = RequireGender;
282 this.requireBirthDate = RequireBirthDate;
286 Response.StatusCode = 200;
296 this.nrReviewersToApprove = 2;
297 this.nrPhotosRequired = 1;
298 this.allowPeerReview =
true;
299 this.requireFirstName =
true;
300 this.requireMiddleName =
false;
301 this.requireLastName =
true;
302 this.requirePersonalNumber =
true;
303 this.requireCountry =
true;
304 this.requireRegion =
false;
305 this.requireCity =
true;
306 this.requireArea =
false;
307 this.requirePostalCode =
true;
308 this.requireAddress =
true;
309 this.requireIso3166Compliance =
true;
310 this.requireNationality =
false;
311 this.requireGender =
false;
312 this.requireBirthDate =
false;
314 return Task.FromResult(
true);
410 return Task.FromResult(
false);
412 if (!this.allowPeerReview)
413 return Task.FromResult(
true);
432 return Task.FromResult(
false);
435 return Task.FromResult(
true);
Static class managing the runtime environment of the IoT Gateway.
static IUser AssertUserAuthenticated(HttpRequest Request, string Privilege)
Makes sure a request is being made from a session with a successful user login.
bool TryGetEnvironmentVariable(string VariableName, bool Required, out string Value)
Tries to get a string-valued environment variable.
Abstract base class for multi-step system configurations.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
Represents an HTTP request.
bool HasData
If the request has data.
async Task< object > DecodeDataAsync()
Decodes data sent in request.
Base class for all HTTP resources.
Represets a response of an HTTP client request.
async Task SendResponse()
Sends the response back to the client. If the resource is synchronous, there's no need to call this m...
Implements an HTTP server.
HttpResource Register(HttpResource Resource)
Registers a resource with the server.
bool Unregister(HttpResource Resource)
Unregisters a resource from the server.
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Update(object Object)
Updates an object in the database.
Contains information about a language.
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Provides the user configuration options regarding peer-review of new legal identities.
const string BROKER_REVIEW_MIDDLE
If middle-name is required in a peer review(true or 1), or not(false or 0).
const string BROKER_REVIEW_PNR
If personal number is required in a peer review(true or 1), or not(false or 0).
const string BROKER_REVIEW_NRPEERS
Number of peers required to review and approve a legal identity application before it can be approved...
const string BROKER_REVIEW_GENDER
If gender is required in a peer review(true or 1), or not(false or 0).
const string BROKER_REVIEW_NATIONALITY
If nationality is required in a peer review(true or 1), or not(false or 0).
override Task UnregisterSetup(HttpServer WebServer)
Unregisters the setup object.
const string BROKER_REVIEW_LAST
If last-name is required in a peer review(true or 1), or not(false or 0).
const string BROKER_REVIEW_FIRST
If first-name is required in a peer review (true or 1), or not(false or 0).
override Task< bool > EnvironmentConfiguration()
Environment configuration by configuring values available in environment variables.
const string BROKER_REVIEW_ISO3166
If country codes must comply with ISO 3166 in a peer review(true or 1), or not(false or 0).
override Task< bool > SimplifiedConfiguration()
Simplified configuration by configuring simple default values.
override int Priority
Priority of the setting. Configurations are sorted in ascending order.
override Task ConfigureSystem()
Is called during startup to configure the system.
static PeerReviewConfiguration Instance
Current instance of configuration.
override string Resource
Resource to be redirected to, to perform the configuration.
const string BROKER_REVIEW_USE
If peer review is allowed on the broker(true or 1), or not(false or 0). If enabled,...
const string BROKER_REVIEW_ZIP
If postal code is required in a peer review(true or 1), or not(false or 0).
const string BROKER_REVIEW_ADDR
If address is required in a peer review(true or 1), or not(false or 0).
const string BROKER_REVIEW_NRPHOTOS
Number of photos required in a legal identity application for a peer review to be accepted.
const string BROKER_REVIEW_REGION
If region is required in a peer review(true or 1), or not(false or 0).
override void SetStaticInstance(ISystemConfiguration Configuration)
Sets the static instance of the configuration.
override Task InitSetup(HttpServer WebServer)
Initializes the setup object.
const string BROKER_REVIEW_BDATE
If birth date is required in a peer review(true or 1), or not(false or 0).
override Task< string > Title(Language Language)
Gets a title for the system configuration.
const string BROKER_REVIEW_COUNTRY
If country is required in a peer review(true or 1), or not(false or 0).
const string BROKER_REVIEW_AREA
If area is required in a peer review(true or 1), or not(false or 0).
const string BROKER_REVIEW_CITY
If city is required in a peer review(true or 1), or not(false or 0).
override string ConfigPrivilege
Minimum required privilege for a user to be allowed to change the configuration defined by the class.
Service Module hosting the XMPP broker and its components.
Interface for system configurations. The gateway will scan all module for system configuration classe...