Esempio n. 1
0
def get_actions(track, user, rights, project=None):
    # user own the track => all actions
    if track.user.id == user.id:
        return hoover_actions(
            helpers.export_link(track.id, url('/tracks'), project=project) +
            helpers.edit_link(track.id, url('/tracks'), project=project) +
            helpers.delete_link(track.id, url('/tracks'), project=project))
    right_ids = [r.id for r in rights]
    if rights is None:
        return hoover_actions('')
    debug('Get actions %s' % right_ids)
    if constants.rights['download']['id'] in right_ids and constants.rights[
            'upload']['id'] in right_ids:
        debug('Download & Upload', 1)
        return hoover_actions(
            helpers.export_link(track.id, url('/tracks'), project=project) +
            helpers.edit_link(track.id, url('/tracks'), project=project))
    # user have the download right
    if constants.rights['download']['id'] in right_ids:
        debug('Download', 1)
        return hoover_actions(helpers.export_link(track.id, url('/tracks')))
    # user have upload right
    if constants.rights['upload']['id'] in right_ids:
        debug('Upload', 1)
        return hoover_actions(helpers.edit_link(track.id, url('/tracks')))
    debug('no rights', 1)
    return hoover_actions('')
Esempio n. 2
0
def get_actions(track, user, rights, project=None):
    # user own the track => all actions
    if track.user.id == user.id:
        return hoover_actions(
            helpers.export_link(track.id, url('/tracks'), project=project)
            + helpers.edit_link(track.id, url('/tracks'), project=project)
            + helpers.delete_link(track.id, url('/tracks'), project=project)
        )
    right_ids = [r.id for r in rights]
    if rights is None:
        return hoover_actions('')
    debug('Get actions %s' % right_ids)
    if constants.rights['download']['id'] in right_ids and constants.rights['upload']['id'] in right_ids:
        debug('Download & Upload', 1)
        return hoover_actions(
            helpers.export_link(track.id, url('/tracks'), project=project)
            + helpers.edit_link(track.id, url('/tracks'), project=project)
    )
    # user have the download right
    if constants.rights['download']['id'] in right_ids:
        debug('Download', 1)
        return hoover_actions(
            helpers.export_link(track.id, url('/tracks'))
    )
    # user have upload right
    if constants.rights['upload']['id'] in right_ids:
        debug('Upload', 1)
        return hoover_actions(
            helpers.edit_link(track.id, url('/tracks'))
    )
    debug('no rights', 1)
    return hoover_actions('')
Esempio n. 3
0
def track_grid_user(user, project=None):
    return twf.DataGrid(fields=[
        ('Name', 'name'),
        (hoover_action, lambda obj: hoover_actions(
            helpers.export_link(obj.id, url('/tracks'), project=project) +
            helpers.edit_link(obj.id, url('/tracks'), project=project) +
            helpers.delete_link(obj.id, url('/tracks'), project=project))),
        ('Color', lambda obj: genshi.Markup(helpers.track_color(obj))),
        ('Owner', 'owner'),
        ('Created', 'created'),
        ('Assembly', 'sequence'),
        ('Type', 'vizu'),
        (hidden_info, lambda obj: hide_info({
            'tr_id': obj.id,
            'tr_status': obj.status,
        })),
    ])
Esempio n. 4
0
def track_grid_user(user, project=None):
    return twf.DataGrid(fields=[
    ('Name', 'name'),
    (hoover_action, lambda obj: hoover_actions(
            helpers.export_link(obj.id, url('/tracks'), project=project)
            + helpers.edit_link(obj.id, url('/tracks'), project=project)
            + helpers.delete_link(obj.id, url('/tracks'), project=project)
    )),
    ('Color', lambda obj: genshi.Markup(helpers.track_color(obj))),
    ('Owner', 'owner'),
     ('Created', 'created'),
     ('Assembly', 'sequence'),
     ('Type', 'vizu'),
    (hidden_info, lambda obj: hide_info({
        'tr_id': obj.id,
        'tr_status': obj.status,
        })),
    ])
Esempio n. 5
0
def etrack_grid_permissions(rights=None):
    if rights is not None:
        del_action = None
        right_ids = [r.id for r in rights]
        if constants.rights['download']['id'] in right_ids and constants.rights['upload']['id'] in right_ids:
            actions = lambda obj: hoover_actions(
                helpers.export_link(obj.id, url('/tracks'))
                #+ helpers.edit_link(obj.id, url('/tracks'))
                #+ helpers.delete_link(obj.id, url('/tracks'))
                )
        elif constants.rights['download']['id'] in right_ids:
            actions = lambda obj: hoover_actions(
                helpers.export_link(obj.id, url('/tracks')))
        elif constants.rights['upload']['id'] in right_ids:
            actions = lambda obj: hoover_actions(
                helpers.edit_link(obj.id, url('/tracks'))
                + helpers.delete_link(obj.id, url('/tracks')))
        else:
            actions = lambda obj: hoover_actions('')

        h_info = lambda obj: hide_info({
            'tr_id': obj.id,
            'tr_status': obj.status,
            'tr_color': helpers.get_track_color(obj),
            })


        fields = [ ('Name', 'name'),
        (hoover_action, actions),
        ('Created', 'created'),
        ('Assembly', 'sequence'),
        ('Type', 'vizu'),
        (hidden_info, h_info),
        ]

    return twf.DataGrid(fields=fields)
Esempio n. 6
0
    name = Column(Unicode(255), nullable=False)
    description = Column(Text(), nullable=False)

    _created = Column(DateTime, nullable=False, default=datetime.now)
    user_id = Column(Integer, ForeignKey('User.id', ondelete="CASCADE"), nullable=False)
    project_id = Column(Integer, ForeignKey('Project.id', ondelete="CASCADE"), nullable=True)
    status = Column(Unicode(255))
    ext_task_id = Column(VARCHAR(255), unique=True)
    bioscript_url = Column(VARCHAR(255))
    traceback = Column(Text, nullable=True)
"""

job_grid = twf.DataGrid(fields=[
    ('Name', 'name'),
    (hoover_action, lambda obj: hoover_actions(
        helpers.delete_link(obj.id, url('/jobs'))
    )),
    ('Project', 'project.name'),
    ('Bioscript', lambda x: genshi.Markup(helpers.bioscript(x.bioscript_url))),
    ('Traceback', lambda x: genshi.Markup('''<a href="%s">traceback</a>''' % url('/jobs/traceback?id=%s' % x.id))),
    ('Created', 'created'),
    (hidden_info, lambda obj: hide_info({
        'tr_id': obj.id,
        'tr_status': obj.status
    }))
])


def get_actions(track, user, rights, project=None):
    # user own the track => all actions
    if track.user.id == user.id:
Esempio n. 7
0
    name = Column(Unicode(255), nullable=False)
    description = Column(Text(), nullable=False)

    _created = Column(DateTime, nullable=False, default=datetime.now)
    user_id = Column(Integer, ForeignKey('User.id', ondelete="CASCADE"), nullable=False)
    project_id = Column(Integer, ForeignKey('Project.id', ondelete="CASCADE"), nullable=True)
    status = Column(Unicode(255))
    ext_task_id = Column(VARCHAR(255), unique=True)
    bioscript_url = Column(VARCHAR(255))
    traceback = Column(Text, nullable=True)
"""

job_grid = twf.DataGrid(
    fields=[('Name', 'name'),
            (hoover_action, lambda obj: hoover_actions(
                helpers.delete_link(obj.id, url('/jobs')))
             ), ('Project', 'project.name'),
            ('Bioscript',
             lambda x: genshi.Markup(helpers.bioscript(x.bioscript_url))),
            ('Traceback',
             lambda x: genshi.Markup('''<a href="%s">traceback</a>''' % url(
                 '/jobs/traceback?id=%s' % x.id))), ('Created', 'created'),
            (hidden_info, lambda obj: hide_info({
                'tr_id': obj.id,
                'tr_status': obj.status
            }))])


def get_actions(track, user, rights, project=None):
    # user own the track => all actions
    if track.user.id == user.id: