List all rows of dynamodb table for Admin user

How can an user with admin role get all of the users notes listed on the UI?
As of now we can get only logged in user notes.

Hmm what do you mean by admin role? Is that something you are creating in your app?

Yes. I created this list All function which does a scan of the table. But now this overrides the existing list function. So all users sees all the notes irrespective of their login. How do I make list All function only available to one user using IAM mandated federated user and all other users use list function

A simply way to do this would be by having a list of user id’s that are stored in your DB that are allowed to access this info. For the list all function first check if the user id is in that list.