mirror of https://github.com/portainer/portainer
				
				
				
			feat(oauth): default team for user on oauth settings
							parent
							
								
									4d8133f696
								
							
						
					
					
						commit
						2755527d28
					
				| 
						 | 
				
			
			@ -67,6 +67,7 @@ type (
 | 
			
		|||
		UserIdentifier       string `json:"UserIdentifier"`
 | 
			
		||||
		Scopes               string `json:"Scopes"`
 | 
			
		||||
		OAuthAutoCreateUsers bool   `json:"OAuthAutoCreateUsers"`
 | 
			
		||||
		DefaultTeamID        TeamID     `json:"DefaultTeamID"`
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// TLSConfiguration represents a TLS configuration
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -149,6 +149,9 @@
 | 
			
		|||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div class="col-sm-12 form-section-title">
 | 
			
		||||
      Automatic user provisioning
 | 
			
		||||
  </div>
 | 
			
		||||
  <div class="form-group">
 | 
			
		||||
    <span class="col-sm-12 text-muted small">
 | 
			
		||||
      With automatic user provisioning enabled, Portainer will create user(s) automatically with standard user role. If
 | 
			
		||||
| 
						 | 
				
			
			@ -163,4 +166,25 @@
 | 
			
		|||
      </label>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
  <div ng-if="$ctrl.settings.OAuthAutoCreateUsers">
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
      <span class="col-sm-12 text-muted small">
 | 
			
		||||
        The users created by the automatic provisioning feature can be added to a default team on creation. This setting is optional.
 | 
			
		||||
      </span>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
      <label for="team_provisioning" class="col-sm-2 col-lg-1">Default team</label>
 | 
			
		||||
      <div class="col-sm-1">
 | 
			
		||||
        <button type="button" class="btn btn-sm btn-danger pull-right" ng-click="$ctrl.settings.DefaultTeamID = null"
 | 
			
		||||
          ng-disabled="!$ctrl.settings.DefaultTeamID">
 | 
			
		||||
          <i class="fa fa-times" aria-hidden="true"></i>
 | 
			
		||||
        </button>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="col-sm-9 col-lg-10">
 | 
			
		||||
        <select class="form-control" ng-model="$ctrl.settings.DefaultTeamID" ng-options="team.Id as team.Name for team in $ctrl.teams">
 | 
			
		||||
        </select>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
angular.module('portainer.extensions.oauth').component('oauthSettings', {
 | 
			
		||||
  templateUrl: 'app/extensions/oauth/components/oauth-settings/oauth-settings.html',
 | 
			
		||||
  bindings: {
 | 
			
		||||
    settings: '<'
 | 
			
		||||
    settings: '<',
 | 
			
		||||
    teams: '<'
 | 
			
		||||
  }
 | 
			
		||||
});
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,4 +53,5 @@ function OAuthSettingsViewModel(data) {
 | 
			
		|||
  this.UserIdentifier = data.UserIdentifier;
 | 
			
		||||
  this.Scopes = data.Scopes;
 | 
			
		||||
  this.OAuthAutoCreateUsers = data.OAuthAutoCreateUsers;
 | 
			
		||||
  this.DefaultTeamID = data.DefaultTeamID;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -322,7 +322,7 @@
 | 
			
		|||
            <!-- !group-search-settings -->
 | 
			
		||||
          </div>
 | 
			
		||||
 | 
			
		||||
          <oauth-settings ng-if="isOauthEnabled()" settings="OAuthSettings"></oauth-settings>
 | 
			
		||||
          <oauth-settings ng-if="isOauthEnabled()" settings="OAuthSettings" teams="teams"></oauth-settings>
 | 
			
		||||
 | 
			
		||||
            <!-- actions -->
 | 
			
		||||
          <div class="form-group">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
angular.module('portainer.app')
 | 
			
		||||
.controller('SettingsAuthenticationController', ['$q', '$scope', 'Notifications', 'SettingsService', 'FileUploadService',
 | 
			
		||||
function ($q, $scope, Notifications, SettingsService, FileUploadService) {
 | 
			
		||||
.controller('SettingsAuthenticationController', ['$q', '$scope', 'Notifications', 'SettingsService', 'FileUploadService', 'TeamService',
 | 
			
		||||
function ($q, $scope, Notifications, SettingsService, FileUploadService, TeamService) {
 | 
			
		||||
 | 
			
		||||
  $scope.state = {
 | 
			
		||||
    successfulConnectivityCheck: false,
 | 
			
		||||
| 
						 | 
				
			
			@ -96,9 +96,12 @@ function ($q, $scope, Notifications, SettingsService, FileUploadService) {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  function initView() {
 | 
			
		||||
    SettingsService.settings()
 | 
			
		||||
    .then(function success(data) {
 | 
			
		||||
      var settings = data;
 | 
			
		||||
    $q.all({
 | 
			
		||||
      settings: SettingsService.settings(),
 | 
			
		||||
      teams: TeamService.teams()
 | 
			
		||||
    }).then(function success(data) {
 | 
			
		||||
      var settings = data.settings;
 | 
			
		||||
      $scope.teams = data.teams;
 | 
			
		||||
      $scope.settings = settings;
 | 
			
		||||
      $scope.LDAPSettings = settings.LDAPSettings;
 | 
			
		||||
      $scope.OAuthSettings = settings.OAuthSettings;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue