Fix #581: execute_query permission ignored by UI

This commit is contained in:
Arik Fraimovich 2015-10-11 11:26:11 +03:00
parent b0cb2d3f1c
commit f0ee7a67d2
3 changed files with 9 additions and 3 deletions

View File

@ -69,6 +69,7 @@
$scope.isQueryOwner = (currentUser.id === $scope.query.user.id) || currentUser.hasPermission('admin');
$scope.canViewSource = currentUser.hasPermission('view_source');
$scope.canExecuteQuery = currentUser.hasPermission('execute_query');
$scope.dataSources = DataSource.query(function(dataSources) {
updateSchema();
@ -125,9 +126,14 @@
};
$scope.executeQuery = function() {
if (!$scope.canExecuteQuery) {
return;
}
if (!$scope.query.query) {
return;
}
getQueryResult(0);
$scope.lockButton(true);
$scope.cancelling = false;

View File

@ -39,7 +39,7 @@
});
var grouped = _.groupBy(sortedData, "date");
var maxColumns = _.reduce(grouped, function (memo, data) {
return (data.length > memo) ? data.length : memo;
}, 0);

View File

@ -63,7 +63,7 @@
<div ng-class="editorSize">
<div>
<p>
<button type="button" class="btn btn-primary btn-xs" ng-disabled="queryExecuting" ng-click="executeQuery()">
<button type="button" class="btn btn-primary btn-xs" ng-disabled="queryExecuting" ng-click="executeQuery()" ng-if="canExecuteQuery">
<span class="glyphicon glyphicon-play"></span> Execute
</button>
<query-formatter></query-formatter>
@ -213,7 +213,7 @@
<span class="remove" ng-click="deleteVisualization($event, vis)" ng-show="canEdit"> &times;</span>
</rd-tab>
<rd-tab tab-id="add" name="&plus; New Visualization" removeable="true" ng-show="canEdit"></rd-tab>
<li ng-if="!sourceMode" class="rd-tab-btn"><button class="btn btn-sm btn-default" ng-click="executeQuery()" ng-disabled="queryExecuting" title="Refresh Dataset"><span class="glyphicon glyphicon-refresh"></span></button></li>
<li ng-if="!sourceMode && canExecuteQuery" class="rd-tab-btn"><button class="btn btn-sm btn-default" ng-click="executeQuery()" ng-disabled="queryExecuting" title="Refresh Dataset"><span class="glyphicon glyphicon-refresh"></span></button></li>
</ul>
</div>
</div>