hunk.code_window: 	}
   	return nil
   }
   func (handler *Handler) getToken(request *http.Request, endpoint *portainer.Endpoint, setLocalAdminToken bool) (string, bool, error) {
  
hunk.labels: keep keep replace keep keep keep
hunk.after_edit: 	return &httperror.HandlerError{http.StatusInternalServerError, "Unable to start exec process inside container", err}
  
hunk.file_path: api/http/handler/websocket/pod.go
hunk.type: replace
file: export default class DockerFeaturesConfigurationController {
    /* @ngInject */
    constructor($async, EndpointService, Notifications, StateManager) {
      this.$async = $async;
      this.EndpointService = EndpointService;
      this.Notifications = Notifications;
      this.StateManager = StateManager;
  
      this.formValues = {
        enableHostManagementFeatures: false,
        allowVolumeBrowserForRegularUsers: false,
        disableBindMountsForRegularUsers: false,
        disablePrivilegedModeForRegularUsers: false,
        disableHostNamespaceForRegularUsers: false,
        disableStackManagementForRegularUsers: false,
        disableDeviceMappingForRegularUsers: false,
        disableContainerCapabilitiesForRegularUsers: false,
        disableSysctlSettingForRegularUsers: false,
      };
  
      this.isAgent = false;
  
      this.state = {
        actionInProgress: false,
      };
  
      this.save = this.save.bind(this);
    }
  
    isContainerEditDisabled() {
      const {
        disableBindMountsForRegularUsers,
        disableHostNamespaceForRegularUsers,
        disablePrivilegedModeForRegularUsers,
        disableDeviceMappingForRegularUsers,
        disableContainerCapabilitiesForRegularUsers,
        disableSysctlSettingForRegularUsers,
      } = this.formValues;
      return (
        disableBindMountsForRegularUsers ||
        disableHostNamespaceForRegularUsers ||
        disablePrivilegedModeForRegularUsers ||
        disableDeviceMappingForRegularUsers ||
        disableContainerCapabilitiesForRegularUsers ||
        disableSysctlSettingForRegularUsers
      );
    }
  
    async save() {
      return this.$async(async () => {
        try {
          this.state.actionInProgress = true;
          const securitySettings = {
            enableHostManagementFeatures: this.formValues.enableHostManagementFeatures,
            allowBindMountsForRegularUsers: !this.formValues.disableBindMountsForRegularUsers,
            allowPrivilegedModeForRegularUsers: !this.formValues.disablePrivilegedModeForRegularUsers,
            allowVolumeBrowserForRegularUsers: this.formValues.allowVolumeBrowserForRegularUsers,
            allowHostNamespaceForRegularUsers: !this.formValues.disableHostNamespaceForRegularUsers,
            allowDeviceMappingForRegularUsers: !this.formValues.disableDeviceMappingForRegularUsers,
            allowStackManagementForRegularUsers: !this.formValues.disableStackManagementForRegularUsers,
            allowContainerCapabilitiesForRegularUsers: !this.formValues.disableContainerCapabilitiesForRegularUsers,
            allowSysctlSettingForRegularUsers: !this.formValues.disableSysctlSettingForRegularUsers,
          };
  
          await this.EndpointService.updateSecuritySettings(this.endpoint.Id, securitySettings);
  
          this.endpoint.SecuritySettings = securitySettings;
          this.Notifications.success('Saved settings successfully');
        } catch (e) {
          this.Notifications.error('Failure', e, 'Failed saving settings');
        }
        this.state.actionInProgress = false;
      });
    }
  
    checkAgent() {
      const applicationState = this.StateManager.getState();
      return applicationState.endpoint.mode.agentProxy;
    }
  
    $onInit() {
      const securitySettings = this.endpoint.SecuritySettings;
  
      const isAgent = this.checkAgent();
      this.isAgent = isAgent;
  
      this.formValues = {
        enableHostManagementFeatures: isAgent && securitySettings.enableHostManagementFeatures,
        allowVolumeBrowserForRegularUsers: isAgent && securitySettings.allowVolumeBrowserForRegularUsers,
        disableBindMountsForRegularUsers: !securitySettings.allowBindMountsForRegularUsers,
        disablePrivilegedModeForRegularUsers: !securitySettings.allowPrivilegedModeForRegularUsers,
        disableHostNamespaceForRegularUsers: !securitySettings.allowHostNamespaceForRegularUsers,
        disableDeviceMappingForRegularUsers: !securitySettings.allowDeviceMappingForRegularUsers,
        disableStackManagementForRegularUsers: !securitySettings.allowStackManagementForRegularUsers,
        disableContainerCapabilitiesForRegularUsers: !securitySettings.allowContainerCapabilitiesForRegularUsers,
        disableSysctlSettingForRegularUsers: !securitySettings.allowSysctlSettingForRegularUsers,
      };
    }
  }
  