Hi! I have a question on custom roles. I’ve set up my admin role as:
db.createRole({role: "mydbAdmin", privileges: [], roles: [{role: "userAdmin", db: "admin"}, {role: "dbAdmin", db: "admin"}, {role: "readWrite", db: "admin"}, {role: "dbAdmin", db: "mydb"}, {role: "readWrite", db: "mydb"}]});
and generic user role as:
db.createRole({role: "mydbUser", privileges: [{resource: {db: "admin", collection: ""}, actions: ["changeOwnPassword", "changeOwnCustomData"]} ], roles: [{role: "readWrite", db: "mydb"}]});
Although my custom admin role works on user creation, deletion, granting and revoking roles. I can’t seem to use the updateUser feature to replace user roles. Any attempt to do so results in:uncaught exception: Error: Updating user failed: not authorized on admin to execute command
strangely, when I switch to an account with the *AnyDatabase roles, I have no problems executing the “updateUser” above. All users are created in the admin database. Any pointers on getting the right credentials to execute “updateUser” would be greatly appreciated!
Thanks in advanced!
Suresh