mirror of https://github.com/grafana/grafana.git
				
				
				
			Merge branch 'external-user-mng' into v4.4.x
This commit is contained in:
		
						commit
						d630f3d59e
					
				| 
						 | 
					@ -204,6 +204,11 @@ login_hint = email or username
 | 
				
			||||||
# Default UI theme ("dark" or "light")
 | 
					# Default UI theme ("dark" or "light")
 | 
				
			||||||
default_theme = dark
 | 
					default_theme = dark
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# External user management
 | 
				
			||||||
 | 
					external_manage_link_url =
 | 
				
			||||||
 | 
					external_manage_link_name =
 | 
				
			||||||
 | 
					external_manage_info =
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[auth]
 | 
					[auth]
 | 
				
			||||||
# Set to true to disable (hide) the login form, useful if you use OAuth
 | 
					# Set to true to disable (hide) the login form, useful if you use OAuth
 | 
				
			||||||
disable_login_form = false
 | 
					disable_login_form = false
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -191,6 +191,11 @@
 | 
				
			||||||
# Default UI theme ("dark" or "light")
 | 
					# Default UI theme ("dark" or "light")
 | 
				
			||||||
;default_theme = dark
 | 
					;default_theme = dark
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# External user management, these options affect the organization users view
 | 
				
			||||||
 | 
					;external_manage_link_url =
 | 
				
			||||||
 | 
					;external_manage_link_name =
 | 
				
			||||||
 | 
					;external_manage_info =
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[auth]
 | 
					[auth]
 | 
				
			||||||
# Set to true to disable (hide) the login form, useful if you use OAuth, defaults to false
 | 
					# Set to true to disable (hide) the login form, useful if you use OAuth, defaults to false
 | 
				
			||||||
;disable_login_form = false
 | 
					;disable_login_form = false
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -142,6 +142,9 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
 | 
				
			||||||
		"googleAnalyticsId":       setting.GoogleAnalyticsId,
 | 
							"googleAnalyticsId":       setting.GoogleAnalyticsId,
 | 
				
			||||||
		"disableLoginForm":        setting.DisableLoginForm,
 | 
							"disableLoginForm":        setting.DisableLoginForm,
 | 
				
			||||||
		"disableSignoutMenu":      setting.DisableSignoutMenu,
 | 
							"disableSignoutMenu":      setting.DisableSignoutMenu,
 | 
				
			||||||
 | 
							"externalUserMngInfo":     setting.ExternalUserMngInfo,
 | 
				
			||||||
 | 
							"externalUserMngLinkUrl":  setting.ExternalUserMngLinkUrl,
 | 
				
			||||||
 | 
							"externalUserMngLinkName": setting.ExternalUserMngLinkName,
 | 
				
			||||||
		"buildInfo": map[string]interface{}{
 | 
							"buildInfo": map[string]interface{}{
 | 
				
			||||||
			"version":       setting.BuildVersion,
 | 
								"version":       setting.BuildVersion,
 | 
				
			||||||
			"commit":        setting.BuildCommit,
 | 
								"commit":        setting.BuildCommit,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -99,6 +99,9 @@ var (
 | 
				
			||||||
	DefaultTheme            string
 | 
						DefaultTheme            string
 | 
				
			||||||
	DisableLoginForm        bool
 | 
						DisableLoginForm        bool
 | 
				
			||||||
	DisableSignoutMenu      bool
 | 
						DisableSignoutMenu      bool
 | 
				
			||||||
 | 
						ExternalUserMngLinkUrl  string
 | 
				
			||||||
 | 
						ExternalUserMngLinkName string
 | 
				
			||||||
 | 
						ExternalUserMngInfo     string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Http auth
 | 
						// Http auth
 | 
				
			||||||
	AdminUser     string
 | 
						AdminUser     string
 | 
				
			||||||
| 
						 | 
					@ -531,6 +534,9 @@ func NewConfigContext(args *CommandLineArgs) error {
 | 
				
			||||||
	VerifyEmailEnabled = users.Key("verify_email_enabled").MustBool(false)
 | 
						VerifyEmailEnabled = users.Key("verify_email_enabled").MustBool(false)
 | 
				
			||||||
	LoginHint = users.Key("login_hint").String()
 | 
						LoginHint = users.Key("login_hint").String()
 | 
				
			||||||
	DefaultTheme = users.Key("default_theme").String()
 | 
						DefaultTheme = users.Key("default_theme").String()
 | 
				
			||||||
 | 
						ExternalUserMngLinkUrl = users.Key("external_manage_link_url").String()
 | 
				
			||||||
 | 
						ExternalUserMngLinkName = users.Key("external_manage_link_name").String()
 | 
				
			||||||
 | 
						ExternalUserMngInfo = users.Key("external_manage_info").String()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// auth
 | 
						// auth
 | 
				
			||||||
	auth := Cfg.Section("auth")
 | 
						auth := Cfg.Section("auth")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,7 @@
 | 
				
			||||||
import config from 'app/core/config';
 | 
					import config from 'app/core/config';
 | 
				
			||||||
import _ from 'lodash';
 | 
					import _ from 'lodash';
 | 
				
			||||||
import coreModule from 'app/core/core_module';
 | 
					import coreModule from 'app/core/core_module';
 | 
				
			||||||
 | 
					import Remarkable from 'remarkable';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class OrgUsersCtrl {
 | 
					export class OrgUsersCtrl {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,11 +11,14 @@ export class OrgUsersCtrl {
 | 
				
			||||||
  users: any;
 | 
					  users: any;
 | 
				
			||||||
  pendingInvites: any;
 | 
					  pendingInvites: any;
 | 
				
			||||||
  editor: any;
 | 
					  editor: any;
 | 
				
			||||||
  showInviteUI: boolean;
 | 
					 | 
				
			||||||
  navModel: any;
 | 
					  navModel: any;
 | 
				
			||||||
 | 
					  externalUserMngLinkUrl: string;
 | 
				
			||||||
 | 
					  externalUserMngLinkName: string;
 | 
				
			||||||
 | 
					  externalUserMngInfo: string;
 | 
				
			||||||
 | 
					  addUsersBtnName: string;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /** @ngInject */
 | 
					  /** @ngInject */
 | 
				
			||||||
  constructor(private $scope, private $http, private backendSrv, navModelSrv) {
 | 
					  constructor(private $scope, private $http, private backendSrv, navModelSrv, $sce) {
 | 
				
			||||||
    this.user = {
 | 
					    this.user = {
 | 
				
			||||||
      loginOrEmail: '',
 | 
					      loginOrEmail: '',
 | 
				
			||||||
      role: 'Viewer',
 | 
					      role: 'Viewer',
 | 
				
			||||||
| 
						 | 
					@ -23,7 +27,27 @@ export class OrgUsersCtrl {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.get();
 | 
					    this.get();
 | 
				
			||||||
    this.editor = { index: 0 };
 | 
					    this.editor = { index: 0 };
 | 
				
			||||||
    this.showInviteUI = config.disableLoginForm === false;
 | 
					    this.externalUserMngLinkUrl = config.externalUserMngLinkUrl;
 | 
				
			||||||
 | 
					    this.externalUserMngLinkName = config.externalUserMngLinkName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // render external user management info markdown
 | 
				
			||||||
 | 
					    if (config.externalUserMngInfo) {
 | 
				
			||||||
 | 
					      this.externalUserMngInfo = new Remarkable({
 | 
				
			||||||
 | 
					        linkTarget: '__blank',
 | 
				
			||||||
 | 
					      }).render(config.externalUserMngInfo);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    this.addUsersBtnName = this.getAddUserBtnName();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  getAddUserBtnName(): string {
 | 
				
			||||||
 | 
					    if (this.externalUserMngLinkName) {
 | 
				
			||||||
 | 
					      return this.externalUserMngLinkName;
 | 
				
			||||||
 | 
					    } else if (config.disableLoginForm) {
 | 
				
			||||||
 | 
					      return "Add Users";
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      return "Add or Invite";
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  get() {
 | 
					  get() {
 | 
				
			||||||
| 
						 | 
					@ -68,13 +92,13 @@ export class OrgUsersCtrl {
 | 
				
			||||||
    evt.stopPropagation();
 | 
					    evt.stopPropagation();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  openInviteModal() {
 | 
					  openAddUsersView() {
 | 
				
			||||||
    var modalScope = this.$scope.$new();
 | 
					    var modalScope = this.$scope.$new();
 | 
				
			||||||
    modalScope.invitesSent = this.get.bind(this);
 | 
					    modalScope.invitesSent = this.get.bind(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var src = this.showInviteUI
 | 
					    var src = config.disableLoginForm
 | 
				
			||||||
      ? 'public/app/features/org/partials/invite.html'
 | 
					      ? 'public/app/features/org/partials/add_user.html'
 | 
				
			||||||
      : 'public/app/features/org/partials/add_user.html';
 | 
					      : 'public/app/features/org/partials/invite.html';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.$scope.appEvent('show-modal', {
 | 
					    this.$scope.appEvent('show-modal', {
 | 
				
			||||||
      src: src,
 | 
					      src: src,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,11 +5,17 @@
 | 
				
			||||||
		<h1>Organization users</h1>
 | 
							<h1>Organization users</h1>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		<div class="page-header-tabs">
 | 
							<div class="page-header-tabs">
 | 
				
			||||||
			<button class="btn btn-success" ng-click="ctrl.openInviteModal()">
 | 
					
 | 
				
			||||||
 | 
								<button class="btn btn-success" ng-click="ctrl.openAddUsersView()" ng-hide="ctrl.externalUserMngLinkUrl">
 | 
				
			||||||
				<i class="fa fa-plus"></i>
 | 
									<i class="fa fa-plus"></i>
 | 
				
			||||||
        Add <span ng-show="ctrl.showInviteUI"> or Invite</span>
 | 
					        <span>{{ctrl.addUsersBtnName}}</span>
 | 
				
			||||||
			</button>
 | 
								</button>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      <a class="btn btn-inverse" ng-href="{{ctrl.externalUserMngLinkUrl}}" target="_blank" ng-if="ctrl.externalUserMngLinkUrl">
 | 
				
			||||||
 | 
									<i class="fa fa-external-link-square"></i>
 | 
				
			||||||
 | 
					        {{ctrl.addUsersBtnName}}
 | 
				
			||||||
 | 
					      </a>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			<ul class="gf-tabs">
 | 
								<ul class="gf-tabs">
 | 
				
			||||||
				<li class="gf-tabs-item">
 | 
									<li class="gf-tabs-item">
 | 
				
			||||||
					<a class="gf-tabs-link" ng-click="ctrl.editor.index = 0" ng-class="{active: ctrl.editor.index === 0}">
 | 
										<a class="gf-tabs-link" ng-click="ctrl.editor.index = 0" ng-class="{active: ctrl.editor.index === 0}">
 | 
				
			||||||
| 
						 | 
					@ -25,6 +31,10 @@
 | 
				
			||||||
		</div>
 | 
							</div>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <div class="grafana-info-box" ng-if="ctrl.externalUserMngInfo">
 | 
				
			||||||
 | 
					    <span ng-bind-html="ctrl.externalUserMngInfo"></span>
 | 
				
			||||||
 | 
					  </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <div ng-if="ctrl.editor.index === 0" class="tab-content">
 | 
					  <div ng-if="ctrl.editor.index === 0" class="tab-content">
 | 
				
			||||||
    <table class="filter-table form-inline">
 | 
					    <table class="filter-table form-inline">
 | 
				
			||||||
      <thead>
 | 
					      <thead>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,8 +63,6 @@
 | 
				
			||||||
</section>
 | 
					</section>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="editor-row">
 | 
					<div class="editor-row">
 | 
				
			||||||
	<div class="pull-left">
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	<div class="grafana-info-box span8" ng-if="ctrl.panelCtrl.editorHelpIndex === 1">
 | 
						<div class="grafana-info-box span8" ng-if="ctrl.panelCtrl.editorHelpIndex === 1">
 | 
				
			||||||
		<h5>Shorter legend names</h5>
 | 
							<h5>Shorter legend names</h5>
 | 
				
			||||||
		<ul>
 | 
							<ul>
 | 
				
			||||||
| 
						 | 
					@ -122,5 +120,4 @@
 | 
				
			||||||
			<li>If you override maxDataPoint and set a high value performance can be severely effected</li>
 | 
								<li>If you override maxDataPoint and set a high value performance can be severely effected</li>
 | 
				
			||||||
		</ul>
 | 
							</ul>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
	</div>
 | 
					 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,8 +37,6 @@
 | 
				
			||||||
</section>
 | 
					</section>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<div class="editor-row">
 | 
					<div class="editor-row">
 | 
				
			||||||
	<div class="pull-left">
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	<div class="grafana-info-box span6" ng-if="ctrl.panelCtrl.editorHelpIndex === 1">
 | 
						<div class="grafana-info-box span6" ng-if="ctrl.panelCtrl.editorHelpIndex === 1">
 | 
				
			||||||
		<h5>Alias patterns</h5>
 | 
							<h5>Alias patterns</h5>
 | 
				
			||||||
		<ul>
 | 
							<ul>
 | 
				
			||||||
| 
						 | 
					@ -73,7 +71,6 @@
 | 
				
			||||||
			<li>Example: >60s if you write metrics to InfluxDB every 60 seconds</li>
 | 
								<li>Example: >60s if you write metrics to InfluxDB every 60 seconds</li>
 | 
				
			||||||
		</ul>
 | 
							</ul>
 | 
				
			||||||
	</div>
 | 
						</div>
 | 
				
			||||||
	</div>
 | 
					 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -258,7 +258,6 @@ $popover-border-color:    $gray-1;
 | 
				
			||||||
$popover-help-bg:         $btn-secondary-bg;
 | 
					$popover-help-bg:         $btn-secondary-bg;
 | 
				
			||||||
$popover-help-color:      $text-color;
 | 
					$popover-help-color:      $text-color;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
// Tooltips and popovers
 | 
					// Tooltips and popovers
 | 
				
			||||||
// -------------------------
 | 
					// -------------------------
 | 
				
			||||||
$tooltipColor:            $popover-help-color;
 | 
					$tooltipColor:            $popover-help-color;
 | 
				
			||||||
| 
						 | 
					@ -276,6 +275,9 @@ $card-background: linear-gradient(135deg, #2f2f2f, #262626);
 | 
				
			||||||
$card-background-hover: linear-gradient(135deg, #343434, #262626);
 | 
					$card-background-hover: linear-gradient(135deg, #343434, #262626);
 | 
				
			||||||
$card-shadow: -1px -1px 0 0 hsla(0, 0%, 100%, .1), 1px 1px 0 0 rgba(0, 0, 0, .3);
 | 
					$card-shadow: -1px -1px 0 0 hsla(0, 0%, 100%, .1), 1px 1px 0 0 rgba(0, 0, 0, .3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// info box
 | 
				
			||||||
 | 
					$info-box-background: linear-gradient(120deg, #142749, #0e203e);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// footer
 | 
					// footer
 | 
				
			||||||
$footer-link-color:   $gray-1;
 | 
					$footer-link-color:   $gray-1;
 | 
				
			||||||
$footer-link-hover:   $gray-4;
 | 
					$footer-link-hover:   $gray-4;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -300,6 +300,9 @@ $card-background: linear-gradient(135deg, $gray-5, $gray-6);
 | 
				
			||||||
$card-background-hover: linear-gradient(135deg, $gray-6, $gray-7);
 | 
					$card-background-hover: linear-gradient(135deg, $gray-6, $gray-7);
 | 
				
			||||||
$card-shadow: -1px -1px 0 0 hsla(0, 0%, 100%, .1), 1px 1px 0 0 rgba(0, 0, 0, .1);
 | 
					$card-shadow: -1px -1px 0 0 hsla(0, 0%, 100%, .1), 1px 1px 0 0 rgba(0, 0, 0, .1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// info box
 | 
				
			||||||
 | 
					$info-box-background: linear-gradient(135deg, #f1fbff, #d7ebff);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// footer
 | 
					// footer
 | 
				
			||||||
$footer-link-color:   $gray-3;
 | 
					$footer-link-color:   $gray-3;
 | 
				
			||||||
$footer-link-hover:   $dark-5;
 | 
					$footer-link-hover:   $dark-5;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,15 +5,16 @@
 | 
				
			||||||
  top: -13px;
 | 
					  top: -13px;
 | 
				
			||||||
  left: -8px;
 | 
					  left: -8px;
 | 
				
			||||||
  font-size: 20px;
 | 
					  font-size: 20px;
 | 
				
			||||||
  color: $blue;
 | 
					  color: $text-color;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.grafana-info-box {
 | 
					.grafana-info-box {
 | 
				
			||||||
  position: relative;
 | 
					  position: relative;
 | 
				
			||||||
  background: $card-background;
 | 
					  background: $info-box-background;
 | 
				
			||||||
  box-shadow: $card-shadow;
 | 
					  box-shadow: $card-shadow;
 | 
				
			||||||
  padding: 1rem;
 | 
					  padding: 1rem;
 | 
				
			||||||
  border-radius: 4px;
 | 
					  border-radius: 4px;
 | 
				
			||||||
 | 
					  margin-bottom: $spacer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  h5 {
 | 
					  h5 {
 | 
				
			||||||
    margin-bottom: $spacer;
 | 
					    margin-bottom: $spacer;
 | 
				
			||||||
| 
						 | 
					@ -21,5 +22,9 @@
 | 
				
			||||||
  ul {
 | 
					  ul {
 | 
				
			||||||
    padding-left: $spacer;
 | 
					    padding-left: $spacer;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  a {
 | 
				
			||||||
 | 
					    @extend .external-link;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue