I've been looking at the Dropbox and Dropbox for Business API and I was trying to see if it would be possible to create a list of all the members and what shared folders they have access to.
I have found a project by Dropbox (Github Source) that lists all the shared folders and which people have access to them. I essentially want to do the opposite, list the users and what folders they have.
I have read through all the API (Core and Business) docs but can't seem to find a way to do it, unless I'm missing something. I also read about a preview of the new API, but again I don't think that is what I want.
Does anyone know if this can be done?
If I understand correctly what you're trying to do, you just need to call /shared_folders for each member of the team.
(You can list the members of the team via /team/members/list.)
Related
I need to get a list of all publicly-visible Quip documents in my company using the Quip API. I have a service worker account that will make the API calls.
My question: how do I find the root folder to start from?
Quip's API docs tell you how to get info about one or more folders using Get Folders by passing in the folder ids. You can call this again for nested folders, and you can call Get Threads to get information about each document. (Quip uses the terminology "threads," not "documents.")
But where do I start? I need a root folder to start recursing from, right.
Here's what I've tried:
The Get Folders docs say "To find your desktop or archive folder ID, see Get Authenticated User." I've tried that but it returns folders called Desktop, Archive, Starred, Private, Shared, and Group.
Desktop seemed like a good place to start but its only child is Archive, and...
Archive only contains a couple dozen docs. The meaning of the Archive folder is not documented.
Starred is docs you've favorited.
Private is your private docs.
Shared is docs that have been shared with you.
Group seemed promising because the Folders UI at quip.com/browse shows the word "Group Folders" at the top. But my account's Group Folder list is empty.
A bit late to this, but since the QUIP API is poorly maintained and not well documented, for those looking to solve the same problem, here is one way:
Step 1: Add your company's root folder to your favorite (Starred folder), and drag it to the top of the favorite list.
Step 2: Get you authenticated instance:
quip_client = quip.QuipClient(access_token=login_token)
user = quip_client.get_authenticated_user()
print (user)
You will retrieve a json result with basic information like name, id... and most importantly the starred_folder_id for the user.
Step 3: Pass the starred_folder_id to the get_folder method:
print (quip_client.get_folder("starred_folder_id"))
You will receive yet another json with a key named as children which contains values of your starred folders/files in the order it appears on your quip app. The first folder_id will be your company folder id.
You can now use the folder_id to retrieve the rest of your company documents by more get_folder.
I was trying out the graph APIs and was looking at /delta call, I was not able to use it to identify if a permission for an item had changed?
Is there a smart way to do it?
I am referring to these permissions, I can modify them through SharePoint site or using the ms graph API endpoints. Based on my understanding sharing also involves modifications to them and is just one of the usecase.
With the existing Graph APIs, there is no straight forward way of tracking permission changes(or any other change for that matter). The delta API should tell you that something has changed for an item and that your app needs to sync it. Here are the steps you can try:
Create an item in the drive (document library).
Call delta api and note the value of odata.deltaLink.
Share the item with someone(or remove permissions from the item).
Call delta api again using the deltaLink value you saved earlier.
The response will contain the item whose permissions were modified after the first call to delta api. Unless your app persisted item permissions, and then compared the permissions before and after the item was synced, there is no good answer at this point.
Out-of-the-box, an Alfresco user can read a document based on:
The document's permissions
The user's role
The user's groups
Whether the user owns the document or not
Maybe some other factors I forgot?
Now, I want to add a new factor: Whether the document is currently part of a workflow.
Alfresco's permissionDefinitions.xml allows me to define permissions based on authorities such as ROLE_LOCK_OWNER etc, but it does not seem to be the right place to add permission conditions.
I guess I will have to write some Java source code, but I am not sure what classes are responsible for this, and whether there is an Alfresco way to customize them?
So, I assume you want to somehow have nodes that are attached to a workflow have different access rights? You need to think about the behavior you want in all of the UIs and protocols you are exposing (e.g. share, WebDAV, CIFS, FTP, etc.).
If you want to set a permission on a node, you can do that via JavaScript as well as Java (See http://docs.alfresco.com/5.2/references/API-JS-setPermission.html and http://docs.alfresco.com/5.2/references/dev-services-permission.html). As was mentioned in one of the comments, you can also get the number of active workflows on a node by referencing the activeWorkflows property in JavaScript (http://docs.alfresco.com/5.2/references/API-JS-ScriptNode.html) or in Java
Depending on the specifics, I might implement this in different ways, but if all you want to do is have the permission change, you could just update it at the beginning and end of your workflow with a simple javascript call. The only thing bad about that is that it doesn't take into consideration the workflow getting canceled. You could also create a policy/behavior on an aspect you attach or even have a rule or job run that updates content based on the activeWorkflows values.
Debugging the code, I see the request is like:
https://graph.microsoft.com:443/v1.0/drives/the-shared-docs-id/items/the-root-id/children
I know for sure that the-shared-docs-id and the-root-id are right.
Furthermore, this same request returns the expected results when issued from the Graph explorer.
However, the .NET SDK returns nothing. No items at all.
The same user (me) created the files and folders, and authorized the app to access OneDrive. This user is even the admin of everything.
I was testing with two different apps, one with Files.ReadWrite scope only, and other with Files.ReadWrite.All.
I thought Files.ReadWrite.All was needed to access other user's files. It turns out, it is also needed to access the shared folder, even being the same (admin) user who created the shared items (files and folders), and even having full permissions to access them.
I think this is weird... but it looks like this is the way it is.
Using the app with Files.ReadWrite.All scope, I was able to see the items in the shared folder.
Using the Files.ReadWrite scope, I get an empty list of items.
I have an app which integrates with dropbox, I want the user to select a folder from their dropbox.
I can call '/2/files/list_folder' (https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder) with recursive set to true, and then recursively call it based on the returned cursor. I then filter out any which aren't directories.
But this is a long slow process, and unpredictable given the potential size of some users directory tree on Dropbox.
I know there is a dropbox file select plug in (https://www.dropbox.com/developers/chooser), but I want to make a folder select, with no option to select a file.
What I would like is one api call that returns a list of all directories for a user.
Does this exist with an API method I don't know about? Or is there another widget that allows folder selection?
I've seen this question which just does a recursive api call too, not practically efficient.
The Dropbox API v2 doesn't offer a way to list only folders like that, but we'll consider it a feature request.
Dropbox also doesn't offer a component like the Chooser that allows folder selection, but we'll consider that a feature request as well.