Ticket: Principle of Least Privilege Jul 2021

I have opened a new thread since the last email said to.
The link referenced in one of the prior emails is private.
I have a couple of questions since I try and create a new user against the shard server that I have been using, but the admin collection is currently empty.
a) How do I find out what privileges the mp220sutdent has on the shard.
b) Should this be run on the Atlas shard cluster? If not, how is it run on the local mflix database.

This is part of the error that I am getting :
{
“ok” : 0,
“errmsg” : "(Unauthorized) not authorized on admin to execute command …

Please advise.

How do you get the screen like in Jarosław Musielak’s post from Oct 20? I have the same question as him as I searched the documents for ’ Add Default Privileges and couldn’t find anything.
Thanks

When you created m220p user what privs you have given?
From your Atlas you should be able to see the privileges
Click on database access on left side–>it will show database users
You can edit/drop users,modify privs etc

Hi, I solved it, as I wasn’t actually logging into Atlas, I was logging into Compass. Thanks.
I do have a problem that the Error Handling is failing. Could you help me with that? It’s the last thing to complete the course :slight_smile:
In the get_movie I used:
except InvalidId as id,
except errors.InvalidId as id:
except InvalidId:
except errors.InvalidId:
and weird permutations of the above, but I always get the following from pytest.
but the code I get back is always the same. It seems to execute tests\test_error_handling.py:13:


mflix\db.py:266: in get_movie
id = ObjectId(id)
envmflix\lib\site-packages\bson\objectid.py:125: in init
self.__validate(oid)
envmflix\lib\site-packages\bson\objectid.py:221: in __validate
_raise_invalid_id(oid)


oid = ‘foobar’

def _raise_invalid_id(oid):
  raise InvalidId(
        "%r is not a valid ObjectId, it must be a 12-byte input"
        " or a 24-character hex string 1" % oid)

E bson.errors.InvalidId: ‘foobar’ is not a valid ObjectId, it must be a 12-byte input or a 24-character hex string 1

envmflix\lib\site-packages\bson\objectid.py:65: InvalidId
---------------------------- Captured stdout call -----------------------------
Movie collection id foobar
============================= 42 tests deselected =============================

Thanks.

I was not logging into the Atlas Server but I was using Compass. Once I logged into the server, I could finish the assignment even though the text of the assignment ’ Add Default Privileges is incorrect for the current version.