Merge pull request #2687 from FinnStutzenstein/Issue2341

Use plugin verbose name in permission matrix (fixes #2341)
This commit is contained in:
Norman Jäckel 2016-11-29 12:52:30 +01:00 committed by GitHub
commit 0605395da2

View File

@ -1197,8 +1197,9 @@ angular.module('OpenSlidesApp.users.site', [
'Motion', 'Motion',
'User', 'User',
'ngDialog', 'ngDialog',
function($scope, $http, operator, Group, permissions, gettext, Agenda, Assignment, Mediafile, Motion, User, ngDialog) { 'OpenSlidesPlugins',
//Group.bindAll({}, $scope, 'groups'); function($scope, $http, operator, Group, permissions, gettext, Agenda, Assignment, Mediafile,
Motion, User, ngDialog, OpenSlidesPlugins) {
$scope.permissions = permissions; $scope.permissions = permissions;
$scope.$watch(function() { $scope.$watch(function() {
@ -1220,6 +1221,11 @@ angular.module('OpenSlidesApp.users.site', [
$scope.group_danger = groups_danger.length == 1 ? groups_danger[0] : null; $scope.group_danger = groups_danger.length == 1 ? groups_danger[0] : null;
}); });
// Dict to map plugin name -> display_name
var pluginTranslation = {};
_.forEach(OpenSlidesPlugins.getAll(), function (plugin) {
pluginTranslation[plugin.name] = plugin.display_name;
});
$scope.apps = []; $scope.apps = [];
// Create the main clustering with appname->permissions // Create the main clustering with appname->permissions
angular.forEach(permissions, function(perm) { angular.forEach(permissions, function(perm) {
@ -1261,7 +1267,8 @@ angular.module('OpenSlidesApp.users.site', [
insert(5, perm, User.verboseNamePlural); insert(5, perm, User.verboseNamePlural);
break; break;
default: // plugins: id>5 default: // plugins: id>5
var display_name = permissionApp.charAt(0).toUpperCase() + permissionApp.slice(1); var display_name = pluginTranslation[permissionApp] || permissionApp.charAt(0).toUpperCase() +
permissionApp.slice(1);
// does the app exists? // does the app exists?
var result = -1; var result = -1;
angular.forEach($scope.apps, function (app, index) { angular.forEach($scope.apps, function (app, index) {