Parent: [ad3086] (diff)

Child: [0d6290] (diff)

Download this file

project_permissions.html    99 lines (92 with data), 3.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{% extends g.theme.master %}
{% macro role_select(name) %}
<select name="{{name}}">
{% for r in c.project.roles %}
<option value="{{r._id}}">{{r.display()}}</option>
{% endfor %}
</select>
{% endmacro %}
{% block extra_css %}
<link rel="stylesheet" type="text/css" media="screen" href="{{g.forge_static('css/forge/accordion.css')}}" />
{% endblock %}
{% block title %}{{c.project.name}} / Permissions{% endblock %}
{% block header %}Project Permissions for {{c.project.shortname}}{% endblock %}
{% block content %}
{% if c.project.deleted %}
<div class="notice">This project has been deleted and is not visible to non-admin users</div>
{% endif %}
<p>The project ACL determines project-level permissions.</p>
<div id="acl-admin">
{% for permission, role_ids in c.project.acl.iteritems() %}
<h3><a href="#" id="permission_{{permission}}">Permission: {{permission}}</a></h3>
<div>
<form method="POST" action="update_acl">
<input type="hidden" name="permission" value="{{permission}}"/>
{% for rid in role_ids %}
<input type="hidden" name="role-{{loop.index0}}.id" value="{{rid}}"/>
{% endfor %}
<table>
<thead>
<tr><th>Role</th><th>Username</th><th/></tr>
</thead>
<tbody>
{% for r in h.make_roles(role_ids) %}
<tr>
<td>{{r.display()}}</td>
<td>{{r.user._id and r.user.username or ''}}</td>
<td><input type="submit" value="Remove" name="role-{{loop.index0}}.delete" /></td>
</tr>
{% endfor %}
<tr>
<td>
<select name="new.id">
<option value="">User</option>
<optgroup label="Existing role">
{% for r in c.project.roles %}
<option value="{{r._id}}">{{r.display()}}</option>
{% endfor %}
</optgroup>
</select>
</td>
<td>
<input name="new.username"/>
</td>
<td>
<input type="submit" name="new.add" value="Add Permission"/>
</td>
</tr>
</tbody>
</table>
</form>
</div>
{% endfor %}
</div>
{% endblock %}
{% block extra_js %}
<script type="text/javascript">
/*<![CDATA[*/
$(function() {
$("#acl-admin").accordion({
autoHeight: false,
navigation: true,
change: function(event,ui) {
var hid = ui.newHeader.children('a').attr('id');
if (hid === undefined) {
$.cookie('project-acl-admin', null);
} else {
$.cookie('project-acl-admin', hid, { path: '/', expires: 2 });
}
}
});
});
$(document).ready(function(){
if($.cookie('project-acl-admin')) {
$('#acl-admin').accordion('option', 'animated', false)
.accordion('activate', $('#' + $.cookie('project-acl-admin')).parent('h3'))
.accordion('option', 'animated', 'slide');
}
});
/*]]>*/
</script>
<script type="text/javascript" src="{{g.app_static('js/admin.js')}}"/>
{% endblock %}