4using System.Threading.Tasks;
16 : base(
"/UpdateAccount")
20 public override bool HandlesSubPaths =>
false;
21 public override bool UserSessions =>
true;
35 if (Content.
HasError || !(Content.
Decoded is Dictionary<string, string> Form))
48 bool CanRelayMessages;
58 if (!Form.ContainsKey(
"Password"))
61 Password = Form[
"Password"];
69 if (!Form.ContainsKey(
"PhoneNr"))
75 PhoneNr = Form[
"PhoneNr"];
77 if (!Form.ContainsKey(
"Enabled"))
85 if (!Form.ContainsKey(
"CanRelayMessages"))
86 CanRelayMessages =
false;
93 if (!Form.ContainsKey(
"FtpRootFolder"))
99 FtpRootFolder = Form[
"FtpRootFolder"];
100 if (!
string.IsNullOrEmpty(FtpRootFolder) && !Directory.Exists(FtpRootFolder))
108 if (!Form.ContainsKey(
"FtpMaxStorage"))
109 FtpMaxStorage =
null;
112 string s = Form[
"FtpMaxStorage"];
114 if (
string.IsNullOrEmpty(s))
115 FtpMaxStorage =
null;
116 else if (!
long.TryParse(Form[
"FtpMaxStorage"], out
long l) || l < 0)
125 if (!Form.ContainsKey(
"FtpCanRead"))
133 if (!Form.ContainsKey(
"FtpCanWrite"))
141 if ((FtpCanRead || FtpCanWrite) &&
string.IsNullOrEmpty(FtpRootFolder))
147 if (!Form.TryGetValue(
"Roles", out
string Roles))
148 Roles =
string.Empty;
150 RoleIds = Roles.Split(
CommonTypes.
CRLF, StringSplitOptions.RemoveEmptyEntries);
160 if (!
string.IsNullOrEmpty(Password))
161 Account.Password = Password;
165 Account.EMail = EMail;
166 Account.EMailVerified =
null;
171 Account.PhoneNr = PhoneNr;
172 Account.PhoneNrVerified =
null;
175 Account.Enabled = Enabled;
176 Account.CanRelayMessages = CanRelayMessages;
177 Account.FtpRootFolder = FtpRootFolder;
178 Account.FtpMaxStorage = FtpMaxStorage;
179 Account.FtpCanRead = FtpCanRead;
180 Account.FtpCanWrite = FtpCanWrite;
181 Account.RoleIds = RoleIds;
182 Account.Updated = DateTime.UtcNow;
Helps with parsing of commong data types.
static readonly char[] CRLF
Contains the CR LF character sequence.
static bool TryParse(string s, out double Value)
Tries to decode a string encoded double.
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.
The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repe...
Represents an HTTP request.
HttpRequestHeader Header
Request header.
bool HasData
If the request has data.
async Task< ContentResponse > DecodeDataAsync()
Decodes data sent in request.
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...
Base class for all synchronous HTTP resources. A synchronous resource responds within the method hand...
The server has not found anything matching the Request-URI. No indication is given of whether the con...
The response to the request can be found under a different URI and SHOULD be retrieved using a GET me...
Represents a case-insensitive string.
static bool IsNullOrEmpty(CaseInsensitiveString value)
Indicates whether the specified string is null or an CaseInsensitiveString.Empty string.
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 broker account.
CaseInsensitiveString EMail
E-mail address associated with account.
CaseInsensitiveString PhoneNr
Phone number associated with account.
async Task POST(HttpRequest Request, HttpResponse Response)
Executes the POST method on the resource.
bool AllowsPOST
If the POST method is allowed.
POST Interface for HTTP resources.