Check if user is allowed to see detail view link in agenda list.

Fixes #1886
This commit is contained in:
Emanuel Schuetze 2016-01-27 21:18:15 +01:00
parent 352e32334e
commit fc22711a9c
2 changed files with 20 additions and 2 deletions

View File

@ -71,12 +71,13 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
'$scope', '$scope',
'$http', '$http',
'$state', '$state',
'operator',
'ngDialog', 'ngDialog',
'Agenda', 'Agenda',
'AgendaTree', 'AgendaTree',
'Customslide', 'Customslide',
'Projector', 'Projector',
function($scope, $http, $state, ngDialog, Agenda, AgendaTree, Customslide, Projector) { function($scope, $http, $state, operator, ngDialog, Agenda, AgendaTree, Customslide, Projector) {
// Bind agenda tree to the scope // Bind agenda tree to the scope
$scope.$watch(function () { $scope.$watch(function () {
return Agenda.lastModified(); return Agenda.lastModified();
@ -85,6 +86,20 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
}); });
$scope.alert = {}; $scope.alert = {};
// check open permission
$scope.isAllowedToSeeOpenLink = function (item) {
var collection = item.content_object.collection;
switch (collection) {
case 'core/customslide':
return operator.hasPerms('core.can_manage_projector');
case 'motions/motion':
return operator.hasPerms('motions.can_see');
case 'assignments/assignment':
return operator.hasPerms('assignments.can_see');
default:
return false;
}
}
// open new dialog // open new dialog
$scope.newDialog = function () { $scope.newDialog = function () {
ngDialog.open({ ngDialog.open({

View File

@ -135,9 +135,12 @@
<td ng-if="!item.quickEdit" ng-mouseover="item.hover=true" ng-mouseleave="item.hover=false" <td ng-if="!item.quickEdit" ng-mouseover="item.hover=true" ng-mouseleave="item.hover=false"
style="padding-left: calc(8px + {{ item.parentCount }}*15px)"> style="padding-left: calc(8px + {{ item.parentCount }}*15px)">
<strong> <strong>
<a href="" ng-click="open(item)"> <a ng-show="isAllowedToSeeOpenLink(item)" href="" ng-click="open(item)">
{{ item.getListViewTitle() }} {{ item.getListViewTitle() }}
</a> </a>
<span ng-hide="isAllowedToSeeOpenLink(item)">
{{ item.getListViewTitle() }}
</span>
</strong> </strong>
<span ng-if="item.is_hidden" title="{{ 'Internal item' | translate }}"><i class="fa fa-ban"></i></span> <span ng-if="item.is_hidden" title="{{ 'Internal item' | translate }}"><i class="fa fa-ban"></i></span>
<div ng-if="item.comment"> <div ng-if="item.comment">