joozh 发表于 2018-10-27 06:08:31

mongo db 学习笔记 之二: mongodb 用户认证

> db.runCommand( { rolesInfo: 1, showPrivileges: 1 } )  
{
  
    "roles" : [
  
      {
  
            "role" : "bruceAdmin",
  
            "db" : "admin",
  
            "isBuiltin" : false,
  
            "roles" : [
  
                {
  
                  "role" : "read",
  
                  "db" : "admin"
  
                }
  
            ],
  
            "inheritedRoles" : [
  
                {
  
                  "role" : "read",
  
                  "db" : "admin"
  
                }
  
            ],
  
            "privileges" : [
  
                {
  
                  "resource" : {
  
                        "cluster" : true
  
                  },
  
                  "actions" : [
  
                        "addShard"
  
                  ]
  
                },
  
                {
  
                  "resource" : {
  
                        "db" : "config",
  
                        "collection" : ""
  
                  },
  
                  "actions" : [
  
                        "find",
  
                        "insert",
  
                        "update"
  
                  ]
  
                },
  
                {
  
                  "resource" : {
  
                        "db" : "users",
  
                        "collection" : "usersCollection"
  
                  },
  
                  "actions" : [
  
                        "update"
  
                  ]
  
                },
  
                {
  
                  "resource" : {
  
                        "db" : "",
  
                        "collection" : ""
  
                  },
  
                  "actions" : [
  
                        "find"
  
                  ]
  
                }
  
            ],
  
            "inheritedPrivileges" : [
  
                {
  
                  "resource" : {
  
                        "cluster" : true
  
                  },
  
                  "actions" : [
  
                        "addShard"
  
                  ]
  
                },
  
                {
  
                  "resource" : {
  
                        "db" : "config",
  
                        "collection" : ""
  
                  },
  
                  "actions" : [
  
                        "find",
  
                        "insert",
  
                        "update"
  
                  ]
  
                },
  
                {
  
                  "resource" : {
  
                        "db" : "users",
  
                        "collection" : "usersCollection"
  
                  },
  
                  "actions" : [
  
                        "update"
  
                  ]
  
                },
  
                {
  
                  "resource" : {
  
                        "db" : "",
  
                        "collection" : ""
  
                  },
  
                  "actions" : [
  
                        "find"
  
                  ]
  
                },
  
                {
  
                  "resource" : {
  
                        "db" : "admin",
  
                        "collection" : ""
  
                  },
  
                  "actions" : [
  
                        "collStats",
  
                        "dbHash",
  
                        "dbStats",
  
                        "find",
  
                        "killCursors",
  
                        "planCacheRead"
  
                  ]
  
                },
  
                {
  
                  "resource" : {
  
                        "db" : "admin",
  
                        "collection" : "system.indexes"
  
                  },
  
                  "actions" : [
  
                        "collStats",
  
                        "dbHash",
  
                        "dbStats",
  
                        "find",
  
                        "killCursors",
  
                        "planCacheRead"
  
                  ]
  
                },
  
                {
  
                  "resource" : {
  
                        "db" : "admin",
  
                        "collection" : "system.js"
  
                  },
  
                  "actions" : [
  
                        "collStats",
  
                        "dbHash",
  
                        "dbStats",
  
                        "find",
  
                        "killCursors",
  
                        "planCacheRead"
  
                  ]
  
                },
  
                {
  
                  "resource" : {
  
                        "db" : "admin",
  
                        "collection" : "system.namespaces"
  
                  },
  
                  "actions" : [
  
                        "collStats",
  
                        "dbHash",
  
                        "dbStats",
  
                        "find",
  
                        "killCursors",
  
                        "planCacheRead"
  
                  ]
  
                }
  
            ]
  
      }
  
    ],
  
    "ok" : 1
  
}


页: [1]
查看完整版本: mongo db 学习笔记 之二: mongodb 用户认证