SHORT_NAME ) s3_get_config = generic_views.get_config( SHORT_NAME, S3Serializer ) def _set_folder(node_addon, folder, auth): folder_id = folder['id'] node_addon.set_folder(folder_id, auth=auth) node_addon.save() s3_set_config = generic_views.set_config( SHORT_NAME, FULL_NAME, S3Serializer, _set_folder ) @must_have_addon(SHORT_NAME, 'node') @must_be_addon_authorizer(SHORT_NAME) def s3_folder_list(node_addon, **kwargs): """ Returns all the subsequent folders under the folder id passed. """ return node_addon.get_folders() s3_root_folder = generic_views.root_folder( SHORT_NAME ) @must_be_logged_in
""" Returns all the subsequent folders under the folder id passed. """ folder_id = request.args.get('folder_id') return node_addon.get_folders(folder_id=folder_id) dropbox_get_config = generic_views.get_config( SHORT_NAME, DropboxSerializer ) def _set_folder(node_addon, folder, auth): uid = folder['id'] node_addon.set_folder(uid, auth=auth) node_addon.save() dropbox_set_config = generic_views.set_config( SHORT_NAME, FULL_NAME, DropboxSerializer, _set_folder ) dropbox_deauthorize_node = generic_views.deauthorize_node( SHORT_NAME ) dropbox_root_folder = generic_views.root_folder( SHORT_NAME )
FULL_NAME = 'Google Drive' googledrive_account_list = generic_views.account_list(SHORT_NAME, GoogleDriveSerializer) googledrive_get_config = generic_views.get_config(SHORT_NAME, GoogleDriveSerializer) def _set_folder(node_addon, folder, auth): node_addon.set_folder(folder, auth=auth) node_addon.save() googledrive_set_config = generic_views.set_config(SHORT_NAME, FULL_NAME, GoogleDriveSerializer, _set_folder) googledrive_import_auth = generic_views.import_auth(SHORT_NAME, GoogleDriveSerializer) googledrive_deauthorize_node = generic_views.deauthorize_node(SHORT_NAME) googledrive_root_folder = generic_views.root_folder(SHORT_NAME) @must_have_addon(SHORT_NAME, 'node') @must_be_addon_authorizer(SHORT_NAME) def googledrive_folder_list(node_addon, **kwargs): """ Returns all the subsequent folders under the folder id passed. Not easily generalizable due to `path` kwarg.
'kind': 'folder', 'id': item['id'], 'name': item['name'], 'path': os.path.join(folder_path, item['name']), 'urls': { 'folders': node.api_url_for('box_folder_list', folderId=item['id']), } } for item in metadata['item_collection']['entries'] if item['type'] == 'folder'] box_folder_list = generic_views.folder_list(SHORT_NAME, FULL_NAME, _get_folders) box_get_config = generic_views.get_config(SHORT_NAME, BoxSerializer) def _set_folder(node_addon, folder, auth): uid = folder['id'] node_addon.set_folder(uid, auth=auth) node_addon.save() box_set_config = generic_views.set_config(SHORT_NAME, FULL_NAME, BoxSerializer, _set_folder) box_deauthorize_node = generic_views.deauthorize_node(SHORT_NAME) box_root_folder = generic_views.root_folder(SHORT_NAME)
figshare_deauthorize_node = generic_views.deauthorize_node( SHORT_NAME ) figshare_get_config = generic_views.get_config( SHORT_NAME, FigshareSerializer ) def _set_folder(node_addon, folder, auth): node_addon.set_folder(folder['id'], auth=auth) node_addon.save() figshare_set_config = generic_views.set_config( SHORT_NAME, FULL_NAME, FigshareSerializer, _set_folder ) def figshare_root_folder(node_settings, auth, **kwargs): """Return the Rubeus/HGrid-formatted response for the root folder only. Identical to the generic_views.root_folder except adds root_folder_type to exported data. Fangorn needs root_folder_type to decide whether to display the 'Create Folder' button. """ # Quit if node settings does not have authentication if not node_settings.has_auth or not node_settings.folder_id: return None node = node_settings.owner return [rubeus.build_addon_root(
user.get_or_add_addon('owncloud', auth=auth) user.save() return {} @must_have_addon(SHORT_NAME, 'user') @must_have_addon(SHORT_NAME, 'node') def owncloud_folder_list(node_addon, user_addon, **kwargs): """ Returns all the subsequent folders under the folder id passed. Not easily generalizable due to `path` kwarg. """ path = request.args.get('path') return node_addon.get_folders(path=path) def _set_folder(node_addon, folder, auth): node_addon.set_folder(folder['path'], auth=auth) node_addon.save() owncloud_set_config = generic_views.set_config( SHORT_NAME, FULL_NAME, OwnCloudSerializer, _set_folder ) owncloud_get_config = generic_views.get_config( SHORT_NAME, OwnCloudSerializer )
user = auth.user if provider.account not in user.external_accounts: user.external_accounts.append(provider.account) user.get_or_add_addon('owncloud', auth=auth) user.save() return {} @must_have_addon(SHORT_NAME, 'user') @must_have_addon(SHORT_NAME, 'node') def owncloud_folder_list(node_addon, user_addon, **kwargs): """ Returns all the subsequent folders under the folder id passed. Not easily generalizable due to `path` kwarg. """ path = request.args.get('path') return node_addon.get_folders(path=path) def _set_folder(node_addon, folder, auth): node_addon.set_folder(folder['path'], auth=auth) node_addon.save() owncloud_set_config = generic_views.set_config(SHORT_NAME, FULL_NAME, OwnCloudSerializer, _set_folder) owncloud_get_config = generic_views.get_config(SHORT_NAME, OwnCloudSerializer)
SHORT_NAME, GoogleDriveSerializer ) googledrive_get_config = generic_views.get_config( SHORT_NAME, GoogleDriveSerializer ) def _set_folder(node_addon, folder, auth): node_addon.set_folder(folder, auth=auth) node_addon.save() googledrive_set_config = generic_views.set_config( SHORT_NAME, FULL_NAME, GoogleDriveSerializer, _set_folder ) googledrive_import_auth = generic_views.import_auth( SHORT_NAME, GoogleDriveSerializer ) googledrive_deauthorize_node = generic_views.deauthorize_node( SHORT_NAME ) googledrive_root_folder = generic_views.root_folder( SHORT_NAME )
FigshareSerializer) figshare_import_auth = generic_views.import_auth(SHORT_NAME, FigshareSerializer) figshare_deauthorize_node = generic_views.deauthorize_node(SHORT_NAME) figshare_get_config = generic_views.get_config(SHORT_NAME, FigshareSerializer) def _set_folder(node_addon, folder, auth): node_addon.set_folder(folder['id'], auth=auth) node_addon.save() figshare_set_config = generic_views.set_config(SHORT_NAME, FULL_NAME, FigshareSerializer, _set_folder) def figshare_root_folder(node_settings, auth, **kwargs): """Return the Rubeus/HGrid-formatted response for the root folder only. Identical to the generic_views.root_folder except adds root_folder_type to exported data. Fangorn needs root_folder_type to decide whether to display the 'Create Folder' button. """ # Quit if node settings does not have authentication if not node_settings.has_auth or not node_settings.folder_id: return None node = node_settings.owner return [ rubeus.build_addon_root(