Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6246

Manipulate user objects exclusively via commands

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.3
    • Affects Version/s: None
    • Component/s: Security
    • Labels:
      None
    • Major Change

      Rather than using CRUD operations on db.system.users collections, user objects will be manipulated via commands:

      db.runCommand({
        createUser: 1,
        user: "spencer",
        password: "clear password",  // Unless "db" is "$external"
        extraData: <optional opaque Object>
        roles: [ { name: "roleName", db: "roleDB", canDelegate: <Boolean> }, ... ]
      });
      
      db.runCommand({
        updateUser: 1,
        user: "spencer",
        password: "new password clear",  // Optional
        extraData: <Object>, // Optional
      });
      
      db.runCommand({  deleteUser: 1, user: "spencer" });
      
      db.runCommand({
        grantRolesToUser: 1,
        user: "spencer",
        db: "somedb",  // Should this default to the db this command is targeted at?
        roles: [ { name: "roleName", db: "roleDB", canDelegate: <Boolean> }, ...]
      });
      
      db.runCommand({
        revokeRolesForUser: 1,  // Who can do this?
        user: "spencer",
        db: "somedb",  // Should this default to the db this command is targeted at?
        roles: [ { name: "roleName", db: "roleDB", canDelegate: <Boolean> }, ...]
      });
      
      db.runCommand({ usersInfo: 1, [userName: "spencer"] })
      

            Assignee:
            spencer@mongodb.com Spencer Brody (Inactive)
            Reporter:
            spencer@mongodb.com Spencer Brody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: