Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
GetApplicationAttributes.cs
1using Paiwise;
2using System;
4using System.Threading.Tasks;
5using System.Xml;
6using Waher.Content;
10using Waher.Script;
13
15{
20 {
25 : base("Legal/GetApplicationAttributes",
26 new KeyValuePair<Type, Expression>(typeof(Dictionary<string, object>), new Expression(jsonPattern)),
27 new KeyValuePair<Type, Expression>(typeof(XmlDocument), new Expression(xmlPattern)))
28 {
29 }
30
31 private static readonly string jsonPattern = Resources.LoadResourceAsText(typeof(GetApplicationAttributes).Namespace + ".JSON.GetApplicationAttributes.req");
32 private static readonly string xmlPattern = Resources.LoadResourceAsText(typeof(GetApplicationAttributes).Namespace + ".XML.GetApplicationAttributes.req");
33
42 public override async Task POST(HttpRequest Request, HttpResponse Response, Dictionary<string, IElement> Parameters)
43 {
45
46 List<string> Required = new List<string>();
47 bool LocalOrTest = string.IsNullOrEmpty(DomainConfiguration.Instance?.Domain);
48 bool PeerReview = PeerReviewConfiguration.Instance?.AllowPeerReview ?? false;
49
50 if (PeerReview)
51 {
54
57
60
63
65 Required.Add(PersonalInformation.AddressTag);
66
69
71 Required.Add(PersonalInformation.AreaTag);
72
74 Required.Add(PersonalInformation.CityTag);
75
77 Required.Add(PersonalInformation.RegionTag);
78
80 Required.Add(PersonalInformation.CountryTag);
81
84
86 Required.Add(PersonalInformation.GenderTag);
87
89 {
90 Required.Add(PersonalInformation.BirthDayTag);
93 }
94 }
95 else if (LocalOrTest)
96 {
97 PeerReview = true;
101 Required.Add(PersonalInformation.AddressTag);
103 Required.Add(PersonalInformation.CityTag);
104 Required.Add(PersonalInformation.CountryTag);
105 }
106
108 {
109 { "peerReview", PeerReview },
110 { "nrReviewers", PeerReviewConfiguration.Instance?.NrReviewersToApprove ?? (LocalOrTest ? 2 : 0) },
111 { "nrPhotos", PeerReviewConfiguration.Instance?.NrPhotosRequired ?? (LocalOrTest ? 1 : 0)},
112 { "iso3166", PeerReviewConfiguration.Instance?.RequireIso3166Compliance ?? LocalOrTest },
113 { "Required", Required.ToArray() }
114 };
115
116 await Response.Return(Result);
117 }
118 }
119}
Contains personal information found in a legal identity.
const string NationalityTag
NATIONALITY
const string MiddleNamesTag
MIDDLE
const string CountryTag
COUNTRY
const string BirthMonthTag
BMONTH
A Named dictionary is a dictionary, with a local name and a namespace. Use it to return content that ...
static DomainConfiguration Instance
Current instance of configuration.
Represents an HTTP request.
Definition: HttpRequest.cs:22
Represets a response of an HTTP client request.
Definition: HttpResponse.cs:23
Task Return(Exception ex)
Returns an error to the client.
Static class managing loading of resources stored as embedded resources or in content files.
Definition: Resources.cs:13
static string LoadResourceAsText(string ResourceName)
Loads a text resource from an embedded resource.
Definition: Resources.cs:55
Class managing a script expression.
Definition: Expression.cs:41
Provides the user configuration options regarding peer-review of new legal identities.
bool AllowPeerReview
If peer-review is allowed on the broker.
bool RequireFirstName
If first name is required in applications for them to be peer-reviewable.
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.
bool RequirePostalCode
If postal code is required in applications for them to be peer-reviewable.
bool RequireCity
If city is required in applications for them to be peer-reviewable.
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...
bool RequireCountry
If country is required in applications for them to be peer-reviewable.
bool RequirePersonalNumber
If personal number is required in applications for them to be peer-reviewable.
bool RequireAddress
If address is required in applications for them to be peer-reviewable.
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.
bool RequireGender
If gender is required in applications for them to be peer-reviewable.
Abstract base class for agent resources supporting the POST method.
static AccountUser AssertUserAuthenticated(HttpRequest Request)
Makes sure the request is made by an authenticated API user.
const string AgentNamespace
https://waher.se/Schema/BrokerAgent.xsd