Merge pull request #2472 from tonyjiangh/fix/disable_view_only_fork

Disable fork button for view_only user
This commit is contained in:
Arik Fraimovich 2018-05-02 14:11:55 +03:00 committed by GitHub
commit ee8f6c1c71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -11,6 +11,7 @@
// The real magic ;)
> a {
pointer-events: none;
color: @dropdown-link-disabled-color;
}
}
@ -29,8 +30,6 @@
&:not([class*="bg-"]) {
& > li > a {
color: #4C4C4C;
&:hover {
color: #000;
}

View File

@ -58,7 +58,7 @@
<span class="zmdi zmdi-more"></span>
</button>
<ul class="dropdown-menu pull-right" uib-dropdown-menu>
<li><a ng-click="duplicateQuery()" ng-disabled="query.id === undefined || !canForkQuery()"> Fork</a></li>
<li ng-class="{'disabled': query.id === undefined || !canForkQuery() }"><a ng-click="duplicateQuery()"> Fork</a></li>
<li class="divider"></li>
<li ng-if="!query.is_archived && query.id != undefined && (isQueryOwner || currentUser.hasPermission('admin'))"><a ng-click="archiveQuery()">Archive</a></li>
<li ng-if="!query.is_archived && query.id != undefined && (isQueryOwner || currentUser.hasPermission('admin')) && showPermissionsControl"><a ng-click="showManagePermissionsModal()">Manage Permissions</a></li>

View File

@ -145,6 +145,8 @@ function QueryViewCtrl(
$scope.canExecuteQuery = () => currentUser.hasPermission('execute_query') && !$scope.dataSource.view_only;
$scope.canForkQuery = () => currentUser.hasPermission('edit_query') && !$scope.dataSource.view_only;
$scope.canScheduleQuery = currentUser.hasPermission('schedule_query');
if ($route.current.locals.dataSources) {