You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
jacques_coney
3 years agoExplorer | Level 3
Get a list of Namespaces a single user has access to
Hey, I've been interacting with a number of end points and I'm trying to rely upon the permissions dropbox has defined in RBAC when knowing whether a user can use a number of files returned from a s...
Greg-DB
Dropbox Staff
If you want to list everything a user has in their account, you can use /2/files/list_folder. Anything returned there when calling for that user is something that the user has access to. However note that users may have access to namespaces that aren't currently mounted in their account, and so would not be returned there. And as you said though, that returns folder contents, not just the namespaces themselves, so that can be excessive. In any case, note that if you do use that, make sure you also implement /2/files/list_folder/continue. Also, you can have Dropbox perform the recursion for you by setting "recursive": true on /2/files/list_folder, if you aren't already.
Alternatively, you can use /2/sharing/list_folders and /2/sharing/list_folders/continue to list all of the shared folders a user has access to. That won't give you all namespaces technically, since it excludes "app folders" which are type of namespace. That may be acceptable for your use case though.
A different approach would be to list all namespaces for the entire team, using /2/team/namespaces/list and /2/team/namespaces/list/continue. You could then list the members of each team folder or shared folder using /2/sharing/list_folder_members and /2/sharing/list_folder_members/continue with Dropbox-API-Select-Admin.
jacques_coney
3 years agoExplorer | Level 3
Thanks Greg for the thorough reply.
The /2/sharing/list_folders and /2/sharing/list_folders/continue seems to be along the lines of what I am after. However, when playing around with the endpoint it if in the scenario with Folder A all contents within in are shared by extension because A is shared so A/B/C etc under the same namespace. Is it possible to have the endpoint/an endpoint return only a list of parent shared folders based upon their access so something like:
- User has access to all of A so in the response it is just A not A/B, A/C etc
- but also in the scenario where the user has access to A/B and A/C but not A it returns A/B and A/C
if that makes sense. Basically my concern is wanting to do this on the fly getting every nested folder back in the response based upon the large data set I have will become a performance issue having to call the `continue` endpoint an unreasonable amount of times, so just trying to see if I can thin out the information of some nested folder information that can be implied? Or is this how it currently works?
- Здравко3 years agoLegendary | Level 20
- Greg-DB3 years agoDropbox Staff
It sounds like the /2/sharing/list_folders and /2/sharing/list_folders/continue endpoints are still the best option here. There isn't another option like that. These will list each shared folder that the user has access to, so whether or not something is listed there depends on if the particular folder was shared as a shared folder. (Each shared folder is a "namespace' with some members/permissions set. You can find more information on that in the Team Files Guide.)
About Discuss Dropbox Developer & API
Make connections with other developers
797 PostsLatest Activity: 6 days agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!