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

@@ -138,5 +138,3 @@ nothing to do with business stuff or actual business data
- EditOwn is really not about editown it's about supporting a user who is not supposed to see any data other than the bare minimum in order to fill out workorders
- Make it a business rule(s) instead in the areas of workorders and anything specific
- Get rid of edit own rights code entirely
- this might mean can clean up ownerID stuff in objects?

View File

@@ -6,16 +6,23 @@ Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTQ3NTgwMzg2IiwiZXhwIjoi
## IMMEDIATE ITEMS
Do I need ownerId for anything if it's not being used anymore for rules??
- Get rid of it in all rights stuff first, then widget then the rest and rename for the below specific things to UserId instead
- DataFilter uses it for a different purpose in that there are public and private filters
- After removing everywhere else maybe if this is the only holdout rename the field to userID or something?
- Semantically makes more sense
- Also helps so we can have no remnants of ownerId anywhere to make it easier to see what's been fixed / changed.
- EventLog uses it to log people's changes so an eventlog entry might be owned by Jim but it refers to an action Jim made on another object such as edit it maybe
- Could be renamed to UserId as well
- Event object uses it see eventlog above
- FormCustom uses it much like DataFilter does, could also be renamed to UserId and semantically be better
Remove OwnerId
- DONE Get rid of it in all rights stuff first
- Remove OwnerId for objects that don't require it anymore
- DONE Widget
- DONE Locale
- DONE User
- UserOptions remove but also has a bit below
- ValidateJsonPatch
- FileAttachment
- Rename OwnerId to UserId for those objects that require it still
- DataFilter
- EventLog
- Event object uses it see eventlog above
- FormCustom uses it much like DataFilter does, could also be renamed to UserId and semantically be better
- UserOptions (rename to userID)
- OpsJob (might be removable?)
OwnerID is put on httpcontext in startup.cs, will it still be necessary?
Clean up owner ID and rules now that it's deprecated

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)");