possibility to allow globaly project permissions

This commit is contained in:
Élie Bouttier 2014-08-14 22:43:14 -07:00
parent f6eebb72a3
commit 8a5e4ffa51
3 changed files with 132 additions and 12 deletions

View file

@ -0,0 +1,74 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('issue', '0013_projectpermission_manage_issue'),
]
operations = [
migrations.AddField(
model_name='globalpermission',
name='create_comment',
field=models.BooleanField(default=True),
preserve_default=True,
),
migrations.AddField(
model_name='globalpermission',
name='create_issue',
field=models.BooleanField(default=True),
preserve_default=True,
),
migrations.AddField(
model_name='globalpermission',
name='delete_comment',
field=models.BooleanField(default=False),
preserve_default=True,
),
migrations.AddField(
model_name='globalpermission',
name='delete_issue',
field=models.BooleanField(default=False),
preserve_default=True,
),
migrations.AddField(
model_name='globalpermission',
name='delete_tags',
field=models.BooleanField(default=False),
preserve_default=True,
),
migrations.AddField(
model_name='globalpermission',
name='manage_issue',
field=models.BooleanField(default=False),
preserve_default=True,
),
migrations.AddField(
model_name='globalpermission',
name='manage_project_permission',
field=models.BooleanField(default=False),
preserve_default=True,
),
migrations.AddField(
model_name='globalpermission',
name='manage_tags',
field=models.BooleanField(default=False),
preserve_default=True,
),
migrations.AddField(
model_name='globalpermission',
name='modify_comment',
field=models.BooleanField(default=False),
preserve_default=True,
),
migrations.AddField(
model_name='globalpermission',
name='modify_issue',
field=models.BooleanField(default=False),
preserve_default=True,
),
]

View file

@ -441,6 +441,8 @@ class PermissionModel(models.Model):
@python_2_unicode_compatible
class GlobalPermission(PermissionModel):
# Global permissions
create_project = models.BooleanField(default=True)
modify_project = models.BooleanField(default=False)
delete_project = models.BooleanField(default=False)
@ -450,6 +452,22 @@ class GlobalPermission(PermissionModel):
manage_global_permission = models.BooleanField(default=False)
# Project permissions, given on ALL projects
manage_project_permission = models.BooleanField(default=False)
create_issue = models.BooleanField(default=True)
modify_issue = models.BooleanField(default=False)
manage_issue = models.BooleanField(default=False)
delete_issue = models.BooleanField(default=False)
create_comment = models.BooleanField(default=True)
modify_comment = models.BooleanField(default=False)
delete_comment = models.BooleanField(default=False)
manage_tags = models.BooleanField(default=False)
delete_tags = models.BooleanField(default=False)
def __str__(self):
return self.grantee_name + "'s global permissions"

View file

@ -2,6 +2,7 @@
{% load django_markdown %}
{% load issue_filters %}
{% load issue_tags %}
{% block content %}
@ -20,20 +21,37 @@
{% if permissions.count %}
<table class="table table-bordered">
<tr>
<th rowspan="2">Type</th>
<th rowspan="2">Name</th>
<th colspan="3" class="text-center">Project</th>
<th colspan="2" class="text-center">Team</th>
<th class="text-center">Permissions</th>
<th rowspan="2" class="col-md-2"></th>
<th rowspan="3" class="text-center">Type</th>
<th rowspan="3" class="text-center">Name</th>
<th colspan="6" class="text-center">Global</th>
<th colspan="10" class="text-center">Project</th>
<th rowspan="3" class="col-md-2"></th>
</tr>
<tr>
<th class="text-center">Create?</th>
<th class="text-center">Modify?</th>
<th class="text-center">Delete?</th>
<th class="text-center">Add?</th>
<th class="text-center">Manage?</th>
<th class="text-center">Manage?</th>
<th colspan="3" class="text-center">Project</th>
<th colspan="2" class="text-center">Team</th>
<th colspan="2" class="text-center">Permissions</th>
<th colspan="4" class="text-center">Issues</th>
<th colspan="3" class="text-center">Comments</th>
<th colspan="2" class="text-center">Tags</th>
</tr>
<tr>
<th class="text-center">{% vertical 'Create?' %}</th>
<th class="text-center">{% vertical 'Modify?' %}</th>
<th class="text-center">{% vertical 'Delete?' %}</th>
<th class="text-center">{% vertical 'Create?' %}</th>
<th class="text-center">{% vertical 'Manage?' %}</th>
<th class="text-center">{% vertical 'Manage?' %}</th>
<th class="text-center">{% vertical 'Manage?' %}</th>
<th class="text-center">{% vertical 'Create?' %}</th>
<th class="text-center">{% vertical 'Manage?' %}</th>
<th class="text-center">{% vertical 'Modify?' %}</th>
<th class="text-center">{% vertical 'Delete?' %}</th>
<th class="text-center">{% vertical 'Create?' %}</th>
<th class="text-center">{% vertical 'Modify?' %}</th>
<th class="text-center">{% vertical 'Delete?' %}</th>
<th class="text-center">{% vertical 'Manage?' %}</th>
<th class="text-center">{% vertical 'Delete?' %}</th>
</tr>
{% for perm in permissions %}
<tr>
@ -45,6 +63,16 @@
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'add-team' %}">{{ perm.add_team|boolean }}</a></td>
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'manage-team' %}">{{ perm.manage_team|boolean }}</a></td>
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'manage-global-permission' %}">{{ perm.manage_global_permission|boolean }}</a></td>
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'manage-project-permission' %}">{{ perm.manage_project_permission|boolean }}</a></td>
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'create-issue' %}">{{ perm.create_issue|boolean }}</a></td>
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'manage-issue' %}">{{ perm.manage_issue|boolean }}</a></td>
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'modify-issue' %}">{{ perm.modify_issue|boolean }}</a></td>
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'delete-issue' %}">{{ perm.delete_issue|boolean }}</a></td>
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'create-comment' %}">{{ perm.create_comment|boolean }}</a></td>
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'modify-comment' %}">{{ perm.modify_comment|boolean }}</a></td>
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'delete-comment' %}">{{ perm.delete_comment|boolean }}</a></td>
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'manage-tags' %}">{{ perm.manage_tags|boolean }}</a></td>
<td class="text-center"><a href="{% url 'toggle-global-permission' perm.id 'delete-tags' %}">{{ perm.delete_tags|boolean }}</a></td>
<td class="text-center">
<a href="{% url 'edit-global-permission' perm.id %}" class="btn btn-primary btn-xs"><span class="glyphicon glyphicon-edit"></span> Edit</a>
<a href="{% url 'delete-global-permission' perm.id %}" class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-remove"></span> Delete</a>