Skip to content

[CR] OSF addon for Microsoft OneDrive#4681

Closed
caseyrygt wants to merge 59 commits intoCenterForOpenScience:developfrom
caseyrygt:feature/onedrive
Closed

[CR] OSF addon for Microsoft OneDrive#4681
caseyrygt wants to merge 59 commits intoCenterForOpenScience:developfrom
caseyrygt:feature/onedrive

Conversation

@caseyrygt
Copy link
Contributor

Initial Work In Progress PR for Microsoft OneDrive OSF addon

Notes

We copied Box as the starting point for this addon. There are debug and info logging statements that we'll remove before the final PR.

Also see the corresponding PR for WaterButler.

Limitations

  • This only works with OneDrive for personal use. OneDrive for business has a different authentication endpoints and the API is slightlightly different at this time. Additionally, Microsoft has released graph which, I believe, should (when it is complete) unify OneDrive for Personal and OneDrive for Business under one API. The OneDrive API used here should be compatible with Graph based on the documentation I've seen.
  • OneDrive's API only returns the most recent revision for an item (file or folder). I don't believe there is a way around this now.

Issues under development

  • Delete Folder
  • Download Zip
  • Rename File
  • Rename Folder
  • Copy Folder
  • Copy File

Functionality in Place (i.e. "dev complete")

  • Upload files
  • Create folders
  • Download Files
  • Delete files
  • View Revisions
  • List Files/Folders in a folder

Screenshots

file-detail
file-list
file-revisions

Note: I don't have MFR running. I'm having issues getting it running in ubuntu.

dsterlaceGT and others added 30 commits November 5, 2015 10:53
…todo:refresh access token and get folder list
@caseyrygt
Copy link
Contributor Author

@samchrisinger & @felliott: Sorry for the delay on this. I think I have resolved all of the issues / items you had. Could you please review this?

Thanks!

@caseyrygt caseyrygt changed the title [WIP] OSF addon for Microsoft OneDrive [CR] OSF addon for Microsoft OneDrive May 18, 2016
@caseyrygt
Copy link
Contributor Author

@samchrisinger: I meat to ask you about an error I'm getting in the test_views tests:
BuildError: ('JSONRenderer__onedrive_folder_list', {}, None)
It happens whenever I call api_url_for (e.g. url = api_url_for('onedrive_folder_list')).

In looking at the dropbox test_views, it calls: self.project.api_url_for. Unfortunately, when I call that method I get: AttributeError: 'TestAuthViews' object has no attribute 'project'

I'm guessing that between when I'd copied the tests from dropbox to now, some other changes were made to OSF's testing or "base" framework.

Could you give me any points for resolving this?

Thanks.

@samchrisinger
Copy link
Contributor

@caseyrygt some of these are happening because the route just doesn't exist: https://github.com/CenterForOpenScience/osf.io/pull/4681/files#diff-0ee0e60ebe1815cd3f65f833c2e4976aR35
(here you need api_url_for('oauth_connect', service_name='onedrive')-- see https://github.com/CenterForOpenScience/osf.io/blob/develop/website/routes.py#L354)

I can't find an example test case using 'onedrive_folder_list', but all of the urls you try to look up need to exist in your onedrive/routes.py.

'profile_url': userInfo['link']
}

def _refresh_token(self, access_token, refresh_token):
Copy link
Member

@mfraezz mfraezz Jun 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the two other refresh-related functions in this class are likely superfluous, with auto_refresh_url defined. See website/oauth/models/__init__.py:ExternalProvider.refresh_oauth_key -- it does all of this work.

This would also obviate OneDriveAuthClient.refresh; .user_info could be moved into OneDriveClient.

@mfraezz
Copy link
Member

mfraezz commented Jun 1, 2016

Pausing review here for the night, picking up at the serializer in the AM.



class OneDriveSerializer(OAuthAddonSerializer):
def credentials_owner(self, user_settings=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be using the base implementation. Currently it would throw an AttributeError if user_settings isn't passed in.

@mfraezz
Copy link
Member

mfraezz commented Jun 2, 2016

Trivial, but all the console logging will need to go before this gets merged.

@mfraezz
Copy link
Member

mfraezz commented Jun 2, 2016

Somewhat light first pass complete. 🐧

I'll review in more depth and do functional testing when the above comments have been addressed. I know updating the views and tests to the new paradigm seems like a lot of work, but there's a good chance it'll be simpler for both of us than fixing and verifying the correctness of all the commented-out tests that presumably need some amount of maintenance.

If you have any questions or need any clarifications, feel free to @ mention me, or if you're on Slack I can hop on and discuss things with you there.

Back to you, @caseyrygt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants