Exemple #1
0
def authorize_public_data(user):
    '''
    find all resources owned by super user, replicate them,
    and set owner to user
    '''
    # find all resources owned by super user and replicate them
    for resource in Resource.query.filter_by(owner_id='super'):
        db.make_transient(resource)
        resource.owner = user
        db.session.add(resource)
    # find all search param owned by super user and replicate them
    for sp in SearchParam.query.filter_by(owner_id='super'):
        db.make_transient(sp)
        sp.owner_id = user.email
        sp.id = None
        db.session.add(sp)
    db.session.commit()
Exemple #2
0
def authorize_public_data(user):
    '''
    find all resources owned by super user, replicate them,
    and set owner to user
    '''
    # find all resources owned by super user and replicate them
    for resource in Resource.query.filter_by(owner_id='super'):
        db.make_transient(resource)
        resource.owner = user
        db.session.add(resource)
    # find all search param owned by super user and replicate them
    for sp in SearchParam.query.filter_by(owner_id='super'):
        db.make_transient(sp)
        sp.owner_id = user.email
        sp.id = None
        db.session.add(sp)
    db.session.commit()