aboutsummaryrefslogtreecommitdiffhomepage
path: root/apioforum/templates/edit_permissions.html
blob: e79c0c777751f53690558371471ffe149910d7b2 (plain)
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
{% extends 'base.html' %}
{% from 'common.html' import tag %}
{% block header %}<h1>{% block title %}role permissions for '{{forum.name}}'{% endblock %}</h1>{% endblock %}
{% block content %}
<p>
	each user has a role in the forum.
	a user may be assigned a role in the forum.
	otherwise, the user's role is the same as the parent forum.
	everyone's role is "other" by default.
</p>
<p>
	here a set of permissions may be associated with any role.
	if a role does not have any permissions configured for this forum,
	the permissions set for the role in closest ancestor forum are used.
	if no permissions are set for the role in any ancestor forum,
	the permissions for the role "other" are used.
</p>
<form method="post" id="role_config">

{% for role_config in role_configs %}
	<fieldset>
	<legend id="config_{{role_config.role}}">{{role_config.role}}</legend>
		{% macro perm(p, description, tooltip) %}
			<input 
				type="checkbox" 
				id="{{role_config.role}}_{{p}}" 
				name="{{role_config.role}}_{{p}}" 
				{% if role_config[p] %}checked{% endif %}
			/>
			<label for="{{role_config.role}}_{{p}}" title="{{tooltip}}">
				{{- description -}}
			</label>
			<br/>
		{% endmacro %}
		{{perm("p_create_threads","create threads",
				"allow users with the role to create a thread in the forum")}}
		{{perm("p_reply_threads","reply to threads",
				"allow users with the role to create a post within a thread")}}
		{{perm("p_view_threads","view threads",
				"allow users with the role to view threads in the forum")}}
		{{perm("p_manage_threads","configure others' threads",
				"allow users with the role to delete, lock, or modify the title/tags for others' threads")}}
		{{perm("p_create_polls","create polls",
				"allow users with the role to create poll threads")}}
		{{perm("p_vote","vote",
				"allow users with the role to vote on poll threads")}}
		{{perm("p_create_subforum","create subforæ",
				"allow users with the role to create subforæ in this forum. " +
				"they will automatically become a bureaucrat in this subforum.")}}
		{% if role_config.role != "other" %}
			{{perm("p_approve","approve others",
					"allow users with the role to assign the 'approved' role to those with the 'other' role")}}
		{% endif %}
	</fieldset>
{% endfor %}

</form>

<fieldset>
	<legend>add role</legend>
	<ul>
		{% for role in other_roles %}
		<li>{{role}} 
			<form action="{{url_for('forum.add_role',forum_id=forum.id)}}" method="POST" style="display:inline">
				<input type="hidden" value="{{role}}" name="role" />
				<input type="submit" value="add" />
			</form>
		</li>
		{% endfor %}
		<li>
			<form action="{{url_for('forum.add_role',forum_id=forum.id,role_name=role)}}" method="POST" style="display:inline">
				<input type="text" name="role" class="role-input" placeholder="role name"/>
				<input type="submit" value="add" />
			</form>
		</li>
	</ul>
</fieldset>

<p>confirm changes?</p>
<input type="submit" value="confirm" form="role_config">
<a href="{{url_for('forum.view_forum',forum_id=forum.id)}}">cancel</a>

{% endblock %}