Skip to content

Cloud Code check for "admin rights" #4007

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

Closed
mginz83 opened this issue Jul 8, 2017 · 1 comment
Closed

Cloud Code check for "admin rights" #4007

mginz83 opened this issue Jul 8, 2017 · 1 comment

Comments

@mginz83
Copy link

mginz83 commented Jul 8, 2017

Parse.Cloud.define('adminLogin', function(request, response) {

	var username = request.params.username;
	var password = request.params.password;
	var emailPattern = request.params.emailPattern;
	var admin = false;
	
	Parse.User.logIn(username, password, {

		if (username.equals("EMAIL_ADDRESS_HERE")) {
			admin = true;
		}

  		success: function(user) {
    		// Do stuff after successful login.
  		},
  		error: function(user, error) {
    		// The login failed. Check error to see why.
  		}
	});

});

So, basically, what I want to happen is if a certain user tries to sign in, itll log in. For example, if I login with my email address and password, itll work.... however, if its anything OTHER than me, it fails....

I can easily do this inside of the application, but how is something like that done in cloud code?

I figure, if I put the code inside of success, then itll work regardless, and I dont want that. I want my cloudcode to determine if its me, if it is, were successful, if its not, we fail.

@natanrolnik
Copy link
Contributor

I'm closing this issue because we try to keep GitHub issues for issues and bugs specific of Parse Server.

Please use StackOverflow with the parse-server and parse-js-sdk tags, and post the link here for reference as well.

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