This commit is contained in:
2019-05-20 19:03:50 +00:00
parent 403b96670f
commit 7d11399574
7 changed files with 27 additions and 37 deletions

View File

@@ -65,7 +65,7 @@ namespace AyaNova.Biz
//replicate the source to a new dest and save
Locale NewLocale = new Locale();
NewLocale.Name = inObj.Name;
NewLocale.OwnerId = UserId;
NewLocale.Stock = false;
NewLocale.CjkIndex = false;
foreach (LocaleItem i in SourceLocale.LocaleItems)
@@ -571,8 +571,7 @@ namespace AyaNova.Biz
//have file name, have all localized text
Locale l = new Locale();
l.Name = SourceLocaleName;
l.OwnerId = 1;
l.Name = SourceLocaleName;
l.Stock = false;
foreach (KeyValuePair<string, string> K in NewLocaleDict)

View File

@@ -58,7 +58,7 @@ namespace AyaNova.Biz
inObj.Salt = Hasher.GenerateSalt();
inObj.Password = Hasher.hash(inObj.Salt, inObj.Password);
inObj.OwnerId = UserId;
inObj.Tags = TagUtil.NormalizeTags(inObj.Tags);
//Seeder sets user options in advance so no need to create them here in that case
if (inObj.UserOptions == null)
@@ -99,7 +99,7 @@ namespace AyaNova.Biz
//This is a new user so it will have been posted with a password in plaintext which needs to be salted and hashed
inObj.Salt = Hasher.GenerateSalt();
inObj.Password = Hasher.hash(inObj.Salt, inObj.Password);
inObj.OwnerId = UserId;
inObj.Tags = TagUtil.NormalizeTags(inObj.Tags);
//Seeder sets user options in advance so no need to create them here in that case
if (inObj.UserOptions == null)
@@ -256,9 +256,7 @@ namespace AyaNova.Biz
//put
internal bool Put(User dbObj, User inObj)
{
//preserve the owner ID if none was specified
if (inObj.OwnerId == 0)
inObj.OwnerId = dbObj.OwnerId;
//Get a snapshot of the original db value object before changes
User SnapshotOfOriginalDBObj = new User();
@@ -412,13 +410,6 @@ namespace AyaNova.Biz
//also check user count in general to see if it's exceeded
//And maybe check it in login as well as a good central spot or wherever makes sense
//OwnerId required
if (!isNew)
{
if (proposedObj.OwnerId == 0)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "OwnerId");
}
//Name required
if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
@@ -577,8 +568,7 @@ namespace AyaNova.Biz
return new
{
Id = o.Id,
ConcurrencyToken = o.ConcurrencyToken,
OwnerId = o.OwnerId,
ConcurrencyToken = o.ConcurrencyToken,
Active = o.Active,
Name = o.Name,
Roles = o.Roles,
@@ -723,8 +713,6 @@ namespace AyaNova.Biz
//Copy values
User i = new User();
//default owner id is manager account in RAVEN
i.OwnerId = 1;
i.Name = j["FirstName"].Value<string>() + " " + j["LastName"].Value<string>();
var Temp = j["UserType"].Value<int>();

View File

@@ -13,8 +13,7 @@ namespace AyaNova.Models
{
public long Id { get; set; }
public uint ConcurrencyToken { get; set; }
[Required]
public long OwnerId { get; set; }
[Required]
public string Name { get; set; }

View File

@@ -10,8 +10,7 @@ namespace AyaNova.Models
{
public long Id { get; set; }
public uint ConcurrencyToken { get; set; }
[Required]
public long OwnerId { get; set; }
[Required]
public bool Active { get; set; }
[Required, MaxLength(255)]

View File

@@ -148,7 +148,7 @@ namespace AyaNova.Util
exec("CREATE TABLE asearchkey (id BIGSERIAL PRIMARY KEY, wordid bigint not null REFERENCES asearchdictionary (id), objectid bigint not null, objecttype integer not null, inname bool not null)");
//create locale text tables
exec("CREATE TABLE alocale (id BIGSERIAL PRIMARY KEY, ownerid bigint not null, name varchar(255) not null, stock bool, cjkindex bool default false)");
exec("CREATE TABLE alocale (id BIGSERIAL PRIMARY KEY, name varchar(255) not null, stock bool, cjkindex bool default false)");
//LOOKAT: I don't think this is doing anything:
//exec("CREATE UNIQUE INDEX alocale_name_idx ON alocale (name)");
@@ -164,7 +164,7 @@ namespace AyaNova.Util
//Add user table
exec("CREATE TABLE auser (id BIGSERIAL PRIMARY KEY, ownerid bigint not null, active bool not null, name varchar(255) not null, " +
exec("CREATE TABLE auser (id BIGSERIAL PRIMARY KEY, active bool not null, name varchar(255) not null, " +
"login text not null, password text not null, salt text not null, roles integer not null, localeid bigint not null REFERENCES alocale (id), " +
"dlkey text, dlkeyexpire timestamp, usertype integer not null, employeenumber varchar(255), notes text, clientid bigint, " +
"headofficeid bigint, subvendorid bigint, customfields text, tags varchar(255) ARRAY)");