3using System.Threading.Tasks;
22 private string[] whiteList = Array.Empty<
string>();
23 private int nrReviewersToApprove = 2;
24 private int nrPhotosRequired = 1;
25 private bool allowPeerReview =
false;
26 private bool requireFirstName =
false;
27 private bool requireMiddleName =
false;
28 private bool requireLastName =
false;
29 private bool requirePersonalNumber =
false;
30 private bool requireCountry =
false;
31 private bool requireRegion =
false;
32 private bool requireCity =
false;
33 private bool requireArea =
false;
34 private bool requirePostalCode =
false;
35 private bool requireAddress =
false;
36 private bool requireIso3166Compliance =
false;
37 private bool requireNationality =
false;
38 private bool requireGender =
false;
39 private bool requireBirthDate =
false;
49 get => this.nrReviewersToApprove;
50 set => this.nrReviewersToApprove = value;
58 get => this.nrPhotosRequired;
59 set => this.nrPhotosRequired = value;
68 get => this.allowPeerReview;
69 set => this.allowPeerReview = value;
78 get => this.requireFirstName;
79 set => this.requireFirstName = value;
88 get => this.requireMiddleName;
89 set => this.requireMiddleName = value;
98 get => this.requireLastName;
99 set => this.requireLastName = value;
105 [DefaultValue(
false)]
108 get => this.requirePersonalNumber;
109 set => this.requirePersonalNumber = value;
115 [DefaultValue(
false)]
118 get => this.requireCountry;
119 set => this.requireCountry = value;
125 [DefaultValue(
false)]
128 get => this.requireRegion;
129 set => this.requireRegion = value;
135 [DefaultValue(
false)]
138 get => this.requireCity;
139 set => this.requireCity = value;
145 [DefaultValue(
false)]
148 get => this.requireArea;
149 set => this.requireArea = value;
155 [DefaultValue(
false)]
158 get => this.requirePostalCode;
159 set => this.requirePostalCode = value;
165 [DefaultValue(
false)]
168 get => this.requireAddress;
169 set => this.requireAddress = value;
176 [DefaultValue(
false)]
179 get => this.requireIso3166Compliance;
180 set => this.requireIso3166Compliance = value;
186 [DefaultValue(
false)]
189 get => this.requireNationality;
190 set => this.requireNationality = value;
196 [DefaultValue(
false)]
199 get => this.requireGender;
200 set => this.requireGender = value;
206 [DefaultValue(
false)]
209 get => this.requireBirthDate;
210 set => this.requireBirthDate = value;
219 get => this.whiteList ?? Array.Empty<
string>();
224 if (!(value is
null))
226 foreach (
string s
in value)
228 string s2 = s.Trim();
229 if (!
string.IsNullOrEmpty(s2))
234 this.whiteList = List.
ToArray();
252 if (!this.UsesWhiteList)
257 if (
string.Compare(Jid, Item,
true) == 0 ||
258 string.Compare(LegalId, Item,
true) == 0)
275 public override string Resource =>
"/Settings/PeerReview.md";
297 return Task.CompletedTask;
315 this.peerReview = WebServer.
Register(
"/Settings/PeerReview",
null, this.PeerReview,
true,
false,
true);
317 return base.InitSetup(WebServer);
328 return base.UnregisterSetup(WebServer);
348 !(Content.
Decoded is Dictionary<string, object> Form) ||
349 !Form.TryGetValue(
"allowPeerReview", out
object Obj) || !(Obj is
bool AllowPeerReview) ||
350 !Form.TryGetValue(
"nrReviewersToApprove", out Obj) || !(Obj is
string NrReviewersToApproveStr) ||
352 !Form.TryGetValue(
"nrPhotosRequired", out Obj) || !(Obj is
string NrPhotosToApproveStr) ||
353 !
int.TryParse(NrPhotosToApproveStr, out
int NrPhotosToApprove) || NrPhotosToApprove < 0 ||
354 !Form.TryGetValue(
"requireFirstName", out Obj) || !(Obj is
bool RequireFirstName) ||
355 !Form.TryGetValue(
"requireMiddleName", out Obj) || !(Obj is
bool RequireMiddleName) ||
356 !Form.TryGetValue(
"requireLastName", out Obj) || !(Obj is
bool RequireLastName) ||
358 !Form.TryGetValue(
"requireCountry", out Obj) || !(Obj is
bool RequireCountry) ||
359 !Form.TryGetValue(
"requireRegion", out Obj) || !(Obj is
bool RequireRegion) ||
360 !Form.TryGetValue(
"requireCity", out Obj) || !(Obj is
bool RequireCity) ||
361 !Form.TryGetValue(
"requireArea", out Obj) || !(Obj is
bool RequireArea) ||
362 !Form.TryGetValue(
"requirePostalCode", out Obj) || !(Obj is
bool RequirePostalCode) ||
363 !Form.TryGetValue(
"requireAddress", out Obj) || !(Obj is
bool RequireAddress) ||
365 !Form.TryGetValue(
"requireNationality", out Obj) || !(Obj is
bool RequireNationality) ||
366 !Form.TryGetValue(
"requireGender", out Obj) || !(Obj is
bool RequireGender) ||
367 !Form.TryGetValue(
"requireBirthDate", out Obj) || !(Obj is
bool RequireBirthDate) ||
368 !Form.TryGetValue(
"whiteList", out Obj) || !(Obj is
string WhiteList))
376 this.nrPhotosRequired = NrPhotosToApprove;
395 Response.StatusCode = 200;
396 Response.StatusMessage =
"OK";
407 this.nrReviewersToApprove = 2;
408 this.nrPhotosRequired = 1;
409 this.allowPeerReview =
true;
410 this.requireFirstName =
true;
411 this.requireMiddleName =
false;
412 this.requireLastName =
true;
413 this.requirePersonalNumber =
true;
414 this.requireCountry =
true;
415 this.requireRegion =
false;
416 this.requireCity =
true;
417 this.requireArea =
false;
418 this.requirePostalCode =
true;
419 this.requireAddress =
true;
420 this.requireIso3166Compliance =
true;
421 this.requireNationality =
false;
422 this.requireGender =
false;
423 this.requireBirthDate =
false;
424 this.whiteList = Array.Empty<
string>();
426 return Task.FromResult(
true);
529 return Task.FromResult(
false);
531 if (!this.allowPeerReview)
532 return Task.FromResult(
true);
552 return Task.FromResult(
false);
555 this.WhiteList =
WhiteList.Split(
',', StringSplitOptions.RemoveEmptyEntries);
557 return Task.FromResult(
true);
Helps with parsing of commong data types.
static readonly char[] CRLF
Contains the CR LF character sequence.
Contains information about a response to a content request.
bool HasError
If an error occurred.
object Decoded
Decoded object.
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< ContentResponse > 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.
A chunked list is a linked list of chunks of objects of type T .
void Add(T Item)
Adds an item to the collection.
T[] ToArray()
Returns an array containing all elements of the collection.
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).
const string BROKER_REVIEW_WHITELIST
White-listed JIDs and/or Legal IDs allowed to perform peer review, separated by commas....
override Task UnregisterSetup(HttpServer WebServer)
Unregisters the setup object.
bool AllowPeerReview
If peer-review is allowed on the broker.
const string BROKER_REVIEW_LAST
If last-name is required in a peer review(true or 1), or not(false or 0).
bool RequireFirstName
If first name is required in applications for them to be peer-reviewable.
bool UsesWhiteList
If a white-list is used.
const string BROKER_REVIEW_FIRST
If first-name is required in a peer review (true or 1), or not(false or 0).
int NrReviewersToApprove
Number of peers required to review and approve a legal identity application before it can be approved...
bool RequireBirthDate
If birth date is required in applications for them to be peer-reviewable.
int NrPhotosRequired
Number of photos required in an application for it to be peer-reviewable.
override Task< bool > EnvironmentConfiguration()
Environment configuration by configuring values available in environment variables.
bool RequirePostalCode
If postal code is required in applications for them to be peer-reviewable.
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).
bool IsReviewerAllowed(string Jid, string LegalId)
Checks if a reviewer is allowed to perform peer review, based on the white-list, if configured.
bool RequireCity
If city is required in applications for them to be peer-reviewable.
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.
bool RequireNationality
If nationality is required in applications for them to be peer-reviewable.
bool RequireMiddleName
If middle name(s) is/are required in applications for them to be peer-reviewable.
bool RequireRegion
If region is required in applications for them to be peer-reviewable.
bool RequireIso3166Compliance
If country codes are required to be ISO 3166 compliant in applications for them to be peer-reviewable...
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.
string[] WhiteList
Peer Review White List (JIDS and/or Legal IDs), allowed to perform peer review.
bool RequireCountry
If country is required in applications for them to be peer-reviewable.
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).
bool RequirePersonalNumber
If personal number is required in applications for them to be peer-reviewable.
override Task< string > Title(Language Language)
Gets a title for the system configuration.
bool RequireAddress
If address is required in applications for them to be peer-reviewable.
const string BROKER_REVIEW_COUNTRY
If country is required in a peer review(true or 1), or not(false or 0).
bool RequireLastName
If last names is/are is required in applications for them to be peer-reviewable.
bool RequireArea
If area is required in applications for them to be peer-reviewable.
const string BROKER_REVIEW_AREA
If area is required in a peer review(true or 1), or not(false or 0).
bool RequireGender
If gender is required in applications for them to be peer-reviewable.
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...