Allowed to export/import initial user password.

This commit is contained in:
Emanuel Schütze 2017-02-20 17:24:59 +01:00
parent cac15db50a
commit 8ff247b555
4 changed files with 17 additions and 10 deletions

View File

@ -91,6 +91,7 @@ Users:
- Added new field for participant number.
- Added new field 'is_committee' and new default group 'Committees'.
- Improved users CSV import (use group names instead of id).
- Allowed to import/export initial user password.
- Added more multiselect actions.
- Added QR code in users access pdf.

View File

@ -5,13 +5,14 @@
angular.module('OpenSlidesApp.users.csv', [])
.factory('UserCsvExport', [
'$filter',
'Group',
'gettextCatalog',
'CsvDownload',
function (Group, gettextCatalog, CsvDownload) {
function ($filter, Group, gettextCatalog, CsvDownload) {
var makeHeaderline = function () {
var headerline = ['Title', 'Given name', 'Surname', 'Structure level', 'Participant number', 'Groups',
'Comment', 'Is active', 'Is present', 'Is a committee'];
'Comment', 'Is active', 'Is present', 'Is a committee', 'Initial password'];
return _.map(headerline, function (entry) {
return gettextCatalog.getString(entry);
});
@ -36,6 +37,7 @@ angular.module('OpenSlidesApp.users.csv', [])
row.push(user.is_active ? '1' : '0');
row.push(user.is_present ? '1' : '0');
row.push(user.is_committee ? '1' : '0');
row.push('"' + user.default_password + '"');
csvRows.push(row);
});
CsvDownload(csvRows, 'users-export.csv');
@ -43,7 +45,7 @@ angular.module('OpenSlidesApp.users.csv', [])
downloadExample: function () {
// try to get an example with two groups and one with one group
var groups = Group.getAll();
var groups = $filter('orderBy')(Group.getAll(), 'id');
var csvGroups = '';
var csvGroup = '';
if (groups.length >= 3) { // do not pick groups[0], this is the default group
@ -56,10 +58,10 @@ angular.module('OpenSlidesApp.users.csv', [])
var csvRows = [makeHeaderline(),
// example entries
['Dr.', 'Max', 'Mustermann', 'Berlin','1234567890', csvGroups, 'xyz', '1', '1', ''],
['', 'John', 'Doe', 'Washington','75/99/8-2', csvGroup, 'abc', '1', '1', ''],
['', 'Fred', 'Bloggs', 'London', '', '', '', '', '', ''],
['', '', 'Executive Board', '', '', '', '', '', '', '1'],
['Dr.', 'Max', 'Mustermann', 'Berlin','1234567890', csvGroups, 'xyz', '1', '1', '', ''],
['', 'John', 'Doe', 'Washington','75/99/8-2', csvGroup, 'abc', '1', '1', '', ''],
['', 'Fred', 'Bloggs', 'London', '', '', '', '', '', '', ''],
['', '', 'Executive Board', '', '', '', '', '', '', '1', ''],
];
CsvDownload(csvRows, 'users-example.csv');

View File

@ -1029,7 +1029,7 @@ angular.module('OpenSlidesApp.users.site', [
};
var FIELDS = ['title', 'first_name', 'last_name', 'structure_level', 'number',
'groups', 'comment', 'is_active', 'is_present', 'is_committee'];
'groups', 'comment', 'is_active', 'is_present', 'is_committee', 'default_password'];
$scope.users = [];
$scope.onCsvChange = function (csv) {
// All user objects are already loaded via the resolve statement from ui-router.

View File

@ -57,7 +57,8 @@
<translate>Comment</translate>,
<translate>Is active</translate>,
<translate>Is present</translate>,
<translate>Is committee</translate>
<translate>Is committee</translate>,
<translate>Initial password</translate>
</code>
<li translate>At least given name or surname have to be filled in. All
other fields are optional and may be empty.
@ -82,7 +83,8 @@
<th translate>Comment
<th translate>Is active
<th translate>Is present
<th translate>Is committee</th>
<th translate>Is committee
<th translate>Initial password</th>
<th ng-if="duplicates > 0">
<i class="fa fa-exclamation-triangle text-danger"></i>
<strong class="text-danger" ng-if="duplicates == 1">1 <translate>duplicate</translate></strong>
@ -155,6 +157,8 @@
<td>
<i class="fa pointer" ng-class="user.is_committee ? 'fa-check-square-o' : 'fa-square-o'"
ng-click="user.is_committee = !user.is_committee"></i>
<td>
{{ user.default_password }}
<td ng-if="duplicates > 0">
<div ng-if="user.duplicate" uib-tooltip="{{ user.duplicate_info }}" uib-dropdown>
<button id="UserAction{{ $index }}" type="button" class="btn btn-default btn-sm"