Пример #1
0
def index():
    try:
        #TODO : make this way more robust
        institution = Institution.find_one(
            Q('domains', 'eq', request.host.lower()))
        inst_dict = view_institution(institution._id)
        inst_dict.update({
            'home':
            False,
            'institution':
            True,
            'redirect_url':
            '/institutions/{}/'.format(institution._id)
        })

        return inst_dict
    except NoResultsFound:
        pass

    all_institutions = Institution.find().sort('name')
    dashboard_institutions = [{
        'id': inst._id,
        'name': inst.name,
        'logo_path': inst.logo_path_rounded_corners
    } for inst in all_institutions]

    return {'home': True, 'dashboard_institutions': dashboard_institutions}
Пример #2
0
def index():
    try:
        #TODO : make this way more robust
        institution = Institution.find_one(Q('domains', 'eq', request.host.lower()))
        inst_dict = view_institution(institution._id)
        inst_dict.update({
            'home': False,
            'institution': True,
            'redirect_url': '/institutions/{}/'.format(institution._id)
        })

        return inst_dict
    except NoResultsFound:
        pass

    all_institutions = Institution.find().sort('name')
    dashboard_institutions = [
        {'id': inst._id, 'name': inst.name, 'logo_path': inst.logo_path_rounded_corners}
        for inst in all_institutions
    ]

    return {
        'home': True,
        'dashboard_institutions': dashboard_institutions
    }
def update_or_create(inst_data):
    inst = Institution.load(inst_data['_id'])
    if inst:
        for key, val in inst_data.iteritems():
            inst.key = val
        changed_fields = inst.save()
        if changed_fields:
            print('Updated {}: {}'.format(inst.name, changed_fields))
        return inst, False
    else:
        new_inst = Institution(**inst_data)
        new_inst.save()
        print('Added new institution: {}'.format(new_inst._id))
        return new_inst, True
Пример #4
0
def update_or_create(inst_data):
    inst = Institution.load(inst_data['_id'])
    if inst:
        for key, val in inst_data.iteritems():
            inst.key = val
        changed_fields = inst.save()
        if changed_fields:
            print('Updated {}: {}'.format(inst.name, changed_fields))
        return inst, False
    else:
        new_inst = Institution(**inst_data)
        new_inst.save()
        print('Added new institution: {}'.format(new_inst._id))
        return new_inst, True
Пример #5
0
    def test_institution_find_doesnt_find_deleted(self):
        self.institution.node.is_deleted = True
        self.institution.node.save()

        insts = list(Institution.find())

        assert_equal(len(insts), 0)
Пример #6
0
def get_globals():
    """Context variables that are available for every template rendered by
    OSFWebRenderer.
    """
    user = _get_current_user()
    user_institutions = [{'id': inst._id, 'name': inst.name, 'logo_path': inst.logo_path} for inst in user.affiliated_institutions] if user else []
    all_institutions = [{'id': inst._id, 'name': inst.name, 'logo_path': inst.logo_path} for inst in Institution.find().sort('name')]
    if request.host_url != settings.DOMAIN:
        try:
            inst_id = (Institution.find_one(Q('domains', 'eq', request.host.lower())))._id
            request_login_url = '{}institutions/{}'.format(settings.DOMAIN, inst_id)
        except NoResultsFound:
            request_login_url = request.url.replace(request.host_url, settings.DOMAIN)
    else:
        request_login_url = request.url
    return {
        'private_link_anonymous': is_private_link_anonymous_view(),
        'user_name': user.username if user else '',
        'user_full_name': user.fullname if user else '',
        'user_id': user._primary_key if user else '',
        'user_locale': user.locale if user and user.locale else '',
        'user_timezone': user.timezone if user and user.timezone else '',
        'user_url': user.url if user else '',
        'user_gravatar': profile_views.current_user_gravatar(size=25)['gravatar_url'] if user else '',
        'user_email_verifications': user.unconfirmed_email_info if user else [],
        'user_api_url': user.api_url if user else '',
        'user_entry_point': metrics.get_entry_point(user) if user else '',
        'user_institutions': user_institutions if user else None,
        'all_institutions': all_institutions,
        'display_name': get_display_name(user.fullname) if user else '',
        'use_cdn': settings.USE_CDN_FOR_CLIENT_LIBS,
        'piwik_host': settings.PIWIK_HOST,
        'piwik_site_id': settings.PIWIK_SITE_ID,
        'sentry_dsn_js': settings.SENTRY_DSN_JS if sentry.enabled else None,
        'dev_mode': settings.DEV_MODE,
        'allow_login': settings.ALLOW_LOGIN,
        'cookie_name': settings.COOKIE_NAME,
        'status': status.pop_status_messages(),
        'domain': settings.DOMAIN,
        'api_domain': settings.API_DOMAIN,
        'disk_saving_mode': settings.DISK_SAVING_MODE,
        'language': language,
        'noteworthy_links_node': settings.NEW_AND_NOTEWORTHY_LINKS_NODE,
        'popular_links_node': settings.POPULAR_LINKS_NODE,
        'web_url_for': util.web_url_for,
        'api_url_for': util.api_url_for,
        'api_v2_url': util.api_v2_url,  # URL function for templates
        'api_v2_base': util.api_v2_url(''),  # Base url used by JS api helper
        'sanitize': sanitize,
        'sjson': lambda s: sanitize.safe_json(s),
        'webpack_asset': paths.webpack_asset,
        'waterbutler_url': settings.WATERBUTLER_URL,
        'login_url': cas.get_login_url(request_login_url),
        'reauth_url': util.web_url_for('auth_logout', redirect_url=request.url, reauth=True),
        'profile_url': cas.get_profile_url(),
        'enable_institutions': settings.ENABLE_INSTITUTIONS,
        'keen_project_id': settings.KEEN_PROJECT_ID,
        'keen_write_key': settings.KEEN_WRITE_KEY,
        'maintenance': maintenance.get_maintenance(),
    }
Пример #7
0
def update_or_create(inst_data):
    inst = Institution.load(inst_data['_id'])
    if inst:
        for key, val in inst_data.iteritems():
            setattr(inst.node, inst.attribute_map[key], val)
        changed_fields = inst.node.save()
        if changed_fields:
            print('Updated {}: {}'.format(inst.name, changed_fields))
        return inst, False
    else:
        inst = Institution(None)
        inst_data = {inst.attribute_map[k]: v for k, v in inst_data.iteritems()}
        new_inst = Node(**inst_data)
        new_inst.save()
        print('Added new institution: {}'.format(new_inst.institution_id))
        return new_inst, True
Пример #8
0
 def origin_not_found_in_white_lists(self, origin, url):
     not_found = super(CorsMiddleware,
                       self).origin_not_found_in_white_lists(origin, url)
     if not_found:
         not_found = Institution.find(Q('domains', 'eq',
                                        url.netloc.lower())).count() == 0
     return not_found
Пример #9
0
    def test_institution_find_doesnt_find_deleted(self):
        self.institution.node.is_deleted = True
        self.institution.node.save()

        insts = list(Institution.find())

        assert_equal(len(insts), 0)
Пример #10
0
    def authenticate(self, request):
        try:
            payload = jwt.decode(
                jwe.decrypt(request.body, settings.JWE_SECRET),
                settings.JWT_SECRET,
                options={'verify_exp': False},
                algorithm='HS256'
            )
        except (jwt.InvalidTokenError, TypeError):
            raise AuthenticationFailed

        # The JWT `data` payload is expected in the following structure.
        #
        # {"provider": {
        #     "idp": "https://login.circle.edu/idp/shibboleth",
        #     "id": "CIR",
        #     "user": {
        #         "middleNames": "",
        #         "familyName": "",
        #         "givenName": "",
        #         "fullname": "Circle User",
        #         "suffix": "",
        #         "username": "******"
        #     }
        # }}
        data = json.loads(payload['data'])
        provider = data['provider']

        institution = Institution.load(provider['id'])
        if not institution:
            raise AuthenticationFailed('Invalid institution id specified "{}"'.format(provider['id']))

        username = provider['user']['username']
        fullname = provider['user']['fullname']

        user, created = get_or_create_user(fullname, username, reset_password=False)

        if created:
            user.given_name = provider['user'].get('givenName')
            user.middle_names = provider['user'].get('middleNames')
            user.family_name = provider['user'].get('familyName')
            user.suffix = provider['user'].get('suffix')
            user.date_last_login = datetime.utcnow()
            user.save()

            # User must be saved in order to have a valid _id
            user.register(username)
            send_mail(
                to_addr=user.username,
                mail=WELCOME_OSF4I,
                mimetype='html',
                user=user
            )

        if institution not in user.affiliated_institutions:
            user.affiliated_institutions.append(institution)
            user.save()

        return user, None
Пример #11
0
    def authenticate(self, request):
        try:
            payload = jwt.decode(jwe.decrypt(request.body,
                                             settings.JWE_SECRET),
                                 settings.JWT_SECRET,
                                 options={'verify_exp': False},
                                 algorithm='HS256')
        except (jwt.InvalidTokenError, TypeError):
            raise AuthenticationFailed

        # The JWT `data` payload is expected in the following structure.
        #
        # {"provider": {
        #     "idp": "https://login.circle.edu/idp/shibboleth",
        #     "id": "CIR",
        #     "user": {
        #         "middleNames": "",
        #         "familyName": "",
        #         "givenName": "",
        #         "fullname": "Circle User",
        #         "suffix": "",
        #         "username": "******"
        #     }
        # }}
        data = json.loads(payload['data'])
        provider = data['provider']

        institution = Institution.load(provider['id'])
        if not institution:
            raise AuthenticationFailed(
                'Invalid institution id specified "{}"'.format(provider['id']))

        username = provider['user']['username']
        fullname = provider['user']['fullname']

        user, created = get_or_create_user(fullname,
                                           username,
                                           reset_password=False)

        if created:
            user.given_name = provider['user'].get('givenName')
            user.middle_names = provider['user'].get('middleNames')
            user.family_name = provider['user'].get('familyName')
            user.suffix = provider['user'].get('suffix')
            user.date_last_login = datetime.utcnow()
            user.save()

            # User must be saved in order to have a valid _id
            user.register(username)
            send_mail(to_addr=user.username,
                      mail=WELCOME_OSF4I,
                      mimetype='html',
                      user=user)

        if institution not in user.affiliated_institutions:
            user.affiliated_institutions.append(institution)
            user.save()

        return user, None
Пример #12
0
    def test_find_deleted(self):
        self.institution.node.is_deleted = True
        self.institution.node.save()

        insts = list(Institution.find(deleted=True))

        assert_equal(len(insts), 1)
        assert_equal(insts[0], self.institution)
Пример #13
0
 def get_institution(self):
     inst = get_object_or_error(
         Node,
         Q('institution_id', 'eq', self.kwargs[self.institution_lookup_url_kwarg]),
         display_name='institution',
         allow_institution=True
     )
     return Institution(inst)
Пример #14
0
    def test_find_deleted(self):
        self.institution.node.is_deleted = True
        self.institution.node.save()

        insts = list(Institution.find(deleted=True))

        assert_equal(len(insts), 1)
        assert_equal(insts[0], self.institution)
Пример #15
0
def index():
    try:
        # TODO : make this way more robust
        inst = Institution.find_one(Q("domains", "eq", request.host.lower()))
        inst_dict = view_institution(inst._id)
        inst_dict.update({"home": False, "institution": True, "redirect_url": "/institutions/{}/".format(inst._id)})
        return inst_dict
    except NoResultsFound:
        pass
    return {"home": True}
Пример #16
0
def update_or_create(inst_data):
    inst = Institution.load(inst_data['_id'])
    if inst:
        for key, val in inst_data.iteritems():
            setattr(inst.node, inst.attribute_map[key], val)
        changed_fields = inst.node.save()
        if changed_fields:
            print('Updated {}: {}'.format(inst.name, changed_fields))
        update_institution(inst)
        return inst, False
    else:
        inst = Institution(None)
        inst_data = {inst.attribute_map[k]: v for k, v in inst_data.iteritems()}
        new_inst = Node(**inst_data)
        new_inst.save()
        inst = Institution.load(new_inst.institution_id)
        print('Added new institution: {}'.format(new_inst.institution_id))
        update_institution(inst)
        return new_inst, True
Пример #17
0
def get_globals():
    """Context variables that are available for every template rendered by
    OSFWebRenderer.
    """
    user = _get_current_user()
    if request.host_url != settings.DOMAIN:
        try:
            inst_id = (Institution.find_one(Q('domains', 'eq', request.host.lower())))._id
            login_url = '{}institutions/{}'.format(settings.DOMAIN, inst_id)
        except NoResultsFound:
            login_url = request.url.replace(request.host_url, settings.DOMAIN)
    else:
        login_url = request.url
    return {
        'private_link_anonymous': is_private_link_anonymous_view(),
        'user_name': user.username if user else '',
        'user_full_name': user.fullname if user else '',
        'user_id': user._primary_key if user else '',
        'user_locale': user.locale if user and user.locale else '',
        'user_timezone': user.timezone if user and user.timezone else '',
        'user_url': user.url if user else '',
        'user_gravatar': profile_views.current_user_gravatar(size=25)['gravatar_url'] if user else '',
        'user_api_url': user.api_url if user else '',
        'display_name': get_display_name(user.fullname) if user else '',
        'use_cdn': settings.USE_CDN_FOR_CLIENT_LIBS,
        'piwik_host': settings.PIWIK_HOST,
        'piwik_site_id': settings.PIWIK_SITE_ID,
        'sentry_dsn_js': settings.SENTRY_DSN_JS if sentry.enabled else None,
        'dev_mode': settings.DEV_MODE,
        'allow_login': settings.ALLOW_LOGIN,
        'cookie_name': settings.COOKIE_NAME,
        'status': status.pop_status_messages(),
        'domain': settings.DOMAIN,
        'api_domain': settings.API_DOMAIN,
        'disk_saving_mode': settings.DISK_SAVING_MODE,
        'language': language,
        'noteworthy_links_node': settings.NEW_AND_NOTEWORTHY_LINKS_NODE,
        'popular_links_node': settings.POPULAR_LINKS_NODE,
        'web_url_for': util.web_url_for,
        'api_url_for': util.api_url_for,
        'api_v2_url': util.api_v2_url,  # URL function for templates
        'api_v2_base': util.api_v2_url(''),  # Base url used by JS api helper
        'sanitize': sanitize,
        'js_str': lambda x: x.replace("'", r"\'").replace('"', r'\"'),
        'sjson': lambda s: sanitize.safe_json(s),
        'webpack_asset': paths.webpack_asset,
        'waterbutler_url': settings.WATERBUTLER_URL,
        'login_url': cas.get_login_url(login_url, auto=True),
        'reauth_url': util.web_url_for('auth_logout', redirect_url=request.url, reauth=True),
        'profile_url': cas.get_profile_url(),
        'enable_institutions': settings.ENABLE_INSTITUTIONS,
        'keen_project_id': settings.KEEN_PROJECT_ID,
        'keen_write_key': settings.KEEN_WRITE_KEY,
    }
Пример #18
0
    def get_institutions_to_add_remove(self, institutions, new_institutions):
        diff = relationship_diff(
            current_items={inst._id: inst for inst in institutions},
            new_items={inst['_id']: inst for inst in new_institutions}
        )

        insts_to_add = []
        for inst_id in diff['add']:
            inst = Institution.load(inst_id)
            if not inst:
                raise exceptions.NotFound(detail='Institution with id "{}" was not found'.format(inst_id))
            insts_to_add.append(inst)

        return insts_to_add, diff['remove'].values()
Пример #19
0
def index():
    try:
        #TODO : make this way more robust
        inst = Institution.find_one(Q('domains', 'eq', request.host.lower()))
        inst_dict = view_institution(inst._id)
        inst_dict.update({
            'home': False,
            'institution': True,
            'redirect_url': '/institutions/{}/'.format(inst._id)
        })
        return inst_dict
    except NoResultsFound:
        pass
    return {'home': True}
Пример #20
0
    def get_institutions_to_add_remove(self, institutions, new_institutions):
        diff = relationship_diff(
            current_items={inst._id: inst for inst in institutions},
            new_items={inst['_id']: inst for inst in new_institutions}
        )

        insts_to_add = []
        for inst_id in diff['add']:
            inst = Institution.load(inst_id)
            if not inst:
                raise exceptions.NotFound(detail='Institution with id "{}" was not found'.format(inst_id))
            insts_to_add.append(inst)

        return insts_to_add, diff['remove'].values()
Пример #21
0
def index():
    try:
        #TODO : make this way more robust
        inst = Institution.find_one(Q('domains', 'eq', request.host.lower()))
        inst_dict = view_institution(inst._id)
        inst_dict.update({
            'home': False,
            'institution': True,
            'redirect_url': '/institutions/{}/'.format(inst._id)
        })
        return inst_dict
    except NoResultsFound:
        pass
    return {'home': True}
Пример #22
0
    def update(self, instance, validated_data):
        node = instance
        user = self.context['request'].user

        inst = validated_data.get('institution_id', None)
        if inst:
            inst = Institution.load(inst)
            if not inst:
                raise exceptions.NotFound
            if not inst.auth(user):
                raise exceptions.PermissionDenied
        node.primary_institution = inst
        node.save()
        return node
Пример #23
0
    def update(self, instance, validated_data):
        node = instance
        user = self.context['request'].user

        inst = validated_data.get('institution_id', None)
        if inst:
            inst = Institution.load(inst)
            if not inst:
                raise exceptions.NotFound
            try:
                node.add_primary_institution(inst=inst, user=user)
            except UserNotAffiliatedError:
                raise exceptions.ValidationError(detail='User not affiliated with institution')
            node.save()
            return node
        node.remove_primary_institution(user)
        node.save()
        return node
Пример #24
0
 def get_institutions(self):
     institutions = Institution.find(Q('_id', 'ne', None))
     return institutions
Пример #25
0
def main(env):
    INSTITUTIONS = []

    if env == 'prod':
        INSTITUTIONS = [
            {
                '_id': 'busara',
                'name': 'Busara Center for Behavioral Economics',
                'description':
                'The <a href="http://www.busaracenter.org/">Busara Center</a> for Behavioral Economics',
                'banner_name': 'busara-banner.png',
                'logo_name': 'busara-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['busaracenter.org'],
            },
            {
                '_id': 'cos',
                'name': 'Center For Open Science',
                'description':
                'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'esip',
                'name':
                'Federation of Earth Science Information Partners (ESIP)',
                'description':
                '<a href="http://www.esipfed.org/">ESIP\'s</a> mission is to support the networking and data dissemination needs of our members and the global Earth science data community by linking the functional sectors of observation, research, application, education and use of Earth science.',
                'banner_name': 'esip-banner.png',
                'logo_name': 'esip-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['esipfed.org'],
            },
            {
                '_id':
                'nd',
                'name':
                'University of Notre Dame',
                'description':
                'In <a href="https://research.nd.edu/news/64035-notre-dame-center-for-open-science-partner-to-advance-open-science-initiatives/">partnership</a> with the <a href="https://crc.nd.edu">Center for Research Computing</a>, <a href="http://esc.nd.edu">Engineering &amp; Science Computing</a>, and the <a href="https://library.nd.edu">Hesburgh Libraries</a>',
                'banner_name':
                'nd-banner.png',
                'logo_name':
                'nd-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component(
                        'https://login.nd.edu/idp/shibboleth')),
                'domains': ['osf.nd.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'ucr',
                'name':
                'University of California Riverside',
                'description':
                'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name':
                'ucr-banner.png',
                'logo_name':
                'ucr-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component('urn:mace:incommon:ucr.edu')),
                'domains': ['osf.ucr.edu'],
                'email_domains': [],
            },
            # {
            #     '_id': 'ugent',
            #     'name': 'Universiteit Gent [Test]',
            #     'description': None,
            #     'banner_name': 'ugent-banner.png',
            #     'logo_name': 'ugent-shield.png',
            #     'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://identity.ugent.be/simplesaml/saml2/idp/metadata.php')),
            #     'domains': ['osf.ugent.be'],
            #     'email_domains': [],
            # },
            {
                '_id':
                'usc',
                'name':
                'University of Southern California',
                'description':
                'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name':
                'usc-banner.png',
                'logo_name':
                'usc-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component('urn:mace:incommon:usc.edu')),
                'domains': ['osf.usc.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'uva',
                'name':
                'University of Virginia',
                'description':
                'Projects must abide by the University <a href="http://www.virginia.edu/informationpolicy/security.html">Security and Data Protection Policies</a>',
                'banner_name':
                'uva-banner.png',
                'logo_name':
                'uva-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component('urn:mace:incommon:virginia.edu')),
                'domains': ['osf.virginia.edu'],
                'email_domains': [],
            },
        ]
    if env == 'stage':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage]',
                'description': 'Center for Open Science [Stage]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['staging-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id':
                'nd',
                'name':
                'University of Notre Dame [Stage]',
                'description':
                'University of Notre Dame [Stage]',
                'banner_name':
                'nd-banner.png',
                'logo_name':
                'nd-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component(
                        'https://login-test.cc.nd.edu/idp/shibboleth')),
                'domains': ['staging-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'google',
                'name': 'Google [Stage]',
                'description': 'Google [Stage]',
                'banner_name': 'google-banner.png',
                'logo_name': 'google-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['gmail.com'],
            },
            {
                '_id': 'yahoo',
                'name': 'Yahoo [Stage]',
                'description': 'Yahoo [Stage]',
                'banner_name': 'yahoo-banner.png',
                'logo_name': 'yahoo-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['yahoo.com'],
            },
        ]
    if env == 'stage2':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage2]',
                'description': 'Center for Open Science [Stage2]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['staging2-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
        ]
    elif env == 'test':
        INSTITUTIONS = [
            {
                '_id': 'busara',
                'name': 'Busara Center for Behavioral Economics [Test]',
                'description':
                'The <a href="http://www.busaracenter.org/">Busara Center</a> for Behavioral Economics',
                'banner_name': 'busara-banner.png',
                'logo_name': 'busara-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['busaracenter.org'],
            },
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Test]',
                'description':
                'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['test-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'esip',
                'name':
                'Federation of Earth Science Information Partners (ESIP) [Test]',
                'description':
                '<a href="http://www.esipfed.org/">ESIP\'s</a> mission is to support the networking and data dissemination needs of our members and the global Earth science data community by linking the functional sectors of observation, research, application, education and use of Earth science.',
                'banner_name': 'esip-banner.png',
                'logo_name': 'esip-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['esipfed.org'],
            },
            {
                '_id':
                'nd',
                'name':
                'University of Notre Dame [Test]',
                'description':
                'In <a href="https://research.nd.edu/news/64035-notre-dame-center-for-open-science-partner-to-advance-open-science-initiatives/">partnership</a> with the <a href="https://crc.nd.edu">Center for Research Computing</a>, <a href="http://esc.nd.edu">Engineering &amp; Science Computing</a>, and the <a href="https://library.nd.edu">Hesburgh Libraries</a>',
                'banner_name':
                'nd-banner.png',
                'logo_name':
                'nd-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component(
                        'https://login-test.cc.nd.edu/idp/shibboleth')),
                'domains': ['test-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'ucr',
                'name':
                'University of California Riverside [Test]',
                'description':
                'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name':
                'ucr-banner.png',
                'logo_name':
                'ucr-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component('urn:mace:incommon:ucr.edu')),
                'domains': ['test-osf-ucr.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'ugent',
                'name':
                'Universiteit Gent [Test]',
                'description':
                'Universiteit Gent [Test]',
                'banner_name':
                'ugent-banner.png',
                'logo_name':
                'ugent-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component(
                        'https://identity.ugent.be/simplesaml/saml2/idp/metadata.php'
                    )),
                'domains': ['test-osf-ugent.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'usc',
                'name':
                'University of Southern California [Test]',
                'description':
                'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name':
                'usc-banner.png',
                'logo_name':
                'usc-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component('urn:mace:incommon:usc.edu')),
                'domains': ['test-osf-usc.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'uva',
                'name':
                'University of Virginia [Test]',
                'description':
                'Projects must abide by the University <a href="http://www.virginia.edu/informationpolicy/security.html">Security and Data Protection Policies</a>',
                'banner_name':
                'uva-banner.png',
                'logo_name':
                'uva-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component(
                        'https://shibidp-test.its.virginia.edu/idp/shibboleth')
                ),
                'domains': ['test-osf-virginia.cos.io'],
                'email_domains': [],
            },
        ]

    init_app(routes=False)
    with TokuTransaction():
        for inst_data in INSTITUTIONS:
            new_inst, inst_created = update_or_create(inst_data)
            # update the nodes elastic docs, to have current names of institutions. This will
            # only work properly if this file is the only thing changing institution attributes
            if not inst_created:
                nodes = Node.find_by_institutions(new_inst,
                                                  query=Q(
                                                      'is_deleted', 'ne',
                                                      True))
                for node in nodes:
                    update_node(node, async=False)
        for extra_inst in Institution.find(
                Q('_id', 'nin', [x['_id'] for x in INSTITUTIONS])):
            logger.warn('Extra Institution : {} - {}'.format(
                extra_inst._id, extra_inst.name))
Пример #26
0
    def test_institution_find(self):
        insts = list(Institution.find())

        assert_equal(len(insts), 1)
        assert_equal(insts[0], self.institution)
Пример #27
0
def main(env):
    INSTITUTIONS = []

    if env == 'prod':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science',
                'description': 'Center for Open Science',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame',
                'description': 'University of Notre Dame',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login.nd.edu/idp/shibboleth')),
                'domains': ['osf.nd.edu'],
                'email_domains': [],
            },
            {
                '_id': 'ucr',
                'name': 'University of California Riverside',
                'description': 'University of California Riverside',
                'banner_name': 'ucr-banner.png',
                'logo_name': 'ucr-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:ucr.edu')),
                'domains': ['osf.ucr.edu'],
                'email_domains': [],
            },
            {
                '_id': 'usc',
                'name': 'University of Southern California',
                'description': 'University of Southern California',
                'banner_name': 'usc-banner.png',
                'logo_name': 'usc-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:usc.edu')),
                'domains': ['osf.usc.edu'],
                'email_domains': [],
            },
        ]
    if env == 'stage':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage]',
                'description': 'Center for Open Science [Stage]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['staging-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame [Stage]',
                'description': 'University of Notre Dame [Stage]',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login-test.cc.nd.edu/idp/shibboleth')),
                'domains': ['staging-osf-nd.cos.io'],
                'email_domains': [],
            },
        ]
    if env == 'stage2':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage2]',
                'description': 'Center for Open Science [Stage2]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['staging2-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
        ]
    elif env == 'test':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Test]',
                'description': 'Center for Open Science [Test]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['test-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame [Test]',
                'description': 'University of Notre Dame [Test]',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login-test.cc.nd.edu/idp/shibboleth')),
                'domains': ['test-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'ucr',
                'name': 'University of California Riverside [Test]',
                'description': 'University of California Riverside [Test]',
                'banner_name': 'ucr-banner.png',
                'logo_name': 'ucr-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:ucr.edu')),
                'domains': ['test-osf-ucr.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'usc',
                'name': 'University of Southern California [Test]',
                'description': 'University of Southern California [Test]',
                'banner_name': 'usc-banner.png',
                'logo_name': 'usc-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:usc.edu')),
                'domains': ['test-osf-usc.cos.io'],
                'email_domains': [],
            },
        ]

    init_app(routes=False)
    with TokuTransaction():
        for inst_data in INSTITUTIONS:
            new_inst, inst_created = update_or_create(inst_data)
        for extra_inst in Institution.find(Q('_id', 'nin', [x['_id'] for x in INSTITUTIONS])):
            logger.warn('Extra Institution : {} - {}'.format(extra_inst._id, extra_inst.name))
Пример #28
0
 def origin_not_found_in_white_lists(self, origin, url):
     not_found = super(CorsMiddleware, self).origin_not_found_in_white_lists(origin, url)
     if not_found:
         not_found = Institution.find(Q('domains', 'eq', url.netloc.lower())).count() == 0
     return not_found
Пример #29
0
def main(env):
    INSTITUTIONS = []

    if env == 'prod':
        INSTITUTIONS = [
            {
                '_id': 'busara',
                'name': 'Busara Center for Behavioral Economics',
                'description': 'The <a href="http://www.busaracenter.org/">Busara Center</a> for Behavioral Economics',
                'banner_name': 'busara-banner.png',
                'logo_name': 'busara-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['busaracenter.org'],
            },
            {
                '_id': 'cos',
                'name': 'Center For Open Science',
                'description': 'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'esip',
                'name': 'Federation of Earth Science Information Partners (ESIP)',
                'description': '<a href="http://www.esipfed.org/">ESIP\'s</a> mission is to support the networking and data dissemination needs of our members and the global Earth science data community by linking the functional sectors of observation, research, application, education and use of Earth science.',
                'banner_name': 'esip-banner.png',
                'logo_name': 'esip-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['esipfed.org'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame',
                'description': 'In <a href="https://research.nd.edu/news/64035-notre-dame-center-for-open-science-partner-to-advance-open-science-initiatives/">partnership</a> with the <a href="https://crc.nd.edu">Center for Research Computing</a>, <a href="http://esc.nd.edu">Engineering &amp; Science Computing</a>, and the <a href="https://library.nd.edu">Hesburgh Libraries</a>',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login.nd.edu/idp/shibboleth')),
                'domains': ['osf.nd.edu'],
                'email_domains': [],
            },
            {
                '_id': 'nyu',
                'name': 'New York University',
                'description': '...',
                'banner_name': 'nyu-banner.png',
                'logo_name': 'nyu-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:nyu.edu')),
                'domains': ['osf.nyu.edu'],
                'email_domains': [],
            },
            {
                '_id': 'ucr',
                'name': 'University of California Riverside',
                'description': 'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name': 'ucr-banner.png',
                'logo_name': 'ucr-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:ucr.edu')),
                'domains': ['osf.ucr.edu'],
                'email_domains': [],
            },
            # {
            #     '_id': 'ugent',
            #     'name': 'Universiteit Gent [Test]',
            #     'description': None,
            #     'banner_name': 'ugent-banner.png',
            #     'logo_name': 'ugent-shield.png',
            #     'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://identity.ugent.be/simplesaml/saml2/idp/metadata.php')),
            #     'domains': ['osf.ugent.be'],
            #     'email_domains': [],
            # },
            {
                '_id': 'usc',
                'name': 'University of Southern California',
                'description': 'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name': 'usc-banner.png',
                'logo_name': 'usc-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:usc.edu')),
                'domains': ['osf.usc.edu'],
                'email_domains': [],
            },
            {
                '_id': 'uva',
                'name': 'University of Virginia',
                'description': 'Projects must abide by the University <a href="http://www.virginia.edu/informationpolicy/security.html">Security and Data Protection Policies</a>',
                'banner_name': 'uva-banner.png',
                'logo_name': 'uva-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:virginia.edu')),
                'domains': ['osf.virginia.edu'],
                'email_domains': [],
            },
        ]
    if env == 'stage':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage]',
                'description': 'Center for Open Science [Stage]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['staging-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame [Stage]',
                'description': 'University of Notre Dame [Stage]',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login-test.cc.nd.edu/idp/shibboleth')),
                'domains': ['staging-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'google',
                'name': 'Google [Stage]',
                'description': 'Google [Stage]',
                'banner_name': 'google-banner.png',
                'logo_name': 'google-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['gmail.com'],
            },
            {
                '_id': 'yahoo',
                'name': 'Yahoo [Stage]',
                'description': 'Yahoo [Stage]',
                'banner_name': 'yahoo-banner.png',
                'logo_name': 'yahoo-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['yahoo.com'],
            },
        ]
    if env == 'stage2':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage2]',
                'description': 'Center for Open Science [Stage2]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['staging2-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
        ]
    elif env == 'test':
        INSTITUTIONS = [
            {
                '_id': 'busara',
                'name': 'Busara Center for Behavioral Economics [Test]',
                'description': 'The <a href="http://www.busaracenter.org/">Busara Center</a> for Behavioral Economics',
                'banner_name': 'busara-banner.png',
                'logo_name': 'busara-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['busaracenter.org'],
            },
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Test]',
                'description': 'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['test-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'esip',
                'name': 'Federation of Earth Science Information Partners (ESIP) [Test]',
                'description': '<a href="http://www.esipfed.org/">ESIP\'s</a> mission is to support the networking and data dissemination needs of our members and the global Earth science data community by linking the functional sectors of observation, research, application, education and use of Earth science.',
                'banner_name': 'esip-banner.png',
                'logo_name': 'esip-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['esipfed.org'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame [Test]',
                'description': 'In <a href="https://research.nd.edu/news/64035-notre-dame-center-for-open-science-partner-to-advance-open-science-initiatives/">partnership</a> with the <a href="https://crc.nd.edu">Center for Research Computing</a>, <a href="http://esc.nd.edu">Engineering &amp; Science Computing</a>, and the <a href="https://library.nd.edu">Hesburgh Libraries</a>',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login-test.cc.nd.edu/idp/shibboleth')),
                'domains': ['test-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'nyu',
                'name': 'New York University [Test]',
                'description': 'New York University [Test]',
                'banner_name': 'nyu-banner.png',
                'logo_name': 'nyu-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://shibbolethqa.es.its.nyu.edu/idp/shibboleth')),
                'domains': ['test-osf-nyu.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'ucr',
                'name': 'University of California Riverside [Test]',
                'description': 'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name': 'ucr-banner.png',
                'logo_name': 'ucr-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:ucr.edu')),
                'domains': ['test-osf-ucr.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'ugent',
                'name': 'Universiteit Gent [Test]',
                'description': 'Universiteit Gent [Test]',
                'banner_name': 'ugent-banner.png',
                'logo_name': 'ugent-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://identity.ugent.be/simplesaml/saml2/idp/metadata.php')),
                'domains': ['test-osf-ugent.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'usc',
                'name': 'University of Southern California [Test]',
                'description': 'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name': 'usc-banner.png',
                'logo_name': 'usc-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:usc.edu')),
                'domains': ['test-osf-usc.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'uva',
                'name': 'University of Virginia [Test]',
                'description': 'Projects must abide by the University <a href="http://www.virginia.edu/informationpolicy/security.html">Security and Data Protection Policies</a>',
                'banner_name': 'uva-banner.png',
                'logo_name': 'uva-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://shibidp-test.its.virginia.edu/idp/shibboleth')),
                'domains': ['test-osf-virginia.cos.io'],
                'email_domains': [],
            },
        ]

    init_app(routes=False)
    with TokuTransaction():
        for inst_data in INSTITUTIONS:
            new_inst, inst_created = update_or_create(inst_data)
            # update the nodes elastic docs, to have current names of institutions. This will
            # only work properly if this file is the only thing changing institution attributes
            if not inst_created:
                nodes = Node.find_by_institutions(new_inst, query=Q('is_deleted', 'ne', True))
                for node in nodes:
                    update_node(node, async=False)
        for extra_inst in Institution.find(Q('_id', 'nin', [x['_id'] for x in INSTITUTIONS])):
            logger.warn('Extra Institution : {} - {}'.format(extra_inst._id, extra_inst.name))
Пример #30
0
 def get_institutions(self):
     institutions = Institution.find(Q('_id', 'ne', None))
     return institutions
Пример #31
0
def main(env):
    INSTITUTIONS = []

    if env == 'prod':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science',
                'description': 'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            # {
            #     '_id': 'nd',
            #     'name': 'University of Notre Dame',
            #     'description': None,
            #     'banner_name': 'nd-banner.png',
            #     'logo_name': 'nd-shield.png',
            #     'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login.nd.edu/idp/shibboleth')),
            #     'domains': ['osf.nd.edu'],
            #     'email_domains': [],
            # },
            {
                '_id': 'ucr',
                'name': 'University of California Riverside',
                'description': 'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name': 'ucr-banner.png',
                'logo_name': 'ucr-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:ucr.edu')),
                'domains': ['osf.ucr.edu'],
                'email_domains': [],
            },
            # {
            #     '_id': 'ugent',
            #     'name': 'Universiteit Gent [Test]',
            #     'description': None,
            #     'banner_name': 'ugent-banner.png',
            #     'logo_name': 'ugent-shield.png',
            #     'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://identity.ugent.be/simplesaml/saml2/idp/metadata.php')),
            #     'domains': ['osf.ugent.be'],
            #     'email_domains': [],
            # },
            {
                '_id': 'usc',
                'name': 'University of Southern California',
                'description': 'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name': 'usc-banner.png',
                'logo_name': 'usc-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:usc.edu')),
                'domains': ['osf.usc.edu'],
                'email_domains': [],
            },
            # {
            #     '_id': 'uva',
            #     'name': 'University of Virginia',
            #     'description': 'Projects must abide by the University <a href="http://www.virginia.edu/informationpolicy/security.html">Security and Data Protection Policies</a>',
            #     'banner_name': 'uva-banner.png',
            #     'logo_name': 'uva-shield.png',
            #     'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:virginia.edu')),
            #     'domains': ['osf.virginia.edu'],
            #     'email_domains': [],
            # },
        ]
    if env == 'stage':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage]',
                'description': 'Center for Open Science [Stage]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['staging-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame [Stage]',
                'description': 'University of Notre Dame [Stage]',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login-test.cc.nd.edu/idp/shibboleth')),
                'domains': ['staging-osf-nd.cos.io'],
                'email_domains': [],
            },
        ]
    if env == 'stage2':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage2]',
                'description': 'Center for Open Science [Stage2]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['staging2-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
        ]
    elif env == 'test':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Test]',
                'description': 'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['test-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame [Test]',
                'description': 'University of Notre Dame [Test]',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login-test.cc.nd.edu/idp/shibboleth')),
                'domains': ['test-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'ucr',
                'name': 'University of California Riverside [Test]',
                'description': 'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name': 'ucr-banner.png',
                'logo_name': 'ucr-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:ucr.edu')),
                'domains': ['test-osf-ucr.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'ugent',
                'name': 'Universiteit Gent [Test]',
                'description': 'Universiteit Gent [Test]',
                'banner_name': 'ugent-banner.png',
                'logo_name': 'ugent-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://identity.ugent.be/simplesaml/saml2/idp/metadata.php')),
                'domains': ['test-osf-ugent.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'usc',
                'name': 'University of Southern California [Test]',
                'description': 'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name': 'usc-banner.png',
                'logo_name': 'usc-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:usc.edu')),
                'domains': ['test-osf-usc.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'uva',
                'name': 'University of Virginia [Test]',
                'description': 'Projects must abide by the University <a href="http://www.virginia.edu/informationpolicy/security.html">Security and Data Protection Policies</a>',
                'banner_name': 'uva-banner.png',
                'logo_name': 'uva-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://shibidp-test.its.virginia.edu/idp/shibboleth')),
                'domains': ['test-osf-virginia.cos.io'],
                'email_domains': [],
            },
        ]

    init_app(routes=False)
    with TokuTransaction():
        for inst_data in INSTITUTIONS:
            new_inst, inst_created = update_or_create(inst_data)
            # update the nodes elastic docs, to have current names of institutions. This will
            # only work properly if this file is the only thing changing institution attributes
            if not inst_created:
                nodes = Node.find_by_institution(new_inst, query=Q('is_deleted', 'ne', True))
                for node in nodes:
                    update_node(node, async=False)
        for extra_inst in Institution.find(Q('_id', 'nin', [x['_id'] for x in INSTITUTIONS])):
            logger.warn('Extra Institution : {} - {}'.format(extra_inst._id, extra_inst.name))
Пример #32
0
def main(env):
    INSTITUTIONS = []

    if env == 'prod':
        INSTITUTIONS = [
            {
                '_id': 'busara',
                'name': 'Busara Center for Behavioral Economics',
                'description': 'The <a href="http://www.busaracenter.org/">Busara Center</a> for Behavioral Economics',
                'banner_name': 'busara-banner.png',
                'logo_name': 'busara-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['busaracenter.org'],
            },
            {
                '_id': 'colorado',
                'name': 'University of Colorado Boulder',
                'description': 'This service is supported by the Center for Research Data and Digital Scholarship, which is led by <a href="https://www.rc.colorado.edu/">Research Computing</a> and the <a href="http://www.colorado.edu/libraries/">University Libraries</a>.',
                'banner_name': 'colorado-banner.png',
                'logo_name': 'colorado-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('https://fedauth.colorado.edu/idp/shibboleth')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://osf.io/goodbye')),
                'domains': [],
                'email_domains': [],
            },
            {
                '_id': 'cos',
                'name': 'Center For Open Science',
                'description': 'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'esip',
                'name': 'Federation of Earth Science Information Partners (ESIP)',
                'description': '<a href="http://www.esipfed.org/">ESIP\'s</a> mission is to support the networking and data dissemination needs of our members and the global Earth science data community by linking the functional sectors of observation, research, application, education and use of Earth science.',
                'banner_name': 'esip-banner.png',
                'logo_name': 'esip-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['esipfed.org'],
            },
            {
                '_id': 'jhu',
                'name': 'Johns Hopkins University',
                'description': 'A research data service provided by the <a href="https://www.library.jhu.edu/">Sheridan Libraries</a>.',
                'banner_name': 'jhu-banner.png',
                'logo_name': 'jhu-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('urn:mace:incommon:johnshopkins.edu')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.data.jhu.edu'],
                'email_domains': [],
            },
            {
                '_id': 'ljaf',
                'name': 'Laura and John Arnold Foundation',
                'description': 'Projects listed below are for grants awarded by the Foundation. Please see the <a href="http://www.arnoldfoundation.org/wp-content/uploads/Guidelines-for-Investments-in-Research.pdf">LJAF Guidelines for Investments in Research</a> for more information and requirements.',
                'banner_name': 'ljaf-banner.png',
                'logo_name': 'ljaf-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['arnoldfoundation.org'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame',
                'description': 'In <a href="https://research.nd.edu/news/64035-notre-dame-center-for-open-science-partner-to-advance-open-science-initiatives/">partnership</a> with the <a href="https://crc.nd.edu">Center for Research Computing</a>, <a href="http://esc.nd.edu">Engineering &amp; Science Computing</a>, and the <a href="https://library.nd.edu">Hesburgh Libraries</a>',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('https://login.nd.edu/idp/shibboleth')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.nd.edu'],
                'email_domains': [],
            },
            {
                '_id': 'nyu',
                'name': 'New York University',
                'description': 'A Research Project and File Management Tool for the NYU Community: <a href="https://www.nyu.edu/research.html">Research at NYU</a> | <a href="http://guides.nyu.edu/data_management">Research Data Management Planning</a> | <a href="https://library.nyu.edu/services/research/">NYU Library Research Services</a> | <a href="https://nyu.qualtrics.com/jfe6/form/SV_8dFc5TpA1FgLUMd">Get Help</a>',
                'banner_name': 'nyu-banner.png',
                'logo_name': 'nyu-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('urn:mace:incommon:nyu.edu')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://shibboleth.nyu.edu/idp/profile/Logout')),
                'domains': ['osf.nyu.edu'],
                'email_domains': [],
            },
            {
                '_id': 'okstate',
                'name': 'Oklahoma State University',
                'description': '<a href="http://www.library.okstate.edu/research-support/research-data-services/">OSU Library Research Data Services</a>',
                'banner_name': 'okstate-banner.png',
                'logo_name': 'okstate-shield.png',
                'auth_url': None,  # https://stwcas.okstate.edu/cas/login?service=...
                'logout_url': None,
                'domains': ['osf.library.okstate.edu'],
                'email_domains': [],
            },
            {
                '_id': 'ucsd',
                'name': 'University of California San Diego',
                'description': 'This service is supported on campus by the UC San Diego Library for our research community. Do not use this service to store or transfer personally identifiable information, personal health information, or any other controlled unclassified information. For assistance please contact the Library\'s Research Data Curation Program at <a href="mailto:[email protected]">[email protected]</a>.',
                'banner_name': 'ucsd-banner.png',
                'logo_name': 'ucsd-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('urn:mace:incommon:ucsd.edu')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.ucsd.edu'],
                'email_domains': [],
            },
            {
                '_id': 'ucr',
                'name': 'University of California Riverside',
                'description': 'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name': 'ucr-banner.png',
                'logo_name': 'ucr-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('urn:mace:incommon:ucr.edu')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.ucr.edu'],
                'email_domains': [],
            },
            {
                '_id': 'ugent',
                'name': 'Universiteit Gent',
                'description': None,
                'banner_name': 'ugent-banner.png',
                'logo_name': 'ugent-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('https://identity.ugent.be/simplesaml/saml2/idp/metadata.php')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.ugent.be'],
                'email_domains': [],
            },
            {
                '_id': 'usc',
                'name': 'University of Southern California',
                'description': 'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name': 'usc-banner.png',
                'logo_name': 'usc-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('urn:mace:incommon:usc.edu')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.usc.edu'],
                'email_domains': [],
            },
            {
                '_id': 'uva',
                'name': 'University of Virginia',
                'description': 'In partnership with the <a href="http://www.virginia.edu/vpr/">Vice President for Research</a>, <a href="http://dsi.virginia.edu">Data Science Institute</a>, <a href="https://www.hsl.virginia.edu">Health Sciences Library</a>, and <a href="http://data.library.virginia.edu">University Library</a>. Learn more about <a href="http://cadre.virginia.edu">UVA resources for computational and data-driven research</a>. Projects must abide by the <a href="http://www.virginia.edu/informationpolicy/security.html">University Security and Data Protection Policies</a>.',
                'banner_name': 'uva-banner.png',
                'logo_name': 'uva-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('urn:mace:incommon:virginia.edu')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.virginia.edu'],
                'email_domains': [],
            },
            {
                '_id': 'vcu',
                'name': 'Virginia Commonwealth University',
                'description': 'This service is supported by the VCU Libraries and the VCU Office of Research and Innovation for our research community. Do not use this service to store or transfer personally identifiable information (PII), personal health information (PHI), or any other controlled unclassified information (CUI). VCU\'s policy entitled "<a href="http://www.policy.vcu.edu/sites/default/files/Research%20Data%20Ownership,%20Retention,%20Access%20and%20Securty.pdf">Research Data Ownership, Retention, Access and Security</a>" applies. For assistance please contact the <a href="https://www.library.vcu.edu/services/data/">VCU Libraries Research Data Management Program</a>.',
                'banner_name': 'vcu-banner.png',
                'logo_name': 'vcu-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('https://shibboleth.vcu.edu/idp/shibboleth')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.research.vcu.edu'],
                'email_domains': [],
            },
            {
                '_id': 'vt',
                'name': 'Virginia Tech',
                'description': None,
                'banner_name': 'vt-banner.png',
                'logo_name': 'vt-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('urn:mace:incommon:vt.edu')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.vt.edu'],
                'email_domains': [],
            },
        ]
    if env == 'stage':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage]',
                'description': 'Center for Open Science [Stage]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['staging-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame [Stage]',
                'description': 'University of Notre Dame [Stage]',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('https://login-test.cc.nd.edu/idp/shibboleth')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://staging.osf.io/goodbye')),
                'domains': ['staging-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'google',
                'name': 'Google [Stage]',
                'description': 'Google [Stage]',
                'banner_name': 'google-banner.png',
                'logo_name': 'google-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['gmail.com'],
            },
            {
                '_id': 'yahoo',
                'name': 'Yahoo [Stage]',
                'description': 'Yahoo [Stage]',
                'banner_name': 'yahoo-banner.png',
                'logo_name': 'yahoo-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['yahoo.com'],
            },
        ]
    if env == 'stage2':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage2]',
                'description': 'Center for Open Science [Stage2]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['staging2-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
        ]
    elif env == 'test':
        INSTITUTIONS = [
            {
                '_id': 'busara',
                'name': 'Busara Center for Behavioral Economics [Test]',
                'description': 'The <a href="http://www.busaracenter.org/">Busara Center</a> for Behavioral Economics',
                'banner_name': 'busara-banner.png',
                'logo_name': 'busara-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['busaracenter.org'],
            },
            {
                '_id': 'colorado',
                'name': 'University of Colorado Boulder [Test]',
                'description': 'This service is supported by the Center for Research Data and Digital Scholarship, which is led by <a href="https://www.rc.colorado.edu/">Research Computing</a> and the <a href="http://www.colorado.edu/libraries/">University Libraries</a>.',
                'banner_name': 'colorado-banner.png',
                'logo_name': 'colorado-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('https://fedauth.colorado.edu/idp/shibboleth')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://test.osf.io/goodbye')),
                'domains': [],
                'email_domains': [],
            },
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Test]',
                'description': 'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['test-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'esip',
                'name': 'Federation of Earth Science Information Partners (ESIP) [Test]',
                'description': '<a href="http://www.esipfed.org/">ESIP\'s</a> mission is to support the networking and data dissemination needs of our members and the global Earth science data community by linking the functional sectors of observation, research, application, education and use of Earth science.',
                'banner_name': 'esip-banner.png',
                'logo_name': 'esip-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['esipfed.org'],
            },
            {
                '_id': 'jhu',
                'name': 'Johns Hopkins University [Test]',
                'description': 'A research data service provided by the <a href="https://www.library.jhu.edu/">Sheridan Libraries</a>.',
                'banner_name': 'jhu-banner.png',
                'logo_name': 'jhu-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('urn:mace:incommon:johnshopkins.edu')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['osf.data.jhu.edu'],
                'email_domains': [],
            },
            {
                '_id': 'ljaf',
                'name': 'Laura and John Arnold Foundation [Test]',
                'description': 'Projects listed below are for grants awarded by the Foundation. Please see the <a href="http://www.arnoldfoundation.org/wp-content/uploads/Guidelines-for-Investments-in-Research.pdf">LJAF Guidelines for Investments in Research</a> for more information and requirements.',
                'banner_name': 'ljaf-banner.png',
                'logo_name': 'ljaf-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['arnoldfoundation.org'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame [Test]',
                'description': 'In <a href="https://research.nd.edu/news/64035-notre-dame-center-for-open-science-partner-to-advance-open-science-initiatives/">partnership</a> with the <a href="https://crc.nd.edu">Center for Research Computing</a>, <a href="http://esc.nd.edu">Engineering &amp; Science Computing</a>, and the <a href="https://library.nd.edu">Hesburgh Libraries</a>',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('https://login-test.cc.nd.edu/idp/shibboleth')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'nyu',
                'name': 'New York University [Test]',
                'description': 'A Research Project and File Management Tool for the NYU Community: <a href="https://www.nyu.edu/research.html">Research at NYU</a> | <a href="http://guides.nyu.edu/data_management">Research Data Management Planning</a> | <a href="https://library.nyu.edu/services/research/">NYU Library Research Services</a> | <a href="https://nyu.qualtrics.com/jfe6/form/SV_8dFc5TpA1FgLUMd">Get Help</a>',
                'banner_name': 'nyu-banner.png',
                'logo_name': 'nyu-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('https://shibbolethqa.es.its.nyu.edu/idp/shibboleth')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://shibbolethqa.es.its.nyu.edu/idp/profile/Logout')),
                'domains': ['test-osf-nyu.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'okstate',
                'name': 'Oklahoma State University [Test]',
                'description': '<a href="http://www.library.okstate.edu/research-support/research-data-services/">OSU Library Research Data Services</a>',
                'banner_name': 'okstate-banner.png',
                'logo_name': 'okstate-shield.png',
                'auth_url': None,  # https://stwcas.okstate.edu/cas/login?service=...
                'logout_url': None,
                'domains': ['test-osf-library-okstate.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'ucsd',
                'name': 'University of California San Diego [Test]',
                'description': 'This service is supported on campus by the UC San Diego Library for our research community. Do not use this service to store or transfer personally identifiable information, personal health information, or any other controlled unclassified information. For assistance please contact the Library\'s Research Data Curation Program at <a href="mailto:[email protected]">[email protected]</a>.',
                'banner_name': 'ucsd-banner.png',
                'logo_name': 'ucsd-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('urn:mace:incommon:ucsd.edu')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-ucsd.cos.io'],
                'email_domains': [],
            }, 
            {
                '_id': 'ucr',
                'name': 'University of California Riverside [Test]',
                'description': 'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name': 'ucr-banner.png',
                'logo_name': 'ucr-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('urn:mace:incommon:ucr.edu')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-ucr.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'ugent',
                'name': 'Universiteit Gent [Test]',
                'description': 'Universiteit Gent [Test]',
                'banner_name': 'ugent-banner.png',
                'logo_name': 'ugent-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('https://identity.ugent.be/simplesaml/saml2/idp/metadata.php')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-ugent.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'usc',
                'name': 'University of Southern California [Test]',
                'description': 'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name': 'usc-banner.png',
                'logo_name': 'usc-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('urn:mace:incommon:usc.edu')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-usc.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'uva',
                'name': 'University of Virginia [Test]',
                'description': 'In partnership with the <a href="http://www.virginia.edu/vpr/">Vice President for Research</a>, <a href="http://dsi.virginia.edu">Data Science Institute</a>, <a href="https://www.hsl.virginia.edu">Health Sciences Library</a>, and <a href="http://data.library.virginia.edu">University Library</a>. Learn more about <a href="http://cadre.virginia.edu">UVA resources for computational and data-driven research</a>. Projects must abide by the <a href="http://www.virginia.edu/informationpolicy/security.html">University Security and Data Protection Policies</a>.',
                'banner_name': 'uva-banner.png',
                'logo_name': 'uva-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('https://shibidp-test.its.virginia.edu/idp/shibboleth')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-virginia.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'vcu',
                'name': 'Virginia Commonwealth University [Test]',
                'description': 'This service is supported by the VCU Libraries and the VCU Office of Research and Innovation for our research community. Do not use this service to store or transfer personally identifiable information (PII), personal health information (PHI), or any other controlled unclassified information (CUI). VCU\'s policy entitled "<a href="http://www.policy.vcu.edu/sites/default/files/Research%20Data%20Ownership,%20Retention,%20Access%20and%20Securty.pdf">Research Data Ownership, Retention, Access and Security</a>" applies. For assistance please contact the <a href="https://www.library.vcu.edu/services/data/">VCU Libraries Research Data Management Program</a>.',
                'banner_name': 'vcu-banner.png',
                'logo_name': 'vcu-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('https://shibboleth.vcu.edu/idp/shibboleth')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-research-vcu.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'vt',
                'name': 'Virginia Tech [Test]',
                'description': None,
                'banner_name': 'vt-banner.png',
                'logo_name': 'vt-shield.png',
                'auth_url': SHIBBOLETH_SP_LOGIN.format(encode_uri_component('https://shib-pprd.middleware.vt.edu')),
                'logout_url': SHIBBOLETH_SP_LOGOUT.format(encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['osf.vt.edu'],
                'email_domains': [],
            },
        ]

    init_app(routes=False)
    with TokuTransaction():
        for inst_data in INSTITUTIONS:
            new_inst, inst_created = update_or_create(inst_data)
            # update the nodes elastic docs, to have current names of institutions. This will
            # only work properly if this file is the only thing changing institution attributes
            if not inst_created:
                nodes = Node.find_by_institutions(new_inst, query=Q('is_deleted', 'ne', True))
                for node in nodes:
                    update_node(node, async=False)
        for extra_inst in Institution.find(Q('_id', 'nin', [x['_id'] for x in INSTITUTIONS])):
            logger.warn('Extra Institution : {} - {}'.format(extra_inst._id, extra_inst.name))
Пример #33
0
 def get_queryset(self):
     return Institution.find(self.get_query_from_request())
Пример #34
0
    def test_institution_find(self):
        insts = list(Institution.find())

        assert_equal(len(insts), 1)
        assert_equal(insts[0], self.institution)
Пример #35
0
def main(env):
    INSTITUTIONS = []

    if env == 'prod':
        INSTITUTIONS = [
            {
                '_id': 'busara',
                'name': 'Busara Center for Behavioral Economics',
                'description':
                'The <a href="http://www.busaracenter.org/">Busara Center</a> for Behavioral Economics',
                'banner_name': 'busara-banner.png',
                'logo_name': 'busara-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['busaracenter.org'],
            },
            {
                '_id': 'cos',
                'name': 'Center For Open Science',
                'description':
                'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'esip',
                'name':
                'Federation of Earth Science Information Partners (ESIP)',
                'description':
                '<a href="http://www.esipfed.org/">ESIP\'s</a> mission is to support the networking and data dissemination needs of our members and the global Earth science data community by linking the functional sectors of observation, research, application, education and use of Earth science.',
                'banner_name': 'esip-banner.png',
                'logo_name': 'esip-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['esipfed.org'],
            },
            {
                '_id': 'ljaf',
                'name': 'Laura and John Arnold Foundation',
                'description':
                'Projects listed below are for grants awarded by the Foundation. Please see the <a href="http://www.arnoldfoundation.org/wp-content/uploads/Guidelines-for-Investments-in-Research.pdf">LJAF Guidelines for Investments in Research</a> for more information and requirements.',
                'banner_name': 'ljaf-banner.png',
                'logo_name': 'ljaf-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['arnoldfoundation.org'],
            },
            {
                '_id':
                'nd',
                'name':
                'University of Notre Dame',
                'description':
                'In <a href="https://research.nd.edu/news/64035-notre-dame-center-for-open-science-partner-to-advance-open-science-initiatives/">partnership</a> with the <a href="https://crc.nd.edu">Center for Research Computing</a>, <a href="http://esc.nd.edu">Engineering &amp; Science Computing</a>, and the <a href="https://library.nd.edu">Hesburgh Libraries</a>',
                'banner_name':
                'nd-banner.png',
                'logo_name':
                'nd-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://login.nd.edu/idp/shibboleth')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.nd.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'nyu',
                'name':
                'New York University',
                'description':
                'A Research Project and File Management Tool for the NYU Community: <a href="https://www.nyu.edu/research.html">Research at NYU</a> | <a href="http://guides.nyu.edu/data_management">Research Data Management Planning</a> | <a href="https://library.nyu.edu/services/research/">NYU Library Research Services</a> | <a href="https://nyu.qualtrics.com/jfe6/form/SV_8dFc5TpA1FgLUMd">Get Help</a>',
                'banner_name':
                'nyu-banner.png',
                'logo_name':
                'nyu-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:nyu.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component(
                        'https://shibboleth.nyu.edu/idp/profile/Logout')),
                'domains': ['osf.nyu.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'ucsd',
                'name':
                'University of California San Diego',
                'description':
                'This service is supported on campus by the UC San Diego Library for our research community. Do not use this service to store or transfer personally identifiable information, personal health information, or any other controlled unclassified information. For assistance please contact the Library\'s Research Data Curation Program at <a href="mailto:[email protected]">[email protected]</a>.',
                'banner_name':
                'ucsd-banner.png',
                'logo_name':
                'ucsd-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:ucsd.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.ucsd.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'ucr',
                'name':
                'University of California Riverside',
                'description':
                'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name':
                'ucr-banner.png',
                'logo_name':
                'ucr-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:ucr.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.ucr.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'ugent',
                'name':
                'Universiteit Gent',
                'description':
                None,
                'banner_name':
                'ugent-banner.png',
                'logo_name':
                'ugent-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://identity.ugent.be/simplesaml/saml2/idp/metadata.php'
                    )),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.ugent.be'],
                'email_domains': [],
            },
            {
                '_id':
                'usc',
                'name':
                'University of Southern California',
                'description':
                'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name':
                'usc-banner.png',
                'logo_name':
                'usc-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:usc.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.usc.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'uva',
                'name':
                'University of Virginia',
                'description':
                'In partnership with the <a href="http://www.virginia.edu/vpr/">Vice President for Research</a>, <a href="http://dsi.virginia.edu">Data Science Institute</a>, <a href="https://www.hsl.virginia.edu">Health Sciences Library</a>, and <a href="http://data.library.virginia.edu">University Library</a>. Learn more about <a href="http://cadre.virginia.edu">UVA resources for computational and data-driven research</a>. Projects must abide by the <a href="http://www.virginia.edu/informationpolicy/security.html">University Security and Data Protection Policies</a>.',
                'banner_name':
                'uva-banner.png',
                'logo_name':
                'uva-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:virginia.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.virginia.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'vt',
                'name':
                'Virginia Tech',
                'description':
                None,
                'banner_name':
                'vt-banner.png',
                'logo_name':
                'vt-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:vt.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.vt.edu'],
                'email_domains': [],
            },
        ]
    if env == 'stage':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage]',
                'description': 'Center for Open Science [Stage]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['staging-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id':
                'nd',
                'name':
                'University of Notre Dame [Stage]',
                'description':
                'University of Notre Dame [Stage]',
                'banner_name':
                'nd-banner.png',
                'logo_name':
                'nd-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://login-test.cc.nd.edu/idp/shibboleth')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://staging.osf.io/goodbye')),
                'domains': ['staging-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'google',
                'name': 'Google [Stage]',
                'description': 'Google [Stage]',
                'banner_name': 'google-banner.png',
                'logo_name': 'google-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['gmail.com'],
            },
            {
                '_id': 'yahoo',
                'name': 'Yahoo [Stage]',
                'description': 'Yahoo [Stage]',
                'banner_name': 'yahoo-banner.png',
                'logo_name': 'yahoo-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['yahoo.com'],
            },
        ]
    if env == 'stage2':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage2]',
                'description': 'Center for Open Science [Stage2]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['staging2-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
        ]
    elif env == 'test':
        INSTITUTIONS = [
            {
                '_id': 'busara',
                'name': 'Busara Center for Behavioral Economics [Test]',
                'description':
                'The <a href="http://www.busaracenter.org/">Busara Center</a> for Behavioral Economics',
                'banner_name': 'busara-banner.png',
                'logo_name': 'busara-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['busaracenter.org'],
            },
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Test]',
                'description':
                'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['test-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'esip',
                'name':
                'Federation of Earth Science Information Partners (ESIP) [Test]',
                'description':
                '<a href="http://www.esipfed.org/">ESIP\'s</a> mission is to support the networking and data dissemination needs of our members and the global Earth science data community by linking the functional sectors of observation, research, application, education and use of Earth science.',
                'banner_name': 'esip-banner.png',
                'logo_name': 'esip-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['esipfed.org'],
            },
            {
                '_id': 'ljaf',
                'name': 'Laura and John Arnold Foundation [Test]',
                'description':
                'Projects listed below are for grants awarded by the Foundation. Please see the <a href="http://www.arnoldfoundation.org/wp-content/uploads/Guidelines-for-Investments-in-Research.pdf">LJAF Guidelines for Investments in Research</a> for more information and requirements.',
                'banner_name': 'ljaf-banner.png',
                'logo_name': 'ljaf-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['arnoldfoundation.org'],
            },
            {
                '_id':
                'nd',
                'name':
                'University of Notre Dame [Test]',
                'description':
                'In <a href="https://research.nd.edu/news/64035-notre-dame-center-for-open-science-partner-to-advance-open-science-initiatives/">partnership</a> with the <a href="https://crc.nd.edu">Center for Research Computing</a>, <a href="http://esc.nd.edu">Engineering &amp; Science Computing</a>, and the <a href="https://library.nd.edu">Hesburgh Libraries</a>',
                'banner_name':
                'nd-banner.png',
                'logo_name':
                'nd-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://login-test.cc.nd.edu/idp/shibboleth')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'nyu',
                'name':
                'New York University [Test]',
                'description':
                'A Research Project and File Management Tool for the NYU Community: <a href="https://www.nyu.edu/research.html">Research at NYU</a> | <a href="http://guides.nyu.edu/data_management">Research Data Management Planning</a> | <a href="https://library.nyu.edu/services/research/">NYU Library Research Services</a> | <a href="https://nyu.qualtrics.com/jfe6/form/SV_8dFc5TpA1FgLUMd">Get Help</a>',
                'banner_name':
                'nyu-banner.png',
                'logo_name':
                'nyu-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://shibbolethqa.es.its.nyu.edu/idp/shibboleth')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component(
                        'https://shibbolethqa.es.its.nyu.edu/idp/profile/Logout'
                    )),
                'domains': ['test-osf-nyu.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'ucsd',
                'name':
                'University of California San Diego [Test]',
                'description':
                'This service is supported on campus by the UC San Diego Library for our research community. Do not use this service to store or transfer personally identifiable information, personal health information, or any other controlled unclassified information. For assistance please contact the Library\'s Research Data Curation Program at <a href="mailto:[email protected]">[email protected]</a>.',
                'banner_name':
                'ucsd-banner.png',
                'logo_name':
                'ucsd-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:ucsd.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['test-osf-ucsd.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'ucr',
                'name':
                'University of California Riverside [Test]',
                'description':
                'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name':
                'ucr-banner.png',
                'logo_name':
                'ucr-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:ucr.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-ucr.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'ugent',
                'name':
                'Universiteit Gent [Test]',
                'description':
                'Universiteit Gent [Test]',
                'banner_name':
                'ugent-banner.png',
                'logo_name':
                'ugent-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://identity.ugent.be/simplesaml/saml2/idp/metadata.php'
                    )),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-ugent.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'usc',
                'name':
                'University of Southern California [Test]',
                'description':
                'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name':
                'usc-banner.png',
                'logo_name':
                'usc-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:usc.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-usc.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'uva',
                'name':
                'University of Virginia [Test]',
                'description':
                'In partnership with the <a href="http://www.virginia.edu/vpr/">Vice President for Research</a>, <a href="http://dsi.virginia.edu">Data Science Institute</a>, <a href="https://www.hsl.virginia.edu">Health Sciences Library</a>, and <a href="http://data.library.virginia.edu">University Library</a>. Learn more about <a href="http://cadre.virginia.edu">UVA resources for computational and data-driven research</a>. Projects must abide by the <a href="http://www.virginia.edu/informationpolicy/security.html">University Security and Data Protection Policies</a>.',
                'banner_name':
                'uva-banner.png',
                'logo_name':
                'uva-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://shibidp-test.its.virginia.edu/idp/shibboleth')
                ),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-virginia.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'vt',
                'name':
                'Virginia Tech [Test]',
                'description':
                None,
                'banner_name':
                'vt-banner.png',
                'logo_name':
                'vt-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://shib-pprd.middleware.vt.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['osf.vt.edu'],
                'email_domains': [],
            },
        ]

    init_app(routes=False)
    with TokuTransaction():
        for inst_data in INSTITUTIONS:
            new_inst, inst_created = update_or_create(inst_data)
            # update the nodes elastic docs, to have current names of institutions. This will
            # only work properly if this file is the only thing changing institution attributes
            if not inst_created:
                nodes = Node.find_by_institutions(new_inst,
                                                  query=Q(
                                                      'is_deleted', 'ne',
                                                      True))
                for node in nodes:
                    update_node(node, async=False)
        for extra_inst in Institution.find(
                Q('_id', 'nin', [x['_id'] for x in INSTITUTIONS])):
            logger.warn('Extra Institution : {} - {}'.format(
                extra_inst._id, extra_inst.name))
Пример #36
0
def main(env):
    INSTITUTIONS = []

    if env == 'prod':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science',
                'description': 'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            # {
            #     '_id': 'nd',
            #     'name': 'University of Notre Dame',
            #     'description': None,
            #     'banner_name': 'nd-banner.png',
            #     'logo_name': 'nd-shield.png',
            #     'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login.nd.edu/idp/shibboleth')),
            #     'domains': ['osf.nd.edu'],
            #     'email_domains': [],
            # },
            {
                '_id': 'ucr',
                'name': 'University of California Riverside',
                'description': 'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name': 'ucr-banner.png',
                'logo_name': 'ucr-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:ucr.edu')),
                'domains': ['osf.ucr.edu'],
                'email_domains': [],
            },
            {
                '_id': 'usc',
                'name': 'University of Southern California',
                'description': 'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name': 'usc-banner.png',
                'logo_name': 'usc-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:usc.edu')),
                'domains': ['osf.usc.edu'],
                'email_domains': [],
            },
        ]
    if env == 'stage':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage]',
                'description': 'Center for Open Science [Stage]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['staging-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame [Stage]',
                'description': 'University of Notre Dame [Stage]',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login-test.cc.nd.edu/idp/shibboleth')),
                'domains': ['staging-osf-nd.cos.io'],
                'email_domains': [],
            },
        ]
    if env == 'stage2':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage2]',
                'description': 'Center for Open Science [Stage2]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['staging2-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
        ]
    elif env == 'test':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Test]',
                'description': 'Center for Open Science [Test]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['test-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'nd',
                'name': 'University of Notre Dame [Test]',
                'description': 'University of Notre Dame [Test]',
                'banner_name': 'nd-banner.png',
                'logo_name': 'nd-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login-test.cc.nd.edu/idp/shibboleth')),
                'domains': ['test-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'ucr',
                'name': 'University of California Riverside [Test]',
                'description': 'University of California Riverside [Test]',
                'banner_name': 'ucr-banner.png',
                'logo_name': 'ucr-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:ucr.edu')),
                'domains': ['test-osf-ucr.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'usc',
                'name': 'University of Southern California [Test]',
                'description': 'University of Southern California [Test]',
                'banner_name': 'usc-banner.png',
                'logo_name': 'usc-shield.png',
                'auth_url': SHIBBOLETH_SP.format(encode_uri_component('urn:mace:incommon:usc.edu')),
                'domains': ['test-osf-usc.cos.io'],
                'email_domains': [],
            },
        ]

    init_app(routes=False)
    with TokuTransaction():
        for inst_data in INSTITUTIONS:
            new_inst, inst_created = update_or_create(inst_data)
            # update the nodes elastic docs, to have current names of institutions. This will
            # only work properly if this file is the only thign changing institution attributes
            if not inst_created:
                nodes = Node.find_by_institution(new_inst, query=Q('is_deleted', 'ne', True))
                for node in nodes:
                    update_node(node, async=False)
        for extra_inst in Institution.find(Q('_id', 'nin', [x['_id'] for x in INSTITUTIONS])):
            logger.warn('Extra Institution : {} - {}'.format(extra_inst._id, extra_inst.name))
Пример #37
0
 def get_queryset(self):
     return Institution.find(self.get_query_from_request())
Пример #38
0
    def authenticate(self, request):
        """
        Handle CAS institution authentication request.

        The JWT `data` payload is expected in the following structure:
        {
            "provider": {
                "idp":  "",
                "id":   "",
                "user": {
                    "username":     "",
                    "fullname":     "",
                    "familyName":   "",
                    "givenName":    "",
                    "middleNames":  "",
                    "suffix":       "",
                }
            }
        }

        :param request: the POST request
        :return: user, None if authentication succeed
        :raises: AuthenticationFailed if authentication fails
        """

        try:
            payload = jwt.decode(jwe.decrypt(request.body,
                                             settings.JWE_SECRET),
                                 settings.JWT_SECRET,
                                 options={'verify_exp': False},
                                 algorithm='HS256')
        except (jwt.InvalidTokenError, TypeError):
            raise AuthenticationFailed

        data = json.loads(payload['data'])
        provider = data['provider']

        institution = Institution.load(provider['id'])
        if not institution:
            raise AuthenticationFailed(
                'Invalid institution id specified "{}"'.format(provider['id']))

        username = provider['user'].get('username')
        fullname = provider['user'].get('fullname')
        given_name = provider['user'].get('givenName')
        family_name = provider['user'].get('familyName')
        middle_names = provider['user'].get('middleNames')
        suffix = provider['user'].get('suffix')

        # use given name and family name to build full name if not provided
        if given_name and family_name and not fullname:
            fullname = given_name + ' ' + family_name

        # institution must provide `fullname`, otherwise we fail the authentication and inform sentry
        if not fullname:
            message = 'Institution login failed: fullname required' \
                      ' for user {} from institution {}'.format(username, provider['id'])
            sentry.log_message(message)
            raise AuthenticationFailed(message)

        # `get_or_create_user()` guesses names from fullname
        # replace the guessed ones if the names are provided from the authentication
        user, created = get_or_create_user(fullname,
                                           username,
                                           reset_password=False)
        if created:
            if given_name:
                user.given_name = given_name
            if family_name:
                user.family_name = family_name
            if middle_names:
                user.middle_names = middle_names
            if suffix:
                user.suffix = suffix
            user.update_date_last_login()

            # save and register user
            user.save()
            user.register(username)

            # send confirmation email
            send_mail(to_addr=user.username,
                      mail=WELCOME_OSF4I,
                      mimetype='html',
                      user=user)

        if not user.is_affiliated_with_institution(institution):
            user.affiliated_institutions.add(institution)
            user.save()

        return user, None
Пример #39
0
def main(env):
    INSTITUTIONS = []

    if env == 'prod':
        INSTITUTIONS = [
            {
                '_id': 'busara',
                'name': 'Busara Center for Behavioral Economics',
                'description':
                'The <a href="http://www.busaracenter.org/">Busara Center</a> for Behavioral Economics',
                'banner_name': 'busara-banner.png',
                'logo_name': 'busara-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['busaracenter.org'],
            },
            {
                '_id':
                'colorado',
                'name':
                'University of Colorado Boulder',
                'description':
                'This service is supported by the Center for Research Data and Digital Scholarship, which is led by <a href="https://www.rc.colorado.edu/">Research Computing</a> and the <a href="http://www.colorado.edu/libraries/">University Libraries</a>.',
                'banner_name':
                'colorado-banner.png',
                'logo_name':
                'colorado-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://fedauth.colorado.edu/idp/shibboleth')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': [],
                'email_domains': [],
            },
            {
                '_id': 'cos',
                'name': 'Center For Open Science',
                'description':
                'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'esip',
                'name':
                'Federation of Earth Science Information Partners (ESIP)',
                'description':
                '<a href="http://www.esipfed.org/">ESIP\'s</a> mission is to support the networking and data dissemination needs of our members and the global Earth science data community by linking the functional sectors of observation, research, application, education and use of Earth science.',
                'banner_name': 'esip-banner.png',
                'logo_name': 'esip-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['esipfed.org'],
            },
            {
                '_id':
                'jhu',
                'name':
                'Johns Hopkins University',
                'description':
                'A research data service provided by the <a href="https://www.library.jhu.edu/">Sheridan Libraries</a>.',
                'banner_name':
                'jhu-banner.png',
                'logo_name':
                'jhu-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'urn:mace:incommon:johnshopkins.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.data.jhu.edu'],
                'email_domains': [],
            },
            {
                '_id': 'ljaf',
                'name': 'Laura and John Arnold Foundation',
                'description':
                'Projects listed below are for grants awarded by the Foundation. Please see the <a href="http://www.arnoldfoundation.org/wp-content/uploads/Guidelines-for-Investments-in-Research.pdf">LJAF Guidelines for Investments in Research</a> for more information and requirements.',
                'banner_name': 'ljaf-banner.png',
                'logo_name': 'ljaf-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['arnoldfoundation.org'],
            },
            {
                '_id': 'mli',
                'name': 'Mind & Life Institute',
                'description':
                'Funding rigorous research in the field of contemplative science to understand the human mind for the purpose of reducing suffering. Learn more about <a href="https://www.mindandlife.org">Mind & Life research funding and other programs</a>.',
                'banner_name': 'mli-banner.png',
                'logo_name': 'mli-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['research.mindandlife.org'],
                'email_domains': ['mindandlife.org'],
            },
            {
                '_id':
                'nd',
                'name':
                'University of Notre Dame',
                'description':
                'In <a href="https://research.nd.edu/news/64035-notre-dame-center-for-open-science-partner-to-advance-open-science-initiatives/">partnership</a> with the <a href="https://crc.nd.edu">Center for Research Computing</a>, <a href="http://esc.nd.edu">Engineering &amp; Science Computing</a>, and the <a href="https://library.nd.edu">Hesburgh Libraries</a>',
                'banner_name':
                'nd-banner.png',
                'logo_name':
                'nd-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://login.nd.edu/idp/shibboleth')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.nd.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'nyu',
                'name':
                'New York University',
                'description':
                'A Research Project and File Management Tool for the NYU Community: <a href="https://www.nyu.edu/research.html">Research at NYU</a> | <a href="http://guides.nyu.edu/data_management">Research Data Management Planning</a> | <a href="https://library.nyu.edu/services/research/">NYU Library Research Services</a> | <a href="https://nyu.qualtrics.com/jfe6/form/SV_8dFc5TpA1FgLUMd">Get Help</a>',
                'banner_name':
                'nyu-banner.png',
                'logo_name':
                'nyu-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:nyu.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component(
                        'https://shibboleth.nyu.edu/idp/profile/Logout')),
                'domains': ['osf.nyu.edu'],
                'email_domains': [],
            },
            {
                '_id': 'okstate',
                'name': 'Oklahoma State University',
                'description':
                '<a href="http://www.library.okstate.edu/research-support/research-data-services/">OSU Library Research Data Services</a>',
                'banner_name': 'okstate-banner.png',
                'logo_name': 'okstate-shield.png',
                'auth_url':
                None,  # https://stwcas.okstate.edu/cas/login?service=...
                'logout_url': None,
                'domains': ['osf.library.okstate.edu'],
                'email_domains': [],
            },
            {
                '_id': 'thelabatdc',
                'name': 'The Lab @ DC',
                'description':
                'The Lab @ DC is an entity of the <a href="https://mayor.dc.gov/">Executive Office of the Mayor of the District of Columbia Government</a>. We work in the <a href="https://oca.dc.gov/">Office of the City Administrator</a> and in partnership with a network of universities and research centers to apply the scientific method into day-to-day governance.',
                'banner_name': 'thelabatdc-banner.png',
                'logo_name': 'thelabatdc-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['dc.gov'],
            },
            {
                '_id':
                'ucsd',
                'name':
                'University of California San Diego',
                'description':
                'This service is supported on campus by the UC San Diego Library for our research community. Do not use this service to store or transfer personally identifiable information, personal health information, or any other controlled unclassified information. For assistance please contact the Library\'s Research Data Curation Program at <a href="mailto:[email protected]">[email protected]</a>.',
                'banner_name':
                'ucsd-banner.png',
                'logo_name':
                'ucsd-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:ucsd.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.ucsd.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'ucr',
                'name':
                'University of California Riverside',
                'description':
                'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name':
                'ucr-banner.png',
                'logo_name':
                'ucr-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:ucr.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.ucr.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'uct',
                'name':
                'University of Cape Town',
                'description':
                '<a href="http://www.lib.uct.ac.za/">UCT Libraries</a>, <a href="http://www.eresearch.uct.ac.za/">UCT eResearch</a> &amp; <a href="http://www.icts.uct.ac.za/">ICTS</a> present the UCT OSF institutional service to UCT affiliated students, staff and researchers. The UCT OSF facility should be used in conjunction with the institution\'s <a href="http://www.digitalservices.lib.uct.ac.za/dls/rdm-policy">Research Data Management (RDM) Policy</a>, <a href="https://www.uct.ac.za/downloads/uct.ac.za/about/policies/UCTOpenAccessPolicy.pdf">Open Access Policy</a> and <a href="https://www.uct.ac.za/downloads/uct.ac.za/about/policies/UCTOpenAccessPolicy.pdf">IP Policy</a>. Visit the <a href="http://www.digitalservices.lib.uct.ac.za/">UCT Digital Library Services</a> for more information and/or assistance with <a href="http://www.digitalservices.lib.uct.ac.za/dls/rdm">RDM</a> and <a href="http://www.digitalservices.lib.uct.ac.za/dls/data-sharing-guidelines">data sharing</a>. We also encourage the use of UCT Libraries\'s Data Management Planning tool, <a href="http://dmp.lib.uct.ac.za/about_us">DMPonline</a>',
                'banner_name':
                'uct-banner.png',
                'logo_name':
                'uct-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'http://adfs.uct.ac.za/adfs/services/trust')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.uct.ac.za'],
                'email_domains': [],
            },
            {
                '_id':
                'ugent',
                'name':
                'Universiteit Gent',
                'description':
                None,
                'banner_name':
                'ugent-banner.png',
                'logo_name':
                'ugent-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://identity.ugent.be/simplesaml/saml2/idp/metadata.php'
                    )),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.ugent.be'],
                'email_domains': [],
            },
            {
                '_id':
                'usc',
                'name':
                'University of Southern California',
                'description':
                'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name':
                'usc-banner.png',
                'logo_name':
                'usc-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:usc.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.usc.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'uva',
                'name':
                'University of Virginia',
                'description':
                'In partnership with the <a href="http://www.virginia.edu/vpr/">Vice President for Research</a>, <a href="http://dsi.virginia.edu">Data Science Institute</a>, <a href="https://www.hsl.virginia.edu">Health Sciences Library</a>, and <a href="http://data.library.virginia.edu">University Library</a>. Learn more about <a href="http://cadre.virginia.edu">UVA resources for computational and data-driven research</a>. Projects must abide by the <a href="http://www.virginia.edu/informationpolicy/security.html">University Security and Data Protection Policies</a>.',
                'banner_name':
                'uva-banner.png',
                'logo_name':
                'uva-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:virginia.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.virginia.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'uw',
                'name':
                'University of Washington',
                'description':
                'This service is supported by the University of Washington Libraries. Do not use this service to store or transfer personally identifiable information or personal health information. Questions? Email the Libraries Research Data Services Unit at <a href="mailto:[email protected]">[email protected]</a>.',
                'banner_name':
                'uw-banner.png',
                'logo_name':
                'uw-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:washington.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': [],
                'email_domains': [],
            },
            {
                '_id':
                'vcu',
                'name':
                'Virginia Commonwealth University',
                'description':
                'This service is supported by the VCU Libraries and the VCU Office of Research and Innovation for our research community. Do not use this service to store or transfer personally identifiable information (PII), personal health information (PHI), or any other controlled unclassified information (CUI). VCU\'s policy entitled "<a href="http://www.policy.vcu.edu/sites/default/files/Research%20Data%20Ownership,%20Retention,%20Access%20and%20Securty.pdf">Research Data Ownership, Retention, Access and Security</a>" applies. For assistance please contact the <a href="https://www.library.vcu.edu/services/data/">VCU Libraries Research Data Management Program</a>.',
                'banner_name':
                'vcu-banner.png',
                'logo_name':
                'vcu-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://shibboleth.vcu.edu/idp/shibboleth')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.research.vcu.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'vt',
                'name':
                'Virginia Tech',
                'description':
                None,
                'banner_name':
                'vt-banner.png',
                'logo_name':
                'vt-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:vt.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://osf.io/goodbye')),
                'domains': ['osf.vt.edu'],
                'email_domains': [],
            },
        ]
    if env == 'stage':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage]',
                'description': 'Center for Open Science [Stage]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['staging-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id':
                'nd',
                'name':
                'University of Notre Dame [Stage]',
                'description':
                'University of Notre Dame [Stage]',
                'banner_name':
                'nd-banner.png',
                'logo_name':
                'nd-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://login-test.cc.nd.edu/idp/shibboleth')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://staging.osf.io/goodbye')),
                'domains': ['staging-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'google',
                'name': 'Google [Stage]',
                'description': 'Google [Stage]',
                'banner_name': 'google-banner.png',
                'logo_name': 'google-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['gmail.com'],
            },
            {
                '_id': 'yahoo',
                'name': 'Yahoo [Stage]',
                'description': 'Yahoo [Stage]',
                'banner_name': 'yahoo-banner.png',
                'logo_name': 'yahoo-shield.png',
                'auth_url': None,
                'domains': [],
                'email_domains': ['yahoo.com'],
            },
        ]
    if env == 'stage2':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage2]',
                'description': 'Center for Open Science [Stage2]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['staging2-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
        ]
    elif env == 'test':
        INSTITUTIONS = [
            {
                '_id': 'busara',
                'name': 'Busara Center for Behavioral Economics [Test]',
                'description':
                'The <a href="http://www.busaracenter.org/">Busara Center</a> for Behavioral Economics',
                'banner_name': 'busara-banner.png',
                'logo_name': 'busara-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['busaracenter.org'],
            },
            {
                '_id':
                'colorado',
                'name':
                'University of Colorado Boulder [Test]',
                'description':
                'This service is supported by the Center for Research Data and Digital Scholarship, which is led by <a href="https://www.rc.colorado.edu/">Research Computing</a> and the <a href="http://www.colorado.edu/libraries/">University Libraries</a>.',
                'banner_name':
                'colorado-banner.png',
                'logo_name':
                'colorado-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://fedauth.colorado.edu/idp/shibboleth')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': [],
                'email_domains': [],
            },
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Test]',
                'description':
                'COS is a non-profit technology company providing free and open services to increase inclusivity and transparency of research. Find out more at <a href="https://cos.io">cos.io</a>.',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['test-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id': 'esip',
                'name':
                'Federation of Earth Science Information Partners (ESIP) [Test]',
                'description':
                '<a href="http://www.esipfed.org/">ESIP\'s</a> mission is to support the networking and data dissemination needs of our members and the global Earth science data community by linking the functional sectors of observation, research, application, education and use of Earth science.',
                'banner_name': 'esip-banner.png',
                'logo_name': 'esip-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['esipfed.org'],
            },
            {
                '_id':
                'jhu',
                'name':
                'Johns Hopkins University [Test]',
                'description':
                'A research data service provided by the <a href="https://www.library.jhu.edu/">Sheridan Libraries</a>.',
                'banner_name':
                'jhu-banner.png',
                'logo_name':
                'jhu-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'urn:mace:incommon:johnshopkins.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['osf.data.jhu.edu'],
                'email_domains': [],
            },
            {
                '_id': 'ljaf',
                'name': 'Laura and John Arnold Foundation [Test]',
                'description':
                'Projects listed below are for grants awarded by the Foundation. Please see the <a href="http://www.arnoldfoundation.org/wp-content/uploads/Guidelines-for-Investments-in-Research.pdf">LJAF Guidelines for Investments in Research</a> for more information and requirements.',
                'banner_name': 'ljaf-banner.png',
                'logo_name': 'ljaf-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['arnoldfoundation.org'],
            },
            {
                '_id': 'mli',
                'name': 'Mind & Life Institute [Test]',
                'description':
                'Funding rigorous research in the field of contemplative science to understand the human mind for the purpose of reducing suffering. Learn more about <a href="https://www.mindandlife.org">Mind & Life research funding and other programs</a>.',
                'banner_name': 'mli-banner.png',
                'logo_name': 'mli-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': ['research.mindandlife.org'],
                'email_domains': ['mindandlife.org'],
            },
            {
                '_id':
                'nd',
                'name':
                'University of Notre Dame [Test]',
                'description':
                'In <a href="https://research.nd.edu/news/64035-notre-dame-center-for-open-science-partner-to-advance-open-science-initiatives/">partnership</a> with the <a href="https://crc.nd.edu">Center for Research Computing</a>, <a href="http://esc.nd.edu">Engineering &amp; Science Computing</a>, and the <a href="https://library.nd.edu">Hesburgh Libraries</a>',
                'banner_name':
                'nd-banner.png',
                'logo_name':
                'nd-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://login-test.cc.nd.edu/idp/shibboleth')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'nyu',
                'name':
                'New York University [Test]',
                'description':
                'A Research Project and File Management Tool for the NYU Community: <a href="https://www.nyu.edu/research.html">Research at NYU</a> | <a href="http://guides.nyu.edu/data_management">Research Data Management Planning</a> | <a href="https://library.nyu.edu/services/research/">NYU Library Research Services</a> | <a href="https://nyu.qualtrics.com/jfe6/form/SV_8dFc5TpA1FgLUMd">Get Help</a>',
                'banner_name':
                'nyu-banner.png',
                'logo_name':
                'nyu-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://shibbolethqa.es.its.nyu.edu/idp/shibboleth')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component(
                        'https://shibbolethqa.es.its.nyu.edu/idp/profile/Logout'
                    )),
                'domains': ['test-osf-nyu.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'okstate',
                'name': 'Oklahoma State University [Test]',
                'description':
                '<a href="http://www.library.okstate.edu/research-support/research-data-services/">OSU Library Research Data Services</a>',
                'banner_name': 'okstate-banner.png',
                'logo_name': 'okstate-shield.png',
                'auth_url':
                None,  # https://stwcas.okstate.edu/cas/login?service=...
                'logout_url': None,
                'domains': ['test-osf-library-okstate.cos.io'],
                'email_domains': [],
            },
            {
                '_id': 'thelabatdc',
                'name': 'The Lab @ DC',
                'description':
                'The Lab @ DC is an entity of the <a href="https://mayor.dc.gov/">Executive Office of the Mayor of the District of Columbia Government</a>. We work in the <a href="https://oca.dc.gov/">Office of the City Administrator</a> and in partnership with a network of universities and research centers to apply the scientific method into day-to-day governance.',
                'banner_name': 'thelabatdc-banner.png',
                'logo_name': 'thelabatdc-shield.png',
                'auth_url': None,
                'logout_url': None,
                'domains': [],
                'email_domains': ['dc.gov'],
            },
            {
                '_id':
                'ucsd',
                'name':
                'University of California San Diego [Test]',
                'description':
                'This service is supported on campus by the UC San Diego Library for our research community. Do not use this service to store or transfer personally identifiable information, personal health information, or any other controlled unclassified information. For assistance please contact the Library\'s Research Data Curation Program at <a href="mailto:[email protected]">[email protected]</a>.',
                'banner_name':
                'ucsd-banner.png',
                'logo_name':
                'ucsd-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:ucsd.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-ucsd.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'ucr',
                'name':
                'University of California Riverside [Test]',
                'description':
                'Policy prohibits storing PII or HIPAA data on this site, please see C&amp;C\'s <a href="http://cnc.ucr.edu/security/researchers.html">security site</a> for more information.',
                'banner_name':
                'ucr-banner.png',
                'logo_name':
                'ucr-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:ucr.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-ucr.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'uct',
                'name':
                'University of Cape Town [Test]',
                'description':
                '<a href="http://www.lib.uct.ac.za/">UCT Libraries</a>, <a href="http://www.eresearch.uct.ac.za/">UCT eResearch</a> &amp; <a href="http://www.icts.uct.ac.za/">ICTS</a> present the UCT OSF institutional service to UCT affiliated students, staff and researchers. The UCT OSF facility should be used in conjunction with the institution\'s <a href="http://www.digitalservices.lib.uct.ac.za/dls/rdm-policy">Research Data Management (RDM) Policy</a>, <a href="https://www.uct.ac.za/downloads/uct.ac.za/about/policies/UCTOpenAccessPolicy.pdf">Open Access Policy</a> and <a href="https://www.uct.ac.za/downloads/uct.ac.za/about/policies/UCTOpenAccessPolicy.pdf">IP Policy</a>. Visit the <a href="http://www.digitalservices.lib.uct.ac.za/">UCT Digital Library Services</a> for more information and/or assistance with <a href="http://www.digitalservices.lib.uct.ac.za/dls/rdm">RDM</a> and <a href="http://www.digitalservices.lib.uct.ac.za/dls/data-sharing-guidelines">data sharing</a>. We also encourage the use of UCT Libraries\'s Data Management Planning tool, <a href="http://dmp.lib.uct.ac.za/about_us">DMPonline</a>',
                'banner_name':
                'uct-banner.png',
                'logo_name':
                'uct-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'http://adfs.uct.ac.za/adfs/services/trust')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['osf.uct.ac.za'],
                'email_domains': [],
            },
            {
                '_id':
                'ugent',
                'name':
                'Universiteit Gent [Test]',
                'description':
                'Universiteit Gent [Test]',
                'banner_name':
                'ugent-banner.png',
                'logo_name':
                'ugent-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://identity.ugent.be/simplesaml/saml2/idp/metadata.php'
                    )),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-ugent.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'usc',
                'name':
                'University of Southern California [Test]',
                'description':
                'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name':
                'usc-banner.png',
                'logo_name':
                'usc-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:usc.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-usc.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'uva',
                'name':
                'University of Virginia [Test]',
                'description':
                'In partnership with the <a href="http://www.virginia.edu/vpr/">Vice President for Research</a>, <a href="http://dsi.virginia.edu">Data Science Institute</a>, <a href="https://www.hsl.virginia.edu">Health Sciences Library</a>, and <a href="http://data.library.virginia.edu">University Library</a>. Learn more about <a href="http://cadre.virginia.edu">UVA resources for computational and data-driven research</a>. Projects must abide by the <a href="http://www.virginia.edu/informationpolicy/security.html">University Security and Data Protection Policies</a>.',
                'banner_name':
                'uva-banner.png',
                'logo_name':
                'uva-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://shibidp-test.its.virginia.edu/idp/shibboleth')
                ),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-virginia.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'uw',
                'name':
                'University of Washington [Test]',
                'description':
                'This service is supported by the University of Washington Libraries. Do not use this service to store or transfer personally identifiable information or personal health information. Questions? Email the Libraries Research Data Services Unit at <a href="mailto:[email protected]">[email protected]</a>.',
                'banner_name':
                'uw-banner.png',
                'logo_name':
                'uw-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component('urn:mace:incommon:washington.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': [],
                'email_domains': [],
            },
            {
                '_id':
                'vcu',
                'name':
                'Virginia Commonwealth University [Test]',
                'description':
                'This service is supported by the VCU Libraries and the VCU Office of Research and Innovation for our research community. Do not use this service to store or transfer personally identifiable information (PII), personal health information (PHI), or any other controlled unclassified information (CUI). VCU\'s policy entitled "<a href="http://www.policy.vcu.edu/sites/default/files/Research%20Data%20Ownership,%20Retention,%20Access%20and%20Securty.pdf">Research Data Ownership, Retention, Access and Security</a>" applies. For assistance please contact the <a href="https://www.library.vcu.edu/services/data/">VCU Libraries Research Data Management Program</a>.',
                'banner_name':
                'vcu-banner.png',
                'logo_name':
                'vcu-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://shibboleth.vcu.edu/idp/shibboleth')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['test-osf-research-vcu.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'vt',
                'name':
                'Virginia Tech [Test]',
                'description':
                None,
                'banner_name':
                'vt-banner.png',
                'logo_name':
                'vt-shield.png',
                'auth_url':
                SHIBBOLETH_SP_LOGIN.format(
                    encode_uri_component(
                        'https://shib-pprd.middleware.vt.edu')),
                'logout_url':
                SHIBBOLETH_SP_LOGOUT.format(
                    encode_uri_component('https://test.osf.io/goodbye')),
                'domains': ['osf.vt.edu'],
                'email_domains': [],
            },
        ]

    init_app(routes=False)
    with TokuTransaction():
        for inst_data in INSTITUTIONS:
            new_inst, inst_created = update_or_create(inst_data)
            # update the nodes elastic docs, to have current names of institutions. This will
            # only work properly if this file is the only thing changing institution attributes
            if not inst_created:
                nodes = Node.find_by_institutions(new_inst,
                                                  query=Q(
                                                      'is_deleted', 'ne',
                                                      True))
                for node in nodes:
                    update_node(node, async=False)
        for extra_inst in Institution.find(
                Q('_id', 'nin', [x['_id'] for x in INSTITUTIONS])):
            logger.warn('Extra Institution : {} - {}'.format(
                extra_inst._id, extra_inst.name))
Пример #40
0
def main(env):
    INSTITUTIONS = []

    if env == 'prod':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science',
                'description': None,
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            # {
            #     '_id': 'nd',
            #     'name': 'University of Notre Dame',
            #     'description': None,
            #     'banner_name': 'nd-banner.png',
            #     'logo_name': 'nd-shield.png',
            #     'auth_url': SHIBBOLETH_SP.format(encode_uri_component('https://login.nd.edu/idp/shibboleth')),
            #     'domains': ['osf.nd.edu'],
            #     'email_domains': [],
            # },
            {
                '_id':
                'ucr',
                'name':
                'University of California Riverside',
                'description':
                None,
                'banner_name':
                'ucr-banner.png',
                'logo_name':
                'ucr-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component('urn:mace:incommon:ucr.edu')),
                'domains': ['osf.ucr.edu'],
                'email_domains': [],
            },
            {
                '_id':
                'usc',
                'name':
                'University of Southern California',
                'description':
                'Projects must abide by <a href="http://policy.usc.edu/info-security/">USC\'s Information Security Policy</a>. Data stored for human subject research repositories must abide by <a href="http://policy.usc.edu/biorepositories/">USC\'s Biorepository Policy</a>. The OSF may not be used for storage of Personal Health Information that is subject to <a href="http://policy.usc.edu/hipaa/">HIPPA regulations</a>.',
                'banner_name':
                'usc-banner.png',
                'logo_name':
                'usc-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component('urn:mace:incommon:usc.edu')),
                'domains': ['osf.usc.edu'],
                'email_domains': [],
            },
        ]
    if env == 'stage':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage]',
                'description': 'Center for Open Science [Stage]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['staging-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id':
                'nd',
                'name':
                'University of Notre Dame [Stage]',
                'description':
                'University of Notre Dame [Stage]',
                'banner_name':
                'nd-banner.png',
                'logo_name':
                'nd-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component(
                        'https://login-test.cc.nd.edu/idp/shibboleth')),
                'domains': ['staging-osf-nd.cos.io'],
                'email_domains': [],
            },
        ]
    if env == 'stage2':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Stage2]',
                'description': 'Center for Open Science [Stage2]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['staging2-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
        ]
    elif env == 'test':
        INSTITUTIONS = [
            {
                '_id': 'cos',
                'name': 'Center For Open Science [Test]',
                'description': 'Center for Open Science [Test]',
                'banner_name': 'cos-banner.png',
                'logo_name': 'cos-shield.png',
                'auth_url': None,
                'domains': ['test-osf.cos.io'],
                'email_domains': ['cos.io'],
            },
            {
                '_id':
                'nd',
                'name':
                'University of Notre Dame [Test]',
                'description':
                'University of Notre Dame [Test]',
                'banner_name':
                'nd-banner.png',
                'logo_name':
                'nd-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component(
                        'https://login-test.cc.nd.edu/idp/shibboleth')),
                'domains': ['test-osf-nd.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'ucr',
                'name':
                'University of California Riverside [Test]',
                'description':
                'University of California Riverside [Test]',
                'banner_name':
                'ucr-banner.png',
                'logo_name':
                'ucr-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component('urn:mace:incommon:ucr.edu')),
                'domains': ['test-osf-ucr.cos.io'],
                'email_domains': [],
            },
            {
                '_id':
                'usc',
                'name':
                'University of Southern California [Test]',
                'description':
                'University of Southern California [Test]',
                'banner_name':
                'usc-banner.png',
                'logo_name':
                'usc-shield.png',
                'auth_url':
                SHIBBOLETH_SP.format(
                    encode_uri_component('urn:mace:incommon:usc.edu')),
                'domains': ['test-osf-usc.cos.io'],
                'email_domains': [],
            },
        ]

    init_app(routes=False)
    with TokuTransaction():
        for inst_data in INSTITUTIONS:
            new_inst, inst_created = update_or_create(inst_data)
            # update the nodes elastic docs, to have current names of institutions. This will
            # only work properly if this file is the only thign changing institution attributes
            if not inst_created:
                nodes = Node.find_by_institution(new_inst,
                                                 query=Q(
                                                     'is_deleted', 'ne', True))
                for node in nodes:
                    update_node(node, async=False)
        for extra_inst in Institution.find(
                Q('_id', 'nin', [x['_id'] for x in INSTITUTIONS])):
            logger.warn('Extra Institution : {} - {}'.format(
                extra_inst._id, extra_inst.name))