コード例 #1
0
ファイル: views.py プロジェクト: atelic/osf.io
    """ 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
)
コード例 #2
0
ファイル: views.py プロジェクト: 545zhou/osf.io
def _get_folders(node_addon, folder_id):
    pass

github_folder_list = generic_views.folder_list(
    SHORT_NAME,
    FULL_NAME,
    _get_folders
)

github_get_config = generic_views.get_config(
    SHORT_NAME,
    GitHubSerializer
)

github_deauthorize_node = generic_views.deauthorize_node(
    SHORT_NAME
)

github_root_folder = generic_views.root_folder(
    SHORT_NAME
)

#################
# Special Cased #
#################

@must_not_be_registration
@must_have_addon(SHORT_NAME, 'user')
@must_have_addon(SHORT_NAME, 'node')
@must_be_addon_authorizer(SHORT_NAME)
@must_have_permission('write')
コード例 #3
0
        '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)
コード例 #4
0
SHORT_NAME = 'dataverse'
FULL_NAME = 'Dataverse'

dataverse_account_list = generic_views.account_list(
    SHORT_NAME,
    DataverseSerializer
)

dataverse_import_auth = generic_views.import_auth(
    SHORT_NAME,
    DataverseSerializer
)

dataverse_deauthorize_node = generic_views.deauthorize_node(
    SHORT_NAME
)

dataverse_get_config = generic_views.get_config(
    SHORT_NAME,
    DataverseSerializer
)

## Auth ##

@must_be_logged_in
def dataverse_user_config_get(auth, **kwargs):
    """View for getting a JSON representation of the logged-in user's
    Dataverse user settings.
    """
コード例 #5
0
                                                  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.
    """
    node = kwargs.get('node') or node_addon.owner

    path = request.args.get('path', '')
    folder_id = request.args.get('folderId', 'root')
コード例 #6
0
ファイル: views.py プロジェクト: baylee-d/osf.io
SHORT_NAME = 'figshare'
FULL_NAME = SHORT_NAME

figshare_account_list = generic_views.account_list(
    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,
コード例 #7
0
ファイル: views.py プロジェクト: baylee-d/osf.io
SHORT_NAME = 'owncloud'
FULL_NAME = 'OwnCloud'

owncloud_account_list = generic_views.account_list(
    SHORT_NAME,
    OwnCloudSerializer
)

owncloud_import_auth = generic_views.import_auth(
    SHORT_NAME,
    OwnCloudSerializer
)

owncloud_deauthorize_node = generic_views.deauthorize_node(
    SHORT_NAME
)

owncloud_root_folder = generic_views.root_folder(
    SHORT_NAME
)

## Config ##

@must_be_logged_in
def owncloud_add_user_account(auth, **kwargs):
    """
        Verifies new external account credentials and adds to user's list

        This view expects `host`, `username` and `password` fields in the JSON
        body of the request.
コード例 #8
0
ファイル: views.py プロジェクト: fredtoh/osf.io
SHORT_NAME = 'dataverse'
FULL_NAME = 'Dataverse'

dataverse_account_list = generic_views.account_list(
    SHORT_NAME,
    DataverseSerializer
)

dataverse_import_auth = generic_views.import_auth(
    SHORT_NAME,
    DataverseSerializer
)

dataverse_deauthorize_node = generic_views.deauthorize_node(
    SHORT_NAME
)

dataverse_get_config = generic_views.get_config(
    SHORT_NAME,
    DataverseSerializer
)

## Auth ##

@must_be_logged_in
def dataverse_user_config_get(auth, **kwargs):
    """View for getting a JSON representation of the logged-in user's
    Dataverse user settings.
    """
コード例 #9
0
ファイル: views.py プロジェクト: atelic/osf.io
    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.
    """
    path = request.args.get('path', '')
    folder_id = request.args.get('folder_id', 'root')