Coding access control using Pycharm?

image

Hello since I’m new to both Pycharm and MongoDB . I would appreciate your help if you can point me in the right direction to code this above document into my collection using Pycharm.
The inital user details are uploaded directly from a csv file . But the access control needs to be done on Pycharm seperately.
I know the starting point is Array but unsure about the assignment of privilieges to each user.