|
|
@ -71,19 +71,16 @@ angular.module('portainer.app').controller('porAccessControlFormController', [
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.then(function success(data) {
|
|
|
|
.then(function success(data) {
|
|
|
|
ctrl.availableUsers = _.orderBy(data.availableUsers, 'Username', 'asc');
|
|
|
|
ctrl.availableUsers = _.orderBy(data.availableUsers, 'Username', 'asc');
|
|
|
|
|
|
|
|
ctrl.availableTeams = _.orderBy(data.availableTeams, 'Name', 'asc');
|
|
|
|
var availableTeams = _.orderBy(data.availableTeams, 'Name', 'asc');
|
|
|
|
if (!isAdmin && ctrl.availableTeams.length === 1) {
|
|
|
|
ctrl.availableTeams = availableTeams;
|
|
|
|
ctrl.formData.AuthorizedTeams = ctrl.availableTeams;
|
|
|
|
if (!isAdmin && availableTeams.length === 1) {
|
|
|
|
|
|
|
|
ctrl.formData.AuthorizedTeams = availableTeams;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return $q.when(ctrl.resourceControl && ResourceControlService.retrieveOwnershipDetails(ctrl.resourceControl));
|
|
|
|
return $q.when(ctrl.resourceControl && ResourceControlService.retrieveOwnershipDetails(ctrl.resourceControl));
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.then(function success(data) {
|
|
|
|
.then(function success(data) {
|
|
|
|
if (data) {
|
|
|
|
if (data) {
|
|
|
|
var authorizedUsers = data.authorizedUsers;
|
|
|
|
const authorizedTeams = !isAdmin && ctrl.availableTeams.length === 1 ? ctrl.availableTeams : data.authorizedTeams;
|
|
|
|
var authorizedTeams = data.authorizedTeams;
|
|
|
|
const authorizedUsers = !isAdmin && authorizedTeams.length === 1 ? [] : data.authorizedUsers;
|
|
|
|
setOwnership(ctrl.resourceControl, isAdmin);
|
|
|
|
setOwnership(ctrl.resourceControl, isAdmin);
|
|
|
|
setAuthorizedUsersAndTeams(authorizedUsers, authorizedTeams);
|
|
|
|
setAuthorizedUsersAndTeams(authorizedUsers, authorizedTeams);
|
|
|
|
}
|
|
|
|
}
|
|
|
|