Skip to content

fixes to user & role reference docs #1382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions source/includes/fact-roles-array-contents.rst

This file was deleted.

5 changes: 4 additions & 1 deletion source/reference/command/createRole-field.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ name: roles
type: array
position: 3
description: |
Roles from which this role inherits privileges.
Roles from which this role inherits privileges. You can specify both
:ref:`system-defined roles <system-user-roles>` and :ref:`user-defined
role <user-defined-roles>`. For the syntax of a role, see the
:data:`~admin.system.roles.roles` array.
---
object:
name: createRole
Expand Down
22 changes: 3 additions & 19 deletions source/reference/command/createRole.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,9 @@ Definition

.. include:: /reference/command/createRole-field.rst

.. TODO rename section (or make it subsection or something)

Considerations
--------------

``privileges`` Field
~~~~~~~~~~~~~~~~~~~~

The ``privileges`` field must be present. If you choose not to specify
privileges, you must provide an empty array.

``roles`` Field
~~~~~~~~~~~~~~~

The ``roles`` fields must be present. If you choose not to specify
any roles, you must provide an empty array.

.. |local-cmd-name| replace:: :dbcommand:`createRole`
.. include:: /includes/fact-roles-array-contents.rst
.. important:: Both the ``privileges`` array and ``roles`` array must be
present. If you choose not to specify one or the other, or both, you
must provide empty arrays.

Required Access
---------------
Expand Down
17 changes: 12 additions & 5 deletions source/reference/command/createUser-field.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ name: pwd
type: string
position: 2
description: |
The user's password. The ``pwd`` field is not
required if you run |local-cmd-name| on the ``$external``
database to create users who have credentials stored externally to
MongoDB. See :ref:`createUser-pwd-field-consideration`.
The user's password. The command sends the password to the MongoDB
instance in cleartext. To encrypt the password in transit, use :doc:`SSL
</tutorial/configure-ssl>`. The ``pwd`` field is not required if you run
this command on the ``$external`` database. Users created on the
``$external`` database should have credentials stored externally to
MongoDB, as, for example, with :doc:`MongoDB Enterprise installations that
use Kerberos
</tutorial/control-access-to-mongodb-with-kerberos-authentication>`.
---
object:
name: createUser
Expand All @@ -48,7 +52,10 @@ name: roles
type: array
position: 4
description: |
The roles granted to the user.
The roles granted to the user. You can specify both :ref:`system-defined
roles <system-user-roles>` and :ref:`user-defined role
<user-defined-roles>`. For the syntax of a role, see the
:data:`~admin.system.users.roles` array.
---
object:
name: createUser
Expand Down
24 changes: 0 additions & 24 deletions source/reference/command/createUser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,6 @@ Definition
.. |local-cmd-name| replace:: :dbcommand:`createUser`
.. include:: /reference/command/createUser-field.rst

.. TODO rename section (or make it subsection or something)

Considerations
--------------

.. _createUser-pwd-field-consideration:

``pwd`` Field
~~~~~~~~~~~~~

:dbcommand:`createUser` sends password to the MongoDB instance in
cleartext. To encrypt the password in transit, use :doc:`SSL
</tutorial/configure-ssl>`.

Users created on the ``$external`` database should have credentials
stored externally to MongoDB, as, for example, with :doc:`MongoDB
Enterprise installations that use Kerberos
</tutorial/control-access-to-mongodb-with-kerberos-authentication>`.

``roles`` Field
~~~~~~~~~~~~~~~

.. include:: /includes/fact-roles-array-contents.rst

Required Access
---------------

Expand Down
5 changes: 4 additions & 1 deletion source/reference/command/grantRolesToRole-field.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ name: roles
type: array
position: 2
description: |
An array of roles from which to inherit.
An array of roles from which to inherit privileges. You can specify both
:ref:`system-defined roles <system-user-roles>` and :ref:`user-defined
role <user-defined-roles>`. For the syntax of a role, see the
:data:`~admin.system.roles.roles` array.
---
object:
name: grantRolesToRole
Expand Down
8 changes: 0 additions & 8 deletions source/reference/command/grantRolesToRole.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ Definition

.. include:: /reference/command/grantRolesToRole-field.rst

.. TODO rename section (or make it subsection or something)

Considerations
--------------

.. |local-cmd-name| replace:: :dbcommand:`grantRolesToRole`
.. include:: /includes/fact-roles-array-contents.rst

Required Access
---------------

Expand Down
5 changes: 4 additions & 1 deletion source/reference/command/grantRolesToUser-field.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ name: roles
type: array
position: 2
description: |
An array of additional roles to grant to the user.
An array of additional roles to grant to the user. You can specify both
:ref:`system-defined roles <system-user-roles>` and :ref:`user-defined
role <user-defined-roles>`. For the syntax of a role, see the
:data:`~admin.system.users.roles` array.
---
object:
name: grantRolesToUser
Expand Down
8 changes: 0 additions & 8 deletions source/reference/command/grantRolesToUser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ Definition

.. include:: /reference/command/grantRolesToUser-field.rst

.. TODO rename section (or make it subsection or something)

Considerations
--------------

.. |local-cmd-name| replace:: :dbcommand:`grantRolesToUser`
.. include:: /includes/fact-roles-array-contents.rst

Required Access
---------------

Expand Down
3 changes: 2 additions & 1 deletion source/reference/command/revokeRolesFromRole-field.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ name: roles
type: array
position: 2
description: |
The inherited roles to remove.
The inherited roles to remove. For the syntax of a role, see the
:data:`~admin.system.roles.roles` array.
---
object:
name: revokeRolesFromRole
Expand Down
3 changes: 0 additions & 3 deletions source/reference/command/revokeRolesFromRole.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ Definition

.. include:: /reference/command/revokeRolesFromRole-field.rst

.. |local-cmd-name| replace:: :dbcommand:`revokeRolesFromRole`
.. include:: /includes/fact-roles-array-contents.rst

Required Access
---------------

Expand Down
5 changes: 4 additions & 1 deletion source/reference/command/revokeRolesFromUser-field.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ name: roles
type: array
position: 2
description: |
The roles to remove from the user.
The roles to remove from the user. You can specify both
:ref:`system-defined roles <system-user-roles>` and :ref:`user-defined
role <user-defined-roles>`. For the syntax of a role, see the
:data:`~admin.system.users.roles` array.
---
object:
name: revokeRolesFromUser
Expand Down
8 changes: 0 additions & 8 deletions source/reference/command/revokeRolesFromUser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ Definition

.. include:: /reference/command/revokeRolesFromUser-field.rst

.. TODO rename section (or something)

Considerations
--------------

.. |local-cmd-name| replace:: :dbcommand:`revokeRolesFromUser`
.. include:: /includes/fact-roles-array-contents.rst

Required Access
---------------

Expand Down
7 changes: 4 additions & 3 deletions source/reference/command/updateRole-field.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ name: roles
type: array
position: 3
description: |
Required if you do not specify :data:`~admin.system.roles.privileges` array.
The roles from which this role inherits privileges. An update to the
``roles`` array overrides the previous array's values.
Required if you do not specify :data:`~admin.system.roles.privileges`
array. The roles from which this role inherits privileges. An update to
the ``roles`` array overrides the previous array's values. For the syntax
of a role, see the :data:`~admin.system.roles.roles` array.
---
object:
name: updateRole
Expand Down
6 changes: 0 additions & 6 deletions source/reference/command/updateRole.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ Definition

.. include:: /reference/command/updateRole-field.rst

``roles`` Field
---------------

.. |local-cmd-name| replace:: :dbcommand:`updateRole`
.. include:: /includes/fact-roles-array-contents.rst

Required Access
---------------

Expand Down
11 changes: 8 additions & 3 deletions source/reference/command/updateUser-field.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ name: pwd
type: string
position: 2
description: |
The user's password. See :ref:`updateUser-pwd-field-consideration`.
The user's password. :dbcommand:`updateUser` sends the password to the
MongoDB instance in cleartext. To encrypt the password in transit, use
:doc:`SSL </tutorial/configure-ssl>`
---
object:
name: updateUser
Expand All @@ -44,8 +46,11 @@ name: roles
type: array
position: 4
description: |
The roles granted to the user. An update to the ``roles`` array
overrides the previous array's values.
The roles granted to the user. An update to the ``roles`` array overrides
the previous array's values. You can specify both :ref:`system-defined
roles <system-user-roles>` and :ref:`user-defined role
<user-defined-roles>`. For the syntax of a role, see the
:data:`~admin.system.users.roles` array.
---
object:
name: updateUser
Expand Down
18 changes: 0 additions & 18 deletions source/reference/command/updateUser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,6 @@ Definition

.. include:: /reference/command/updateUser-field.rst

Considerations
--------------

.. _updateUser-pwd-field-consideration:

``pwd`` Field
~~~~~~~~~~~~~

:dbcommand:`updateUser` sends password to the MongoDB instance in
cleartext. To encrypt the password in transit, use :doc:`SSL
</tutorial/configure-ssl>`.

``roles`` Field
~~~~~~~~~~~~~~~

.. |local-cmd-name| replace:: :dbcommand:`updateUser`
.. include:: /includes/fact-roles-array-contents.rst

Required Access
---------------

Expand Down
3 changes: 0 additions & 3 deletions source/reference/method/db.addUser.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ Definition
installations that use Kerberos
</tutorial/control-access-to-mongodb-with-kerberos-authentication>`.

.. |local-cmd-name| replace:: :method:`db.addUser()`
.. include:: /includes/fact-roles-array-contents.rst

.. note::

In 2.5.3, MongoDB introduced a new model for user
Expand Down
15 changes: 12 additions & 3 deletions source/reference/system-roles-collection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ A ``system.roles`` document has the following fields:

.. data:: admin.system.roles.roles

The :data:`~admin.system.roles.roles` array contains role documents
that specify the roles from which this role inherits privileges. A
role document has the following syntax:
The :data:`~admin.system.roles.roles` array contains role documents that
specify the roles from which this role inherits privileges. The array can
specify both :ref:`system-defined roles <system-user-roles>` and
:ref:`user-defined role <user-defined-roles>`.

A role document has the following syntax:

.. code-block:: javascript

Expand All @@ -101,6 +104,12 @@ A ``system.roles`` document has the following fields:

The name of the database where the role is defined.

When using :ref:`role-management commands <role-management-commands>` or
:ref:`user-management commands <user-management-commands>` to add a role
to the :data:`~admin.system.roles.roles` array, you can specify the role
with just the role name (e.g. ``"readWrite"``) if the role that exists
on the database on which the command is run.

Examples
--------

Expand Down
15 changes: 12 additions & 3 deletions source/reference/system-users-collection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,12 @@ Each ``system.users`` document has the following fields:

.. data:: admin.system.users.roles

The :data:`~admin.system.users.roles` array contains role documents
that specify the roles granted to the user. Each role document has
the following syntax:
The :data:`~admin.system.users.roles` array contains role documents that
specify the roles granted to the user. The array can specify both
:ref:`system-defined roles <system-user-roles>` and :ref:`user-defined
role <user-defined-roles>`.

A role document has the following syntax:

.. code-block:: javascript

Expand All @@ -83,6 +86,12 @@ Each ``system.users`` document has the following fields:

The name of the database where role is defined.

When using :ref:`role-management commands <role-management-commands>` or
:ref:`user-management commands <user-management-commands>` to add a role
to the :data:`~admin.system.users.roles` array, you can specify the role
with just the role name (e.g. ``"readWrite"``) if the role that exists
on the database on which the command is run.

.. data:: admin.system.users.customData

The :data:`~admin.system.users.customData` field contains optional
Expand Down