From 8ff247b555ccce979616d87039a4d4789c60bafa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Mon, 20 Feb 2017 17:24:59 +0100 Subject: [PATCH] Allowed to export/import initial user password. --- CHANGELOG | 1 + openslides/users/static/js/users/csv.js | 16 +++++++++------- openslides/users/static/js/users/site.js | 2 +- .../static/templates/users/user-import.html | 8 ++++++-- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 077a0db34..b002a31b5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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. diff --git a/openslides/users/static/js/users/csv.js b/openslides/users/static/js/users/csv.js index 7b295272b..4558eaa91 100644 --- a/openslides/users/static/js/users/csv.js +++ b/openslides/users/static/js/users/csv.js @@ -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'); diff --git a/openslides/users/static/js/users/site.js b/openslides/users/static/js/users/site.js index 4fe93faa9..334b5e6b4 100644 --- a/openslides/users/static/js/users/site.js +++ b/openslides/users/static/js/users/site.js @@ -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. diff --git a/openslides/users/static/templates/users/user-import.html b/openslides/users/static/templates/users/user-import.html index 6d7d71b19..53b002fc6 100644 --- a/openslides/users/static/templates/users/user-import.html +++ b/openslides/users/static/templates/users/user-import.html @@ -57,7 +57,8 @@ Comment, Is active, Is present, - Is committee + Is committee, + Initial password
  • At least given name or surname have to be filled in. All other fields are optional and may be empty. @@ -82,7 +83,8 @@ Comment Is active Is present - Is committee + Is committee + Initial password 1 duplicate @@ -155,6 +157,8 @@ + + {{ user.default_password }}