

def serialize_settings(self, node_settings, current_user, client=None):
    self.user_settings = node_settings.user_settings
    self.node_settings = node_settings
    ret = self.node_settings.to_json(current_user)
    current_user_settings = current_user.get_addon('s3')
    ret.update({
        'bucket': (self.node_settings.bucket or ''),
        'encryptUploads': self.node_settings.encrypt_uploads,
        'hasBucket': (self.node_settings.bucket is not None),
        'userIsOwner': (self.user_settings and (self.user_settings.owner == current_user)),
        'userHasAuth': (bool(current_user_settings) and current_user_settings.has_auth),
        'nodeHasAuth': self.node_settings.has_auth,
        'ownerName': None,
        'bucketList': None,
        'validCredentials': (bool(current_user_settings) and self.credentials_are_valid(current_user_settings)),
    })
    if self.node_settings.has_auth:
        ret['ownerName'] = self.user_settings.owner.fullname
    ret['urls'] = self.serialized_urls
    return ret

dataset/ETHPy150Open CenterForOpenScience/osf.io/website/addons/s3/serializer.py S3Serializer.serialize_settings/original