0

'm having some real trouble changing some user rights. Currently, we are trying to do an eval() function in a controlled way (basically through PHP's execute function: http://www.php.net/manual/en/mongodb.execute.php). I've enabled authentication and added some users:

admin = db.getSiblingDB('admin');
admin.addUser("superadmin", "somepass");
admin.auth("superadmin", "somepass");

bigdata = db.getSiblingDB('bigdata');
bigdata.addUser("datauser", "anotherpass");

How can I give the datauser the right permissions here?

Thank you.

Repox
  • 15,015
  • 8
  • 54
  • 79

1 Answers1

0

Since eval requires to be run by an admin user (yet another reason you shouldn't us JS in your client application) You assign those rights to the user ( http://docs.mongodb.org/manual/reference/user-privileges/#eval-shell-helper ), so the set you need are:

readWriteAnyDatabase, userAdminAnyDatabase, dbAdminAnyDatabase and clusterAdmin

So what your looking for is how to change the user rights to have these added roles for which you can see this related SO question: How do you change MongoDB user permissions?

Community
  • 1
  • 1
Sammaye
  • 43,242
  • 7
  • 104
  • 146