I’m working on a project where I need to check what permissions a user has for specific folders in Google Drive. I can successfully retrieve folder information, but I’m having trouble getting the actual permission levels.
Currently I’m using this approach to fetch folders:
DocumentQuery folderQuery = new DocumentQuery(new URL(
"https://docs.google.com/feeds/default/private/full/-/folder"));
DocumentListFeed folderFeed = service.getFeed(folderQuery, DocumentListFeed.class);
for (DocumentListEntry folderItem : folderFeed.getEntries()) {
boolean canModify = folderItem.getCanEdit(); // Always returns true regardless of actual permissions
}
The problem is that getCanEdit() always returns true even when the user doesn’t have edit rights to the folder. Is there a way to get the real permission status using the DocumentListEntry object? I need to distinguish between read-only access and full edit permissions.
I had this exact same problem. The issue is you’re using the old Documents List API, which doesn’t handle folder permissions correctly. The getCanEdit() method gives you garbage results because it’s checking document permissions, not actual folder permissions. I switched to Drive API v3 and it fixed everything. You need to make separate API calls to get permissions using the folder’s file ID through the Drive API - it gives you way better control. Yeah, you’ll need to update your code, but the permission handling becomes rock solid.
for sure, ran into this Documents List API bug myself last year too. I wasted so much time on it! The getCanEdit() is just broken for folders and doesn’t give real permissions. Switching to Drive API v3 is the best way; it’s way more reliable. Just be ready to revamp your code a bit.
The Documents List API got deprecated years ago - that’s why you’re hitting these permission issues. It’s a known bug where the API returns cached or wrong permission states. I hit this exact same wall two years ago on a legacy system. The getCanEdit() method became totally unreliable once Google started phasing it out. You need to migrate to Drive API v3 and use permissions.list with the file ID to get accurate permission data. The migration’s a pain but it’s your only shot at reliable permission checking. Google officially killed the Documents List API in 2015, so sticking with it will just cause more headaches.