Esempio n. 1
0
github_account_list = generic_views.account_list(
    SHORT_NAME,
    GitHubSerializer
)

github_import_auth = generic_views.import_auth(
    SHORT_NAME,
    GitHubSerializer
)

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
)
Esempio n. 2
0
s3_account_list = generic_views.account_list(SHORT_NAME, S3Serializer)

s3_import_auth = generic_views.import_auth(SHORT_NAME, S3Serializer)

s3_deauthorize_node = generic_views.deauthorize_node(SHORT_NAME)

s3_get_config = generic_views.get_config(SHORT_NAME, S3Serializer)


def _get_buckets(node_addon, folder_id=None):
    """Used by generic_view `folder_list` to fetch a list of buckets.
    `folder_id` required by generic, but not actually used"""
    return {'buckets': utils.get_bucket_names(node_addon)}


s3_folder_list = generic_views.folder_list(SHORT_NAME, FULL_NAME, _get_buckets)

s3_root_folder = generic_views.root_folder(SHORT_NAME)


@must_be_logged_in
def s3_add_user_account(auth, **kwargs):
    """Verifies new external account credentials and adds to user's list"""
    try:
        access_key = request.json['access_key']
        secret_key = request.json['secret_key']
    except KeyError:
        raise HTTPError(httplib.BAD_REQUEST)

    if not (access_key and secret_key):
        return {
Esempio n. 3
0
    return [{
        'addon': 'box',
        '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)
Esempio n. 4
0
s3_get_config = generic_views.get_config(
    SHORT_NAME,
    S3Serializer
)

def _get_buckets(node_addon, folder_id=None):
    """Used by generic_view `folder_list` to fetch a list of buckets.
    `folder_id` required by generic, but not actually used"""
    return {
        'buckets': utils.get_bucket_names(node_addon)
    }

s3_folder_list = generic_views.folder_list(
    SHORT_NAME,
    FULL_NAME,
    _get_buckets
)

s3_root_folder = generic_views.root_folder(
    SHORT_NAME
)

@must_be_logged_in
def s3_add_user_account(auth, **kwargs):
    """Verifies new external account credentials and adds to user's list"""
    try:
        access_key = request.json['access_key']
        secret_key = request.json['secret_key']
    except KeyError:
        raise HTTPError(httplib.BAD_REQUEST)