def serialize_waterbutler_settings(self):
     if not self.complete:
         raise exceptions.AddonError('Repo is not configured')
     return {
         'owner': self.user,
         'repo': self.repo,
     }
Пример #2
0
 def serialize_waterbutler_settings(self):
     if not self.folder_id:
         raise exceptions.AddonError('Cannot serialize settings for S3 addon')
     return {
         'bucket': self.folder_id,
         'encrypt_uploads': self.encrypt_uploads
     }
Пример #3
0
 def serialize_waterbutler_settings(self):
     if not self.folder_path or not self.folder_id:
         raise exceptions.AddonError('Folder is not configured')
     return {
         'container_type': self.folder_path,
         'container_id': str(self.folder_id),
     }
Пример #4
0
 def serialize_waterbutler_credentials(self):
     if not self.has_auth:
         raise exceptions.AddonError('Cannot serialize credentials for S3 addon')
     return {
         'access_key': self.external_account.oauth_key,
         'secret_key': self.external_account.oauth_secret,
     }
Пример #5
0
 def serialize_waterbutler_settings(self):
     if not self.folder_id:
         raise exceptions.AddonError('ownCloud is not configured')
     return {
         'folder': self.folder_id,
         'verify_ssl': USE_SSL
     }
Пример #6
0
 def serialize_waterbutler_credentials(self):
     if not self.has_auth:
         raise exceptions.AddonError(
             'Cannot serialize credentials for Azure Blob Storage addon')
     return {
         'account_name': self.external_account.oauth_key,
         'account_key': self.external_account.oauth_secret
     }
Пример #7
0
 def serialize_waterbutler_credentials(self):
     if not self.has_auth:
         raise exceptions.AddonError('Addon is not authorized')
     try:
         Provider(self.external_account).refresh_oauth_key()
         return {'token': self.external_account.oauth_key}
     except BoxClientException as error:
         raise HTTPError(error.status_code, data={'message_long': error.message})
Пример #8
0
 def serialize_waterbutler_credentials(self):
     if not self.has_auth:
         raise exceptions.AddonError('Cannot serialize credentials for S3 Compatible Storage addon')
     return {
         'host': self.external_account.provider_id.split('\t')[0],
         'access_key': self.external_account.oauth_key,
         'secret_key': self.external_account.oauth_secret,
     }
Пример #9
0
 def serialize_waterbutler_settings(self):
     if not self.folder_id:
         raise exceptions.AddonError('Dataverse is not configured')
     return {
         'host': self.external_account.oauth_key,
         'doi': self.dataset_doi,
         'id': self.dataset_id,
         'name': self.dataset,
     }
Пример #10
0
 def serialize_waterbutler_settings(self):
     if not self.complete:
         raise exceptions.AddonError('Repo is not configured')
     return {
         'host': self.external_account.oauth_secret,
         'owner': self.user,
         'repo': self.repo,
         'repo_id': self.repo_id
     }
Пример #11
0
 def serialize_waterbutler_credentials(self):
     if not self.has_auth:
         raise exceptions.AddonError('Addon is not authorized')
     provider = NextcloudProvider(self.external_account)
     return {
         'host': provider.host,
         'username': provider.username,
         'password': provider.password
     }
Пример #12
0
 def serialize_waterbutler_settings(self):
     if not self.folder_id:
         raise exceptions.AddonError('WEKO is not configured')
     provider = WEKOProvider(self.external_account)
     return {
         'nid': self.owner._id,
         'url': provider.sword_url,
         'index_id': self.index_id,
         'index_title': self.index_title,
     }
Пример #13
0
 def serialize_waterbutler_credentials(self):
     if not self.has_auth:
         raise exceptions.AddonError('Addon is not authorized')
     provider = WEKOProvider(self.external_account)
     if provider.repoid is not None:
         return {
             'token': self.external_account.oauth_key,
             'user_id': provider.userid
         }
     else:
         return {'password': provider.password, 'user_id': provider.userid}
Пример #14
0
    def serialize_waterbutler_settings(self):
        if not self.folder_id:
            raise exceptions.AddonError('Folder is not configured')

        return {
            'folder': {
                'id': self.folder_id,
                'name': self.folder_name,
                'path': self.folder_path
            }
        }
Пример #15
0
 def serialize_waterbutler_credentials(self):
     if not self.has_auth:
         raise exceptions.AddonError(
             'Cannot serialize credentials for OpenStack Swift addon')
     provider = SwiftProvider(self.external_account)
     return {
         'auth_version': provider.auth_version,
         'auth_url': provider.auth_url,
         'tenant_name': provider.tenant_name,
         'user_domain_name': provider.user_domain_name,
         'project_domain_name': provider.project_domain_name,
         'username': provider.username,
         'password': provider.password
     }
Пример #16
0
 def serialize_waterbutler_settings(self):
     if self.folder_id is None:
         raise exceptions.AddonError('Folder is not configured')
     return {'folder': self.folder_id}
Пример #17
0
 def serialize_waterbutler_credentials(self):
     if not self.has_auth:
         raise exceptions.AddonError('Addon is not authorized')
     return {'token': self.external_account.oauth_key}
Пример #18
0
 def serialize_waterbutler_settings(self):
     if not self.folder_id:
         raise exceptions.AddonError(
             'Cannot serialize settings for AzureBlobStorage addon')
     return {'container': self.folder_id}
Пример #19
0
 def serialize_waterbutler_settings(self):
     if not self.folder_id:
         raise exceptions.AddonError(
             'Cannot serialize settings for OpenStack Swift addon')
     return {'container': self.folder_id}
Пример #20
0
 def serialize_waterbutler_credentials(self):
     if not self.has_auth:
         raise exceptions.AddonError('Addon is not authorized')
     return {'token': self.fetch_access_token()}
Пример #21
0
 def serialize_waterbutler_credentials(self):
     if not self.complete or not self.repo:
         raise exceptions.AddonError('Addon is not authorized')
     return {'token': self.api.fetch_access_token()}