This commit is contained in:
2020-05-09 00:01:43 +00:00
parent 60a79bab63
commit 72540fa3e6
2 changed files with 14 additions and 10 deletions

View File

@@ -159,10 +159,10 @@ namespace AyaNova.Biz
dbObj.Salt = SnapshotOfOriginalDBObj.Salt; dbObj.Salt = SnapshotOfOriginalDBObj.Salt;
} }
//Updating login? //Updating login?
if (!string.IsNullOrWhiteSpace(inObj.Login)) if (!string.IsNullOrWhiteSpace(inObj.Login))
{ {
//YES Login is being updated: //YES Login is being updated:
dbObj.Login=inObj.Login; dbObj.Login = inObj.Login;
} }
else else
{ {
@@ -212,11 +212,11 @@ namespace AyaNova.Biz
dbObj.Password = Hasher.hash(dbObj.Salt, dbObj.Password); dbObj.Password = Hasher.hash(dbObj.Salt, dbObj.Password);
} }
//Updating login? //Updating login?
if (!string.IsNullOrWhiteSpace(dbObj.Login) && dbObj.Login != SnapshotOfOriginalDBObj.Login) if (!string.IsNullOrWhiteSpace(dbObj.Login) && dbObj.Login != SnapshotOfOriginalDBObj.Login)
{ {
//YES Login is being updated: //YES Login is being updated:
dbObj.Login=SnapshotOfOriginalDBObj.Login; dbObj.Login = SnapshotOfOriginalDBObj.Login;
} }
else else
{ {
@@ -364,7 +364,11 @@ namespace AyaNova.Biz
} }
} }
//LOGIN must be unique
if (await ct.User.AnyAsync(m => m.Login == proposedObj.Login && m.Id != proposedObj.Id))
{
AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "Login");
}
//TODO: Validation rules that require future other objects that aren't present yet: //TODO: Validation rules that require future other objects that aren't present yet:
/* /*

View File

@@ -23,7 +23,7 @@ namespace AyaNova.Util
private const int DESIRED_SCHEMA_LEVEL = 11; private const int DESIRED_SCHEMA_LEVEL = 11;
internal const long EXPECTED_COLUMN_COUNT = 272; internal const long EXPECTED_COLUMN_COUNT = 272;
internal const long EXPECTED_INDEX_COUNT = 118; internal const long EXPECTED_INDEX_COUNT = 119;
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
@@ -170,7 +170,7 @@ namespace AyaNova.Util
//Add user table //Add user table
await ExecQueryAsync("CREATE TABLE auser (id BIGSERIAL PRIMARY KEY, active bool not null, name varchar(255) not null unique, " + await ExecQueryAsync("CREATE TABLE auser (id BIGSERIAL PRIMARY KEY, active bool not null, name varchar(255) not null unique, " +
"login text not null, password text not null, salt text not null, roles integer not null, currentauthtoken text, " + "login text not null unique, password text not null, salt text not null, roles integer not null, currentauthtoken text, " +
"dlkey text, dlkeyexpire timestamp, usertype integer not null, employeenumber varchar(255), notes text, customerid bigint, " + "dlkey text, dlkeyexpire timestamp, usertype integer not null, employeenumber varchar(255), notes text, customerid bigint, " +
"headofficeid bigint, subvendorid bigint, wiki text null, customfields text, tags varchar(255) ARRAY)"); "headofficeid bigint, subvendorid bigint, wiki text null, customfields text, tags varchar(255) ARRAY)");