|
1 | 1 | // -------------------------------------------------------------------------------------------------------------------- |
2 | 2 | // <copyright file="AuthenticationDao.cs" company="RHEA System S.A."> |
3 | | -// Copyright (c) 2016 RHEA System S.A. |
| 3 | +// Copyright (c) 2015-2021 RHEA System S.A. |
| 4 | +// |
| 5 | +// Author: Sam Gerené, Merlin Bieze, Alex Vorobiev, Naron Phou, Alexander van Delft. |
| 6 | +// |
| 7 | +// This file is part of CDP4 Web Services Community Edition. |
| 8 | +// The CDP4 Web Services Community Edition is the RHEA implementation of ECSS-E-TM-10-25 Annex A and Annex C. |
| 9 | +// This is an auto-generated class. Any manual changes to this file will be overwritten! |
| 10 | +// |
| 11 | +// The CDP4 Web Services Community Edition is free software; you can redistribute it and/or |
| 12 | +// modify it under the terms of the GNU Affero General Public |
| 13 | +// License as published by the Free Software Foundation; either |
| 14 | +// version 3 of the License, or (at your option) any later version. |
| 15 | +// |
| 16 | +// The CDP4 Web Services Community Edition is distributed in the hope that it will be useful, |
| 17 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 | +// Lesser General Public License for more details. |
| 20 | +// |
| 21 | +// You should have received a copy of the GNU Affero General Public License |
| 22 | +// along with this program. If not, see <http://www.gnu.org/licenses/>. |
4 | 23 | // </copyright> |
5 | 24 | // -------------------------------------------------------------------------------------------------------------------- |
6 | 25 |
|
@@ -74,37 +93,38 @@ public IEnumerable<AuthenticationPerson> Read(NpgsqlTransaction transaction, str |
74 | 93 | /// </returns> |
75 | 94 | private AuthenticationPerson MapToDto(NpgsqlDataReader reader) |
76 | 95 | { |
77 | | - string tempIsActive; |
78 | | - string tempPassword; |
79 | | - string tempSalt; |
80 | | - string tempShortName; |
81 | | - |
82 | 96 | var valueDict = (Dictionary<string, string>)reader["ValueTypeSet"]; |
83 | 97 | var iid = Guid.Parse(reader["Iid"].ToString()); |
84 | 98 | var revisionNumber = int.Parse(valueDict["RevisionNumber"]); |
85 | | - |
86 | | - var dto = new AuthenticationPerson(iid, revisionNumber); |
87 | 99 |
|
88 | | - dto.Role = reader["Role"] is DBNull ? (Guid?)null : Guid.Parse(reader["Role"].ToString()); |
89 | | - dto.DefaultDomain = reader["DefaultDomain"] is DBNull? (Guid?)null : Guid.Parse(reader["DefaultDomain"].ToString()); |
90 | | - dto.Organization = reader["Organization"] is DBNull ? (Guid?)null : Guid.Parse(reader["Organization"].ToString()); |
| 100 | + var dto = new AuthenticationPerson(iid, revisionNumber) |
| 101 | + { |
| 102 | + Role = reader["Role"] is DBNull ? (Guid?) null : Guid.Parse(reader["Role"].ToString()), |
| 103 | + DefaultDomain = reader["DefaultDomain"] is DBNull ? (Guid?) null : Guid.Parse(reader["DefaultDomain"].ToString()), |
| 104 | + Organization = reader["Organization"] is DBNull ? (Guid?) null : Guid.Parse(reader["Organization"].ToString()) |
| 105 | + }; |
91 | 106 |
|
92 | | - if (valueDict.TryGetValue("IsActive", out tempIsActive)) |
| 107 | + if (valueDict.TryGetValue("IsActive", out var tempIsActive)) |
93 | 108 | { |
94 | 109 | dto.IsActive = bool.Parse(tempIsActive); |
95 | 110 | } |
96 | 111 |
|
97 | | - if (valueDict.TryGetValue("Password", out tempPassword) && !string.IsNullOrEmpty(tempPassword)) |
| 112 | + if (valueDict.TryGetValue("IsDeprecated", out var tempIsDeprecated)) |
| 113 | + { |
| 114 | + dto.IsDeprecated = bool.Parse(tempIsDeprecated); |
| 115 | + } |
| 116 | + |
| 117 | + if (valueDict.TryGetValue("Password", out var tempPassword) && !string.IsNullOrEmpty(tempPassword)) |
98 | 118 | { |
99 | 119 | dto.Password = tempPassword.UnEscape(); |
100 | 120 | } |
101 | 121 |
|
102 | | - if (valueDict.TryGetValue("Salt", out tempSalt)) |
| 122 | + if (valueDict.TryGetValue("Salt", out var tempSalt)) |
103 | 123 | { |
104 | 124 | dto.Salt = tempSalt.UnEscape(); |
105 | 125 | } |
106 | 126 |
|
107 | | - if (valueDict.TryGetValue("ShortName", out tempShortName)) |
| 127 | + if (valueDict.TryGetValue("ShortName", out var tempShortName)) |
108 | 128 | { |
109 | 129 | // map shortname to UserName |
110 | 130 | dto.UserName = tempShortName.UnEscape(); |
|
0 commit comments