Skip to content

Commit 4ffbb4c

Browse files
committed
cleanup
1 parent 60cd702 commit 4ffbb4c

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

OpenFlow/src/DatabaseConnection.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -862,14 +862,8 @@ export class DatabaseConnection {
862862
if (exists2 != null) { throw new Error("Access denied, role '" + r.name + "' already exists"); }
863863
}
864864

865-
866865
span.setAttribute("collection", collectionname);
867866
span.setAttribute("username", user.username);
868-
869-
870-
// const options:CollectionInsertOneOptions = { writeConcern: { w: parseInt((w as any)), j: j } };
871-
// const options: CollectionInsertOneOptions = { w: w, j: j };
872-
//const options: CollectionInsertOneOptions = { w: "majority" };
873867
const options: CollectionInsertOneOptions = {};
874868
options.WriteConcern = {}; // new WriteConcern();
875869
options.WriteConcern.w = w;
@@ -1835,7 +1829,6 @@ export class DatabaseConnection {
18351829
}
18361830
const ot_end = Logger.otel.startTimer();
18371831
const mongodbspan: Span = Logger.otel.startSubSpan("mongodb.insertOne", span);
1838-
// await this.db.collection(q.collectionname + '_hist').insertOne(updatehist);
18391832
this.db.collection(q.collectionname + '_hist').insertOne(updatehist).then(() => {
18401833
Logger.otel.endSpan(mongodbspan);
18411834
Logger.otel.endTimer(ot_end, DatabaseConnection.mongodb_insert, { collection: q.collectionname + '_hist' });
@@ -1939,7 +1932,6 @@ export class DatabaseConnection {
19391932
}
19401933
const ot_end = Logger.otel.startTimer();
19411934
const mongodbspan: Span = Logger.otel.startSubSpan("mongodb.insertOne", span);
1942-
// await this.db.collection(collectionname + '_hist').insertOne(deltahist);
19431935
this.db.collection(collectionname + '_hist').insertOne(deltahist).then(() => {
19441936
Logger.otel.endSpan(mongodbspan);
19451937
Logger.otel.endTimer(ot_end, DatabaseConnection.mongodb_insert, { collection: collectionname + '_hist' });
@@ -1967,7 +1959,6 @@ export class DatabaseConnection {
19671959
}
19681960
const ot_end = Logger.otel.startTimer();
19691961
const mongodbspan: Span = Logger.otel.startSubSpan("mongodb.insertOne", span);
1970-
// await this.db.collection(collectionname + '_hist').insertOne(fullhist);
19711962
this.db.collection(collectionname + '_hist').insertOne(fullhist).then(() => {
19721963
Logger.otel.endSpan(mongodbspan);
19731964
Logger.otel.endTimer(ot_end, DatabaseConnection.mongodb_insert, { collection: collectionname + '_hist' });

OpenFlow/src/LoginProvider.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,9 @@ export class LoginProvider {
994994
}
995995
user = new User(); user.name = username; user.username = username;
996996
await Crypt.SetPassword(user, password, span);
997-
user = await Config.db.InsertOne(user, "users", 0, false, Crypt.rootToken(), span);
997+
const jwt: string = Crypt.rootToken();
998+
user = await DBHelper.ensureUser(jwt, user.name, user.username, null, null, span);
999+
9981000
const admins: Role = await DBHelper.FindRoleByName("admins", span);
9991001
admins.AddMember(user);
10001002
await DBHelper.Save(admins, Crypt.rootToken(), span)
@@ -1141,7 +1143,6 @@ export class LoginProvider {
11411143
(_user as any).mobile = profile["http://schemas.xmlsoap.org/ws/2005/05/identity/claims/mobile"];
11421144
}
11431145
if (NoderedUtil.IsNullEmpty(_user.name)) { done("Cannot add new user, name is empty, please add displayname to claims", null); return; }
1144-
// _user = await Config.db.InsertOne(_user, "users", 0, false, Crypt.rootToken());
11451146
const jwt: string = Crypt.rootToken();
11461147
_user = await DBHelper.ensureUser(jwt, _user.name, _user.username, null, null, span);
11471148
}

0 commit comments

Comments
 (0)