|
92 | 92 | };
|
93 | 93 |
|
94 | 94 | $scope.blockAnonUsers = function() {
|
95 |
| - var principal = $rootScope.ticket.principal; |
96 |
| - if (principal) { |
97 |
| - $scope.isAnonymous = principal === 'anonymous' ? true : false; |
98 |
| - if ($scope.isAnonymous) { |
99 |
| - var zeppelinVersion = $rootScope.zeppelinVersion; |
100 |
| - var url = 'https://zeppelin.apache.org/docs/' + zeppelinVersion + '/security/notebook_authorization.html'; |
101 |
| - var content = 'Only authenticated user can set the permission.' + |
102 |
| - '<a data-toggle="tooltip" data-placement="top" title="Learn more" target="_blank" href=' + url + '>' + |
103 |
| - '<i class="icon-question" />' + |
104 |
| - '</a>'; |
105 |
| - BootstrapDialog.show({ |
106 |
| - closable: false, |
107 |
| - closeByBackdrop: false, |
108 |
| - closeByKeyboard: false, |
109 |
| - title: 'No permission', |
110 |
| - message: content, |
111 |
| - buttons: [{ |
112 |
| - label: 'Close', |
113 |
| - action: function(dialog) { |
114 |
| - dialog.close(); |
115 |
| - } |
116 |
| - }] |
117 |
| - }); |
118 |
| - } |
119 |
| - } |
| 95 | + var zeppelinVersion = $rootScope.zeppelinVersion; |
| 96 | + var url = 'https://zeppelin.apache.org/docs/' + zeppelinVersion + '/security/notebook_authorization.html'; |
| 97 | + var content = 'Only authenticated user can set the permission.' + |
| 98 | + '<a data-toggle="tooltip" data-placement="top" title="Learn more" target="_blank" href=' + url + '>' + |
| 99 | + '<i class="icon-question" />' + |
| 100 | + '</a>'; |
| 101 | + BootstrapDialog.show({ |
| 102 | + closable: false, |
| 103 | + closeByBackdrop: false, |
| 104 | + closeByKeyboard: false, |
| 105 | + title: 'No permission', |
| 106 | + message: content, |
| 107 | + buttons: [{ |
| 108 | + label: 'Close', |
| 109 | + action: function(dialog) { |
| 110 | + dialog.close(); |
| 111 | + } |
| 112 | + }] |
| 113 | + }); |
120 | 114 | };
|
121 | 115 |
|
122 | 116 | /** Init the new controller */
|
|
782 | 776 | };
|
783 | 777 |
|
784 | 778 | $scope.togglePermissions = function() {
|
785 |
| - $scope.blockAnonUsers(); |
786 |
| - if ($scope.showPermissions) { |
787 |
| - $scope.closePermissions(); |
788 |
| - angular.element('#selectOwners').select2({}); |
789 |
| - angular.element('#selectReaders').select2({}); |
790 |
| - angular.element('#selectWriters').select2({}); |
| 779 | + var principal = $rootScope.ticket.principal; |
| 780 | + $scope.isAnonymous = principal === 'anonymous' ? true : false; |
| 781 | + if (!!principal && $scope.isAnonymous) { |
| 782 | + $scope.blockAnonUsers(); |
791 | 783 | } else {
|
792 |
| - $scope.openPermissions(); |
793 |
| - $scope.closeSetting(); |
| 784 | + if ($scope.showPermissions) { |
| 785 | + $scope.closePermissions(); |
| 786 | + angular.element('#selectOwners').select2({}); |
| 787 | + angular.element('#selectReaders').select2({}); |
| 788 | + angular.element('#selectWriters').select2({}); |
| 789 | + } else { |
| 790 | + $scope.openPermissions(); |
| 791 | + $scope.closeSetting(); |
| 792 | + } |
794 | 793 | }
|
795 | 794 | };
|
796 | 795 |
|
|
0 commit comments