Skip to content

Commit b2ed645

Browse files
committed
fixes to various auth pages a la 2.5.3 redux as they say in the movies
1 parent 09aa018 commit b2ed645

File tree

64 files changed

+1444
-1046
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1444
-1046
lines changed

bin/builddata/htaccess-next.yaml

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ outputs:
206206
- 'manual'
207207
- 'before-v2.4'
208208
---
209-
redirect-path: '/reference/command/dropRolesFromDatabase'
209+
redirect-path: '/reference/command/dropAllRolesFromDatabase'
210210
url-base: '/reference/security'
211211
type: 'redirect'
212212
code: 303
@@ -222,7 +222,7 @@ outputs:
222222
- 'manual'
223223
- 'before-v2.4'
224224
---
225-
redirect-path: '/reference/command/dropUsersFromDatabase'
225+
redirect-path: '/reference/command/dropAllUsersFromDatabase'
226226
url-base: '/reference/security'
227227
type: 'redirect'
228228
code: 303
@@ -254,7 +254,15 @@ outputs:
254254
- 'manual'
255255
- 'before-v2.4'
256256
---
257-
redirect-path: '/reference/command/nav-user-role'
257+
redirect-path: '/reference/command/nav-role-management'
258+
url-base: '/reference/security'
259+
type: 'redirect'
260+
code: 303
261+
outputs:
262+
- 'manual'
263+
- 'before-v2.4'
264+
---
265+
redirect-path: '/reference/command/nav-user-management'
258266
url-base: '/reference/security'
259267
type: 'redirect'
260268
code: 303
@@ -381,4 +389,51 @@ code: 303
381389
outputs:
382390
- 'manual'
383391
- 'before-v2.4'
384-
...
392+
---
393+
redirect-path: '/reference/resource-document'
394+
url-base: '/reference/security'
395+
type: 'redirect'
396+
code: 303
397+
outputs:
398+
- 'manual'
399+
- 'before-v2.4'
400+
---
401+
redirect-path: '/reference/privilege-actions'
402+
url-base: '/reference/security'
403+
type: 'redirect'
404+
code: 303
405+
outputs:
406+
- 'manual'
407+
- 'before-v2.4'
408+
---
409+
redirect-path: '/reference/system-defined-roles'
410+
url-base: '/reference/user-privileges'
411+
type: 'redirect'
412+
code: 303
413+
outputs:
414+
- 'manual'
415+
- 'before-v2.4'
416+
---
417+
redirect-path: '/reference/user-privileges'
418+
url-base: '/reference/security'
419+
type: 'redirect'
420+
code: 303
421+
outputs:
422+
- 'after-v2.4'
423+
---
424+
redirect-path: '/reference/system-roles-collection'
425+
url-base: '/reference/security'
426+
type: 'redirect'
427+
code: 303
428+
outputs:
429+
- 'manual'
430+
- 'before-v2.4'
431+
---
432+
redirect-path: '/reference/system-users-collection'
433+
url-base: '/reference/security'
434+
type: 'redirect'
435+
code: 303
436+
outputs:
437+
- 'manual'
438+
- 'before-v2.4'
439+
...

source/core/access-control.txt

Lines changed: 64 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,70 @@ Authorization
5151

5252
MongoDB provisions authorization, or access to databases and
5353
operations, on a per-database level. MongoDB uses a role-based approach
54-
to authorization, storing each user's role assignments in the ``admin``
55-
database's :data:`system.users <admin.system.users>` collection. For
56-
more information on roles, see :doc:`/reference/user-privileges`.
54+
to authorization. A role grants privileges to users, where
55+
privileges specify the :doc:`actions </reference/privilege-actions>`
56+
permitted on various :ref:`resources <resource-document>`.
5757

58-
To assign roles to users, you must be a user with an administrative role
59-
in the database. As such, you must first create an administrative user.
60-
For details, see :doc:`/tutorial/add-user-administrator` and
58+
.. _user-defined-roles:
59+
60+
User-Defined Roles
61+
~~~~~~~~~~~~~~~~~~
62+
63+
.. versionadded:: 2.6
64+
65+
In addition to the MongoDB :doc:`system-defined roles
66+
</reference/system-defined-roles>`, MongoDB provides the ability to create
67+
and manage custom roles. To create a role is to define its privileges
68+
by pairing :ref:`resources <resource-document>` (e.g. database,
69+
collection) with :doc:`actions </reference/privilege-actions>` (e.g.
70+
``insert``, ``find``), and/or by specifying other roles from which the
71+
role inherits privileges.
72+
73+
To create and manage roles, MongoDB provides :ref:`role management
74+
commands <role-management-commands>`. MongoDB scopes each role to the
75+
database in which it is created and uniquely identifies each role by
76+
the pairing of its name and its database. MongoDB stores the
77+
user-defined roles information in the :doc:`system.roles collection
78+
</reference/system-roles-collection>` of the ``admin`` database.
79+
80+
.. seealso:: :dbcommand:`createRole` and :ref:`role-management-commands`.
81+
82+
.. _collection-level-access-control:
83+
84+
Collection-Level Access Control
85+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
86+
87+
.. versionadded:: 2.6
88+
89+
MongoDB provides the ability to specify user privileges at a
90+
collection-level granularity. To specify collection-level access
91+
control, create a custom role that pairs its actions to a particular
92+
collection in a specific database in the :ref:`resource document
93+
<resource-document>`.
94+
95+
The MongoDB :doc:`system-defined roles </reference/system-defined-roles>`
96+
grant privileges at a database-level only, and thus cannot be used to
97+
control privileges at the collection-level.
98+
99+
Role Assignment to Users
100+
~~~~~~~~~~~~~~~~~~~~~~~~
101+
102+
Users can have multiple roles and can have different roles on different
103+
resources. Assigning roles to a user authorizes the user to have only
104+
the privileges granted by the roles. Roles always grant privileges and
105+
never limit access. For example, if a user has both :authrole:`read`
106+
*and* :authrole:`readWriteAnyDatabase` roles on a database, the greater
107+
access prevails. A user's role assignments can include
108+
:ref:`system-defined roles <system-user-roles>` provided by MongoDB or
109+
a :ref:`custom roles <user-defined-roles>` defined by the user.
110+
111+
To assign roles to users, you must be a user with an administrative
112+
role in the database. As such, you must first create an administrative
113+
user. For details, see :doc:`/tutorial/add-user-administrator` and
61114
:doc:`/tutorial/add-user-to-database`.
62115

63-
MongoDB requires authorization to manage users in order to prevent
64-
privilege escalation attacks.
116+
MongoDB stores each user's role assignments in the ``admin`` database's
117+
:doc:`system.users collection </reference/system-users-collection>`. To
118+
manage data in this collection, MongoDB provides :ref:`user management
119+
commands <user-management-commands>`, which require proper
120+
authorization to use in order to prevent privilege escalation attacks.

source/core/sharded-cluster-security.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ privileges for the sharded cluster and for each shard.
3333
reside on the config servers.
3434

3535
Users can access to the cluster according to their
36-
:doc:`permissions </reference/user-privileges>`. To receive
36+
:doc:`permissions </core/access-control>`. To receive
3737
privileges for the cluster, you must authenticate while connected
3838
to a :program:`mongos` instance.
3939

source/includes/access-create-role.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ targets. If the privilege targets multiple databases or the
77
``cluster`` resource , the user must have access that includes the :authaction:`grantAnyRole`
88
action on the ``admin`` database.
99

10-
To add a role to the :data:`~admin.system.roles.roles` array, a
10+
To specify roles from which the new role inherits from, a
1111
user must have access that includes the
12-
:authaction:`grantAnyRole` action on the contained role's database.
12+
:authaction:`grantAnyRole` action on the inherited role's database.
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
.. the including document should define a |local-cmd-name| replacement.
2-
3-
In the ``roles`` field you can specify both
4-
:ref:`system roles <system-user-roles>` and custom roles created
5-
with |local-cmd-name|. The ``roles`` array can take both
6-
documents and strings. Specify a role as a document if the role
7-
exists in another database. Specify the role as a string name if it
8-
exists in the current database. For more information on specifying
9-
roles, see the :data:`~admin.system.roles.roles` array.
1+
.. the including document should define a |local-cmd-name| replacement
2+
3+
In the ``roles`` field, you can specify both
4+
:ref:`system-defined roles <system-user-roles>` and :ref:`user-defined
5+
role <user-defined-roles>`. In general, when used with
6+
|local-cmd-name|, specify the role with a document, as in:
7+
8+
.. code-block:: javascript
9+
10+
{ role: "<role>", db: "<database>" }
11+
12+
However, to refer to a role that exists in the same database the
13+
command is run, you can specify the role either with a role document
14+
(e.g. ``{ role: "readWrite", db: "sameDB" }`` ) or with just the role
15+
name (e.g. ``"readWrite"``).

source/includes/manpage-options-auth.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
.. include:: /includes/fact-authentication-source-tool.rst
1515

16-
See :doc:`/reference/user-privileges` for more information on
16+
See :doc:`/core/access-control` for more information on
1717
authentication in MongoDB.
1818

1919
.. option:: --authenticationMechanism <name>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: :dbcommand:`createRole`
2+
file: /reference/command/createRole
3+
description: "Creates a role and specifies its privileges."
4+
---
5+
name: :dbcommand:`updateRole`
6+
file: /reference/command/updateRole
7+
description: "Updates a user-defined role."
8+
---
9+
name: :dbcommand:`dropRole`
10+
file: /reference/command/dropRole
11+
description: "Deletes the user-defined role."
12+
---
13+
name: :dbcommand:`dropAllRolesFromDatabase`
14+
file: /reference/command/dropAllRolesFromDatabase
15+
description: "Deletes all user-defined roles from a database."
16+
---
17+
name: :dbcommand:`grantPrivilegesToRole`
18+
file: /reference/command/grantPrivilegesToRole
19+
description: "Assigns privileges to a user-defined role."
20+
---
21+
name: :dbcommand:`revokePrivilegesFromRole`
22+
file: /reference/command/revokePrivilegesFromRole
23+
description: "Removes the specified privileges from a user-defined role."
24+
---
25+
name: :dbcommand:`grantRolesToRole`
26+
file: /reference/command/grantRolesToRole
27+
description: "Specifies roles from which a user-defined role inherits privileges."
28+
---
29+
name: :dbcommand:`revokeRolesFromRole`
30+
file: /reference/command/revokeRolesFromRole
31+
description: "Removes specified inherited roles from a user-defined role."
32+
---
33+
name: :dbcommand:`rolesInfo`
34+
file: /reference/command/rolesInfo
35+
description: "Returns information for the specified role or roles."
36+
...
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: :dbcommand:`createUser`
2+
file: /reference/command/createUser
3+
description: "Creates a new user."
4+
---
5+
name: :dbcommand:`updateUser`
6+
file: /reference/command/updateUser
7+
description: "Updates a user privilege document."
8+
---
9+
name: :dbcommand:`dropUser`
10+
file: /reference/command/dropUser
11+
description: "Removes a single user."
12+
---
13+
name: :dbcommand:`dropAllUsersFromDatabase`
14+
file: /reference/command/dropAllUsersFromDatabase
15+
description: "Deletes all users associated with a database."
16+
---
17+
name: :dbcommand:`grantRolesToUser`
18+
file: /reference/command/grantRolesToUser
19+
description: "Grants a role and its privileges to a user."
20+
---
21+
name: :dbcommand:`revokeRolesFromUser`
22+
file: /reference/command/revokeRolesFromUser
23+
description: "Removes a role from a user."
24+
---
25+
name: :dbcommand:`usersInfo`
26+
file: /reference/command/usersInfo
27+
description: "Returns information about the specified users."
28+
...

source/includes/ref-toc-command-user-role.yaml

Lines changed: 0 additions & 64 deletions
This file was deleted.

source/includes/toc-security-reference.yaml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
1-
file: /reference/user-privileges
1+
file: /reference/system-defined-roles
22
description: |
3-
Reference on user privilege roles and corresponding access.
3+
Reference on MongoDB provided roles and corresponding access.
44
---
5-
file: /reference/roles-collection
5+
file: /reference/system-roles-collection
66
description: |
7-
Describes the content of the collection that stores custom user roles.
7+
Describes the content of the collection that stores user-defined roles.
88
---
9-
file: /reference/users-collection
9+
file: /reference/system-users-collection
1010
description: |
1111
Describes the content of the collection that stores users' credentials and
1212
role assignments.
1313
---
14+
file: /reference/resource-document
15+
description: |
16+
Describes the resource document for roles.
17+
---
18+
file: /reference/privilege-actions
19+
description: |
20+
List of the actions available for privileges.
21+
---
1422
file: /reference/default-mongodb-port
1523
description: |
1624
List of default ports used by MongoDB.

0 commit comments

Comments
 (0)