mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-18 08:15:16 +01:00
updates for toggling project publicity and block user remove admin role with himself.
This commit is contained in:
parent
5cf6f99025
commit
a7f0037156
@ -12,5 +12,5 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<button ng-if="vm.isPublic" ng-disabled="!vm.owned" class="btn btn-success" ng-click="vm.toggle()">// 'button_on' | tr //</button>
|
<button ng-if="vm.isPublic" class="btn btn-success" ng-click="vm.toggle()">// 'button_on' | tr //</button>
|
||||||
<button ng-if="!vm.isPublic" ng-disabled="!vm.owned" class="btn btn-danger" ng-click="vm.toggle()">// 'button_off' | tr //</button>
|
<button ng-if="!vm.isPublic" class="btn btn-danger" ng-click="vm.toggle()">// 'button_off' | tr //</button>
|
@ -44,10 +44,10 @@
|
|||||||
<td width="20%">//u.email//</td>
|
<td width="20%">//u.email//</td>
|
||||||
<td width="35%">//u.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
|
<td width="35%">//u.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
|
||||||
<td width="15%">
|
<td width="15%">
|
||||||
<toggle-admin has-admin-role="u.has_admin_role" user-id="//u.user_id//"></toggle-admin>
|
<toggle-admin current-user="vm.currentUser" has-admin-role="u.has_admin_role" user-id="//u.user_id//"></toggle-admin>
|
||||||
</td>
|
</td>
|
||||||
<td width="20%">
|
<td width="20%">
|
||||||
<a href="javascript:void(0)" ng-click="vm.confirmToDelete(u.user_id, u.username)"><span class="glyphicon glyphicon-trash"></span></a>
|
<a ng-if="vm.currentUser.user_id != u.user_id" href="javascript:void(0)" ng-click="vm.confirmToDelete(u.user_id, u.username)"><span class="glyphicon glyphicon-trash"></span></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
.module('harbor.user')
|
.module('harbor.user')
|
||||||
.directive('listUser', listUser);
|
.directive('listUser', listUser);
|
||||||
|
|
||||||
ListUserController.$inject = ['$scope', 'ListUserService', 'DeleteUserService', '$filter', 'trFilter'];
|
ListUserController.$inject = ['$scope', 'ListUserService', 'DeleteUserService', 'currentUser', '$filter', 'trFilter'];
|
||||||
|
|
||||||
function ListUserController($scope, ListUserService, DeleteUserService, $filter, $trFilter) {
|
function ListUserController($scope, ListUserService, DeleteUserService, currentUser, $filter, $trFilter) {
|
||||||
|
|
||||||
$scope.subsSubPane = 226;
|
$scope.subsSubPane = 226;
|
||||||
|
|
||||||
@ -34,6 +34,8 @@
|
|||||||
vm.confirmToDelete = confirmToDelete;
|
vm.confirmToDelete = confirmToDelete;
|
||||||
vm.retrieve = retrieve;
|
vm.retrieve = retrieve;
|
||||||
|
|
||||||
|
vm.currentUser = currentUser.get();
|
||||||
|
|
||||||
vm.retrieve();
|
vm.retrieve();
|
||||||
|
|
||||||
function searchUser() {
|
function searchUser() {
|
||||||
|
@ -12,5 +12,5 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<button ng-show="vm.isAdmin" class="btn btn-success" ng-click="vm.toggle()">// 'button_on' | tr //</button>
|
<button ng-show="vm.isAdmin" ng-disabled="!vm.editable" class="btn btn-success" ng-click="vm.toggle()">// 'button_on' | tr //</button>
|
||||||
<button ng-show="!vm.isAdmin" class="btn btn-danger" ng-click="vm.toggle()">// 'button_off' | tr //</button>
|
<button ng-show="!vm.isAdmin" class="btn btn-danger" ng-click="vm.toggle()">// 'button_off' | tr //</button>
|
@ -28,6 +28,7 @@
|
|||||||
vm.isAdmin = (vm.hasAdminRole === 1);
|
vm.isAdmin = (vm.hasAdminRole === 1);
|
||||||
vm.enabled = vm.isAdmin ? 0 : 1;
|
vm.enabled = vm.isAdmin ? 0 : 1;
|
||||||
vm.toggle = toggle;
|
vm.toggle = toggle;
|
||||||
|
vm.editable = (vm.currentUser.user_id != vm.userId);
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
ToggleAdminService(vm.userId, vm.enabled)
|
ToggleAdminService(vm.userId, vm.enabled)
|
||||||
@ -63,7 +64,8 @@
|
|||||||
'templateUrl': '/static/resources/js/components/user/toggle-admin.directive.html',
|
'templateUrl': '/static/resources/js/components/user/toggle-admin.directive.html',
|
||||||
'scope': {
|
'scope': {
|
||||||
'hasAdminRole': '=',
|
'hasAdminRole': '=',
|
||||||
'userId': '@'
|
'userId': '@',
|
||||||
|
'currentUser': '='
|
||||||
},
|
},
|
||||||
'link': link,
|
'link': link,
|
||||||
'controller': ToggleAdminController,
|
'controller': ToggleAdminController,
|
||||||
|
Loading…
Reference in New Issue
Block a user