How to create a account with a password set as a fixture in the server


#1

I need to create a admin account so i am giving one accounts id the ability to post and remove comments. How do i set the password and id. Or what is a better way of doing this. thanks.


#2

Hi, I’m not quite sure what you’re looking to accomplish. Is it:

  • have an admin user, who enabled other users, and
  • have regular users, who can comment if the admin user enables them?

If that’s the case, you’ll want to add a package that implements user roles (or do it yourself). Whenever you write a function that only an admin should be able to call, check that the calling user is actually an admin. Of course, you’ll want to do these checks server-side.

Make sense?