Added new user field is_committee and new default group Committees.

This commit is contained in:
Norman Jäckel 2016-06-30 13:06:23 +02:00
parent aca01c466c
commit 4b9767b09e
7 changed files with 60 additions and 8 deletions

View File

@ -18,6 +18,9 @@ Core:
Motions:
- Added origin field.
Users:
- Added field is_committee and new default group Committees.
Other:
- Removed config cache to support multiple threads or processes.
- Fixed bug, that the last change of a config value was not send via autoupdate.

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-30 12:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='user',
name='is_committee',
field=models.BooleanField(default=False),
),
]

View File

@ -143,6 +143,9 @@ class User(RESTModelMixin, PermissionsMixin, AbstractBaseUser):
is_present = models.BooleanField(
default=False)
is_committee = models.BooleanField(
default=False)
objects = UserManager()
class Meta:

View File

@ -20,6 +20,7 @@ USERSHORTSERIALIZER_FIELDS = (
'structure_level',
'about_me',
'groups',
'is_committee',
)
@ -62,6 +63,7 @@ class UserFullSerializer(ModelSerializer):
'groups',
'default_password',
'is_active',
'is_committee',
)
def validate(self, data):

View File

@ -6,12 +6,13 @@ from .models import Group, User
def create_builtin_groups_and_admin(**kwargs):
"""
Creates the builtin groups: Anonymous, Registered, Delegates and Staff.
Creates the builtin groups: Anonymous, Registered, Delegates, Staff and
Committees.
Creates the builtin user: admin.
"""
# Check whether the group pks 1 to 4 are free
if Group.objects.filter(pk__in=range(1, 5)).exists():
# Check whether the group pk's 1 to 5 are free.
if Group.objects.filter(pk__in=range(1, 6)).exists():
# Do completely nothing if there are already some of our groups in the database.
return
@ -104,5 +105,13 @@ def create_builtin_groups_and_admin(**kwargs):
group_staff.permissions.add(
permission_dict['users.can_see_name'])
# Committees (pk 5)
committees_permissions = (
permission_dict['mediafiles.can_upload'],
permission_dict['motions.can_create'],
permission_dict['motions.can_support'], )
group_committee = Group.objects.create(name='Committees', pk=5)
group_committee.permissions.add(*committees_permissions)
# Create or reset admin user
User.objects.create_or_reset_admin_user()

View File

@ -386,6 +386,16 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
'active. Unselect this instead of deleting the account.')
},
defaultValue: true
},
{
key: 'is_committee',
type: 'checkbox',
templateOptions: {
label: gettextCatalog.getString('Is a committee'),
description: gettextCatalog.getString(
'Designates whether this user should be treated as a committee.')
},
defaultValue: false
}];
}
};
@ -801,11 +811,12 @@ angular.module('OpenSlidesApp.users.site', ['OpenSlidesApp.users'])
var element = document.getElementById('downloadLink');
var csvRows = [
// column header line
['title', 'first_name', 'last_name', 'structure_level', 'groups', 'comment', 'is_active'],
['title', 'first_name', 'last_name', 'structure_level', 'groups', 'comment', 'is_active', 'is_committee'],
// example entries
['Dr.', 'Max', 'Mustermann', 'Berlin', '"3,4"', 'xyz', '1'],
['', 'John', 'Doe', 'Washington', '3', 'abc', '1'],
['', 'Fred', 'Bloggs', 'London', '', '', ''],
['Dr.', 'Max', 'Mustermann', 'Berlin', '"3,4"', 'xyz', '1', ''],
['', 'John', 'Doe', 'Washington', '3', 'abc', '1', ''],
['', 'Fred', 'Bloggs', 'London', '', '', '', ''],
['', '', 'Executive Board', '', '5', '', '', '1'],
];
var csvString = csvRows.join("%0A");

View File

@ -68,10 +68,11 @@
<h4 translate>Please note:</h4>
<ul>
<li><translate>Required comma or semicolon separated values with these column header names in the first row</translate>:<br>
<code>title, first_name, last_name, structure_level, groups, comment, is_active</code>
<code>title, first_name, last_name, structure_level, groups, comment, is_active, is_committee</code>
<li><translate>Default groups</translate>:
<translate>Delegates</translate> <code>3</code>,
<translate>Staff</translate> <code>4</code>
<translate>Committees</translate> <code>5</code>
<li translate>At least first name or last name have to be filled in. All
other fields are optional and may be empty.
<li translate>Only double quotes are accepted as text delimiter (no single quotes).
@ -92,6 +93,7 @@
<th translate>Groups
<th translate>Comment
<th translate>Is active</th>
<th translate>Is committee</th>
<tbody>
<tr ng-repeat="user in users | limitTo : itemsPerPage : limitBegin">
<td class="minimum"
@ -129,6 +131,8 @@
{{ user.comment }}
<td>
<i ng-if="user.is_active" class="fa fa-check-square-o"></i>
<td>
<i ng-if="user.is_committee" class="fa fa-check-square-o"></i>
</table>
<uib-pagination total-items="users.length" items-per-page="itemsPerPage" ng-model="currentPage" ng-change="pageChanged()"></uib-pagination>