mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-23 02:35:17 +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
|
||||
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" ng-disabled="!vm.owned" class="btn btn-danger" ng-click="vm.toggle()">// 'button_off' | tr //</button>
|
||||
<button ng-if="vm.isPublic" class="btn btn-success" ng-click="vm.toggle()">// 'button_on' | 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="35%">//u.creation_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
|
||||
<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 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>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -20,9 +20,9 @@
|
||||
.module('harbor.user')
|
||||
.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;
|
||||
|
||||
@ -33,6 +33,8 @@
|
||||
vm.deleteUser = deleteUser;
|
||||
vm.confirmToDelete = confirmToDelete;
|
||||
vm.retrieve = retrieve;
|
||||
|
||||
vm.currentUser = currentUser.get();
|
||||
|
||||
vm.retrieve();
|
||||
|
||||
|
@ -12,5 +12,5 @@
|
||||
See the License for the specific language governing permissions and
|
||||
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>
|
@ -28,6 +28,7 @@
|
||||
vm.isAdmin = (vm.hasAdminRole === 1);
|
||||
vm.enabled = vm.isAdmin ? 0 : 1;
|
||||
vm.toggle = toggle;
|
||||
vm.editable = (vm.currentUser.user_id != vm.userId);
|
||||
|
||||
function toggle() {
|
||||
ToggleAdminService(vm.userId, vm.enabled)
|
||||
@ -63,7 +64,8 @@
|
||||
'templateUrl': '/static/resources/js/components/user/toggle-admin.directive.html',
|
||||
'scope': {
|
||||
'hasAdminRole': '=',
|
||||
'userId': '@'
|
||||
'userId': '@',
|
||||
'currentUser': '='
|
||||
},
|
||||
'link': link,
|
||||
'controller': ToggleAdminController,
|
||||
|
Loading…
Reference in New Issue
Block a user