Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db.users.drop() causes trouble #20

Open
ile opened this issue Feb 18, 2013 · 3 comments
Open

db.users.drop() causes trouble #20

ile opened this issue Feb 18, 2013 · 3 comments

Comments

@ile
Copy link

ile commented Feb 18, 2013

db.users.drop() seems to cause problems - the code (derby-auth) assumes that everything is ok when the sess.userId is set, but actually the database can be empty, which isn't noticed that that point (https://github.com/lefnire/derby-auth/blob/master/index.js#L64), and it will lead to problems afterwards.

The client has to have a cookie set in order the sess.userId to be set (of course).

@lefnire
Copy link
Owner

lefnire commented Feb 18, 2013

Hit me up with a PR if you can think of a work around, or any suggestions
on handling configurable collection name?

On Mon, Feb 18, 2013 at 6:30 PM, Ilkka Huotari notifications@github.comwrote:

db.users.drop() seems to cause problems - the code (derby-auth) assumes
that everything is ok when the sess.userId is set, but actually the
database can be empty, which isn't noticed that that point (
https://github.com/lefnire/derby-auth/blob/master/index.js#L64), and it
will lead to problems afterwards.


Reply to this email directly or view it on GitHubhttps://github.com//issues/20.

@ile
Copy link
Author

ile commented Feb 18, 2013

Not sure, but should it just do a model.fetch around that point (line 64)? Of course an extra model.fetch feels bad though...

In the app code there will probably be this: model.set '_user', user

... would it be wise to do that at the derby-auth level already?

Just some ideas, I really don't know what's best here..

@ile
Copy link
Author

ile commented Feb 19, 2013

Here's one way to do it (maybe): ile@5207118

(A bit too much code got in. I'm also making hooks for users_public collection because I think that's what I need... By querying users_public I get a hash array and not a normal array like with motifs .... so maybe a PR isn't a good idea with this commit)

You can decide what to do with this, copy & paste or improve or anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants