Skip to content

feature: User Lockout #4749

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

Merged
merged 3 commits into from
May 16, 2018
Merged

feature: User Lockout #4749

merged 3 commits into from
May 16, 2018

Conversation

flovilmart
Copy link
Contributor

Is is possible that a user request to have it's data removed from the database. In order to provide a good experience, an administrator should be able to lock the account out.

  • If the user was logged in with username / password, the login calls should fail, but a new account with the same username can't be created again till the _User object is destroyed
  • If the user was logged in with 3rd party auth, any subsequent login would re-create a new account.

In order to lock a user out, it now is allowed to have masterKey only User objects. In those cases, the account will be consider locked out.

@flovilmart flovilmart requested review from acinader and dplewis May 7, 2018 20:12
@codecov
Copy link

codecov bot commented May 7, 2018

Codecov Report

Merging #4749 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4749      +/-   ##
==========================================
+ Coverage   92.61%   92.62%   +0.01%     
==========================================
  Files         119      119              
  Lines        8585     8588       +3     
==========================================
+ Hits         7951     7955       +4     
+ Misses        634      633       -1
Impacted Files Coverage Δ
src/Routers/UsersRouter.js 93.12% <100%> (+0.1%) ⬆️
src/RestWrite.js 93.06% <100%> (+0.01%) ⬆️
src/Routers/PushRouter.js 96.42% <0%> (+3.57%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3e5b20...90b051e. Read the comment docs.

@acinader
Copy link
Contributor

acinader commented May 8, 2018

@flovilmart this looks good to me.

I just did a quick first pass. I'm going to digest and take another look.

@acinader
Copy link
Contributor

acinader commented May 8, 2018

so this looks good to me but needs better comment and doc.

"masterKey only User objects" maybe instead of that, just call it a 'locked user' and you can mention the master key in the doc, but for the name, I think either 'locked user' or 'locked out user'.

@flovilmart
Copy link
Contributor Author

@acinader that's in my plan to add the docs before merging this one, I'll update them soon enough so we can get moving forward with that! Thanks for the review!

@@ -114,6 +114,12 @@ export class UsersRouter extends ClassesRouter {
if (!isValidPassword) {
throw new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'Invalid username/password.');
}
// Ensure the user isn't locked out
// A locked out user won't be able to login
// To lock a user out, just set the ACL to `masterKey` only ({}).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment could be more clear.

would also be nice to update the documentation (sorry if you already have a sep pr for that, I haven't looked this pass).

@flovilmart flovilmart merged commit ad244d6 into master May 16, 2018
@flovilmart flovilmart deleted the feature/user-lockout branch May 16, 2018 19:40
UnderratedDev pushed a commit to UnderratedDev/parse-server that referenced this pull request Mar 21, 2020
* Allows masterKey to lock _User object and prevent login with email / password

* Ensure the authData based auth can be locked out as well when accounts is masterKey only
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

Successfully merging this pull request may close these issues.

2 participants