I will notify you, when I finish add things that you requested
I plan to finish it during this day
I will notify you, when I finish add things that you requested
I plan to finish it during this day
Hi, Robert!
Current project status: for the last days Iāve done:
To do:
What else I have to do? Your proposals?
Thanks, Dmytro.
What is Notifications for? I donāt want to modify the user and send a needless email. Just tell me it was successful, thatās enough. If Iām editing the user, that means they have a helpdesk case and I will communicate there.
I mean, popup windows on the admin page after update/delete actions
Oh, okay, that makes much more sense
Implemented next options:
Also, I found some bug:
when I am calling
UserSchema.update({ _id: user._id }, user)
user data successfully updated in Mongo, but not in LDAP. Itās looks like that when we calling āupdateā āpresaveā hook didnāt called. So, what is the right way to update user in Mongo, to call āpresaveā hook?
Itās funny to see, that our discussion became one of the most replied on OpenMRS Talk
Try calling save
.
It makes sense since weāve been among the few that actually had all communication this summer in the open, and in a fully transparent manner, which is the way Open Source projects should be done! For that, I actually am happy.
I tried that before, but always get an error:
[2016-08-18 08:54:54.389] [INFO] console - { [MongoError: insertDocument :: caused by :: 11000 E11000 duplicate key error index: openmrsid.users.$_id_ dup key: { : ObjectId('57b0dd6aaa37171a002a917e') }] name: 'MongoError', code: 11000, err: 'insertDocument :: caused by :: 11000 E11000 duplicate key error index: openmrsid.users.$_id_ dup key: { : ObjectId(\'57b0dd6aaa37171a002a917e\') }' } MongoError: insertDocument :: caused by :: 11000 E11000 duplicate key error index: openmrsid.users.$_id_ dup key: { : ObjectId('57b0dd6aaa37171a002a917e') } at Object.toError (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/utils.js:114:11) at /home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/collection/core.js:116:29 at /home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1197:7 at /home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1905:9 at Server.Base._callHandler (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:453:41) at /home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:488:18 at MongoReply.parseBody (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5) at null.<anonymous> (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:446:20) at emitOne (events.js:90:13) at emit (events.js:182:7) at null.<anonymous> (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:207:13) at emitTwo (events.js:100:13) at emit (events.js:185:7) at Socket.<anonymous> (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:440:22) at emitOne (events.js:90:13) at Socket.emit (events.js:182:7)
So, it looks like that save
can be used only for creating NEW documents, not for update.
I see only one solution to fix that - call ldap.updateUser manually after User.update();
UPD - found another - call Model.findOne, and than save
What does the ālockedā property in Mongo scheme means? I believe, when user is ālockedā we cannot update most his properties (username, primaryEmail, firstName, lastName, displayName, password), because they are stored in LDAP
the locked property is initially set when a user registers but does not verify their account; once they verify their account, it is toggled to false.
We cannot change usernames, we SHOULD be able to change other things though. Iāve changed peopleās primary emails ā in fact you can do that now in dashboard. You can also change your nameā¦The only immutable thing you CANNOT change is username.
I registered multiple users, activated them via email links, but property ālockedā left ātrueā for most of them. Is it a bug?
That should not beā¦locked should be false once you verify.
Found a problem on my side, fixed. Thanks for you answer)
But what about if admin manually set ālockedā to true? While itās locked, we must disable option to edit user fields? Or just unset flag ālockedā before save?
If it is locked, we should be able to unlock it BUT if we do that ā it should add the groups for us. It might be worthwhile to disable the text fields if theyāre locked.
Soon as I unlock, the text fields should be editable
Also FYI, you donāt have to allow for creating new users ā itās a nice to have but not entirely necessary as itās something we rarely ever do, if at all.
Okay, thanks
Another question - for now, we have boolean fields (inLDAP, locked) in database, but on UI I dispplay them as āYes/Noā, so I should convert them when getting from server from boolean to string, and vice versa when send them to server. Is it possible to left them boolean even on UI (will be displayed in Table as ātrue/falseā) to throw out converting? Later we can thought about how to display them on UI in more nice way
I kinda like the idea of the sliderā¦ itās clear to me ā so long as itās intuitive, use your judgement. Iām going to sleep.
Thanks for the tips! Good night
Can you explain, why this error can happen?
[2016-08-19 00:08:39.267] [ERROR] discourse-sso - [Error: options.uri is a required argument] Error: options.uri is a required argument at Request.init (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/request/request.js:233:31) at new Request (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/request/request.js:129:8) at request (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/request/index.js:55:10) at syncUser (/home/invercity/projects/webstorm/openmrs-contrib-id/app/user-modules/openmrs-contrib-id-sso/lib/discourse.js:50:3) at model.<anonymous> (/home/invercity/projects/webstorm/openmrs-contrib-id/app/user-modules/openmrs-contrib-id-sso/lib/discourse.js:80:3) at emitTwo (events.js:92:20) at model.emit (events.js:172:7) at handleSave (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/lib/model.js:132:10) at /home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/lib/utils.js:408:16 at /home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/collection/core.js:128:9 at /home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1197:7 at /home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1905:9 at Server.Base._callHandler (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:453:41) at /home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:488:18 at MongoReply.parseBody (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5) at null.<anonymous> (/home/invercity/projects/webstorm/openmrs-contrib-id/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:446:20)
It appears when I am trying to save NEW user to Mongo (if user exists in ldap but not in Mongo). Error appears, but user saved successfully
Also ,question: if user is missed in Mongo, but exists in LDAP, should it be locked after saving to Mongo? Or make it unlocked automatically (with adding basic groups)?