fix(access/team): team member cannot change ownership to its own team [EE-4423] (#8052)
parent
37896661d6
commit
b22cdb3559
|
@ -742,9 +742,17 @@ angular.module('portainer.docker').controller('CreateContainerController', [
|
|||
Container.get({ id: $transition$.params().from })
|
||||
.$promise.then(function success(d) {
|
||||
var fromContainer = new ContainerDetailsViewModel(d);
|
||||
if (fromContainer.ResourceControl && fromContainer.ResourceControl.Public) {
|
||||
$scope.formValues.AccessControlData.AccessControlEnabled = false;
|
||||
if (fromContainer.ResourceControl) {
|
||||
if (fromContainer.ResourceControl.Public) {
|
||||
$scope.formValues.AccessControlData.AccessControlEnabled = false;
|
||||
}
|
||||
|
||||
// When the container is create by duplicate/edit, the access permission
|
||||
// shouldn't be copied
|
||||
fromContainer.ResourceControl.UserAccesses = [];
|
||||
fromContainer.ResourceControl.TeamAccesses = [];
|
||||
}
|
||||
|
||||
$scope.fromContainer = fromContainer;
|
||||
$scope.state.mode = 'duplicate';
|
||||
$scope.config = ContainerHelper.configFromContainer(fromContainer.Model);
|
||||
|
|
|
@ -109,6 +109,12 @@ export function EditDetails({
|
|||
if (ownership === ResourceControlOwnership.RESTRICTED) {
|
||||
authorizedUsers = [];
|
||||
authorizedTeams = [];
|
||||
// Non admin team leaders/members under only one team can
|
||||
// automatically grant the resource access to all members
|
||||
// under the team
|
||||
if (!isAdmin && teams && teams.length === 1) {
|
||||
authorizedTeams = teams.map((team) => team.Id);
|
||||
}
|
||||
}
|
||||
|
||||
handleChange({ ownership, authorizedTeams, authorizedUsers });
|
||||
|
|
Loading…
Reference in New Issue