Commit cd5bb759 authored by HERBERT Ryan's avatar HERBERT Ryan

run.py run/add.html owner group

Added owner_group to run so that it is possible to affect a run to any
group the user is a member of. Select box is currently hidden and
selects the user_group by default unless the group Lille is in the list
parent d8a298a8
......@@ -177,10 +177,19 @@ def add():
db.run.pcr,
distinct=True
)
if (auth.is_admin()):
groups = db(db.auth_group).select(db.auth_group.id, db.auth_group.role)
else:
groups = auth.get_user_groups()
master_group = auth.user_group()
for row in groups:
if row.role == 'Lille':
master_group = row.id
return dict(message=T('add run'),
sequencer_list = sequencer_list,
pcr_list = pcr_list)
pcr_list = pcr_list, groups=groups, master_group=master_group)
else :
res = {"message": ACCESS_DENIED}
log.error(res)
......@@ -218,11 +227,11 @@ def add_form():
creator=auth.user_id)
user_group = auth.user_group(auth.user.id)
user_group = int(request.vars["run_group"])
admin_group = db(db.auth_group.role=='admin').select().first().id
#patient creator automaticaly has all rights
auth.add_permission(user_group, 'access', db.run, id)
auth.add_permission(user_group, PermissionEnum.access.value, db.run, id)
res = {"redirect": "run/index",
"args" : { "id" : id },
......
......@@ -18,6 +18,13 @@
<td><input class="date" id="run_date" name="run_date" type="text" value=""><span>(format: yyyy-mm-dd)</span></td>
<td></td>
</tr>
<tr class='devel-mode'>
<td><label for="run_group" id="run_group__label">Owner Group: </label></td>
<td>
{{= SELECT(*[OPTION(g.role, _value=g.id) for g in groups], _name="run_group", _value=master_group, value=master_group) }}
</td>
<td></td>
</tr>
<tr>
<td><label for="run_info" id="run_info__label">Info: </label></td>
<td><textarea class="text" cols="60" id="run_info" name="info" rows="10"></textarea></td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment