[SERVER-13441] Inconsistent error handling in user management shell helpers Created: 01/Apr/14  Updated: 30/Oct/15  Resolved: 03/Apr/14

Status: Closed
Project: Core Server
Component/s: Security, Shell
Affects Version/s: 2.6.0-rc2
Fix Version/s: 2.6.1, 2.7.0

Type: Improvement Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Minor Change
Backport Completed:
Participants:

 Description   
Issue Status as of April 15, 2014

ISSUE SUMMARY
User management shell helpers like dropUser(), getUser() and getRole() show inconsistent behavior when a user is not found. Specifically, getUser() and getRole() throw an exception, but dropUser() returns false.

USER IMPACT
Minor impact, but user interface changes slightly, which may affect users who automate or script MongoDB user management.

WORKAROUNDS
None.

RESOLUTION
Change the behavior so that getUser() and getRole() do not throw but instead return null if the user does not exist.

AFFECTED VERSIONS
Version 2.6.0 is affected by this bug.

PATCHES
The patch is included in the 2.6.1 production release.

Original description

Other user management helpers such as dropUser do not throw if the user is not found - dropUser just returns false. We should change getUser and getRole to simply return null if the user/role isn't found



 Comments   
Comment by Githook User [ 16/Apr/14 ]

Author:

{u'username': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@mongodb.com'}

Message: SERVER-13441 getUser and getRole shell helpers shouldn't throw when user/role not found
(cherry picked from commit abf252cfe8833ab15dc8d62e8e05a30108484508)
Branch: v2.6
https://github.com/mongodb/mongo/commit/adbc29e06ebf142a3c14091db20b5e8a23bb8980

Comment by Githook User [ 03/Apr/14 ]

Author:

{u'username': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@mongodb.com'}

Message: SERVER-13441 getUser and getRole shell helpers shouldn't throw when user/role not found
Branch: master
https://github.com/mongodb/mongo/commit/abf252cfe8833ab15dc8d62e8e05a30108484508

Generated at Thu Feb 08 03:31:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.