Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
970619ed
Commit
970619ed
authored
Mar 20, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'disable-login'
parents
4d4e165b
6f324cd7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
16 deletions
+80
-16
pkg/api/frontendsettings.go
+1
-0
pkg/api/login.go
+4
-0
pkg/api/org_invite.go
+4
-0
public/app/features/org/org_users_ctrl.ts
+13
-13
public/app/features/org/partials/add_user.html
+55
-0
public/app/features/org/partials/orgUsers.html
+3
-3
No files found.
pkg/api/frontendsettings.go
View file @
970619ed
...
@@ -142,6 +142,7 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
...
@@ -142,6 +142,7 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
"ldapEnabled"
:
setting
.
LdapEnabled
,
"ldapEnabled"
:
setting
.
LdapEnabled
,
"alertingEnabled"
:
setting
.
AlertingEnabled
,
"alertingEnabled"
:
setting
.
AlertingEnabled
,
"googleAnalyticsId"
:
setting
.
GoogleAnalyticsId
,
"googleAnalyticsId"
:
setting
.
GoogleAnalyticsId
,
"disableLoginForm"
:
setting
.
DisableLoginForm
,
"buildInfo"
:
map
[
string
]
interface
{}{
"buildInfo"
:
map
[
string
]
interface
{}{
"version"
:
setting
.
BuildVersion
,
"version"
:
setting
.
BuildVersion
,
"commit"
:
setting
.
BuildCommit
,
"commit"
:
setting
.
BuildCommit
,
...
...
pkg/api/login.go
View file @
970619ed
...
@@ -94,6 +94,10 @@ func LoginApiPing(c *middleware.Context) {
...
@@ -94,6 +94,10 @@ func LoginApiPing(c *middleware.Context) {
}
}
func
LoginPost
(
c
*
middleware
.
Context
,
cmd
dtos
.
LoginCommand
)
Response
{
func
LoginPost
(
c
*
middleware
.
Context
,
cmd
dtos
.
LoginCommand
)
Response
{
if
setting
.
DisableLoginForm
{
return
ApiError
(
401
,
"Login is disabled"
,
nil
)
}
authQuery
:=
login
.
LoginUserQuery
{
authQuery
:=
login
.
LoginUserQuery
{
Username
:
cmd
.
User
,
Username
:
cmd
.
User
,
Password
:
cmd
.
Password
,
Password
:
cmd
.
Password
,
...
...
pkg/api/org_invite.go
View file @
970619ed
...
@@ -38,6 +38,10 @@ func AddOrgInvite(c *middleware.Context, inviteDto dtos.AddInviteForm) Response
...
@@ -38,6 +38,10 @@ func AddOrgInvite(c *middleware.Context, inviteDto dtos.AddInviteForm) Response
if
err
!=
m
.
ErrUserNotFound
{
if
err
!=
m
.
ErrUserNotFound
{
return
ApiError
(
500
,
"Failed to query db for existing user check"
,
err
)
return
ApiError
(
500
,
"Failed to query db for existing user check"
,
err
)
}
}
if
setting
.
DisableLoginForm
{
return
ApiError
(
401
,
"User could not be found"
,
nil
)
}
}
else
{
}
else
{
return
inviteExistingUserToOrg
(
c
,
userQuery
.
Result
,
&
inviteDto
)
return
inviteExistingUserToOrg
(
c
,
userQuery
.
Result
,
&
inviteDto
)
}
}
...
...
public/app/features/org/org_users_ctrl.ts
View file @
970619ed
///<reference path="../../headers/common.d.ts" />
///<reference path="../../headers/common.d.ts" />
import
angular
from
'angular
'
;
import
config
from
'app/core/config
'
;
import
_
from
'lodash'
;
import
_
from
'lodash'
;
import
coreModule
from
'
../..
/core/core_module'
;
import
coreModule
from
'
app
/core/core_module'
;
export
class
OrgUsersCtrl
{
export
class
OrgUsersCtrl
{
...
@@ -10,6 +10,7 @@ export class OrgUsersCtrl {
...
@@ -10,6 +10,7 @@ export class OrgUsersCtrl {
users
:
any
;
users
:
any
;
pendingInvites
:
any
;
pendingInvites
:
any
;
editor
:
any
;
editor
:
any
;
showInviteUI
:
boolean
;
/** @ngInject */
/** @ngInject */
constructor
(
private
$scope
,
private
$http
,
private
backendSrv
)
{
constructor
(
private
$scope
,
private
$http
,
private
backendSrv
)
{
...
@@ -17,8 +18,10 @@ export class OrgUsersCtrl {
...
@@ -17,8 +18,10 @@ export class OrgUsersCtrl {
loginOrEmail
:
''
,
loginOrEmail
:
''
,
role
:
'Viewer'
,
role
:
'Viewer'
,
};
};
this
.
get
();
this
.
get
();
this
.
editor
=
{
index
:
0
};
this
.
editor
=
{
index
:
0
};
this
.
showInviteUI
=
config
.
disableLoginForm
===
false
;
}
}
get
()
{
get
()
{
...
@@ -50,17 +53,13 @@ export class OrgUsersCtrl {
...
@@ -50,17 +53,13 @@ export class OrgUsersCtrl {
removeUserConfirmed
(
user
)
{
removeUserConfirmed
(
user
)
{
this
.
backendSrv
.
delete
(
'/api/org/users/'
+
user
.
userId
)
this
.
backendSrv
.
delete
(
'/api/org/users/'
+
user
.
userId
)
.
then
(()
=>
{
.
then
(
this
.
get
.
bind
(
this
));
this
.
get
();
});
}
}
revokeInvite
(
invite
,
evt
)
{
revokeInvite
(
invite
,
evt
)
{
evt
.
stopPropagation
();
evt
.
stopPropagation
();
this
.
backendSrv
.
patch
(
'/api/org/invites/'
+
invite
.
code
+
'/revoke'
)
this
.
backendSrv
.
patch
(
'/api/org/invites/'
+
invite
.
code
+
'/revoke'
)
.
then
(()
=>
{
.
then
(
this
.
get
.
bind
(
this
));
this
.
get
();
});
}
}
copyInviteToClipboard
(
evt
)
{
copyInviteToClipboard
(
evt
)
{
...
@@ -69,17 +68,18 @@ export class OrgUsersCtrl {
...
@@ -69,17 +68,18 @@ export class OrgUsersCtrl {
openInviteModal
()
{
openInviteModal
()
{
var
modalScope
=
this
.
$scope
.
$new
();
var
modalScope
=
this
.
$scope
.
$new
();
modalScope
.
invitesSent
=
function
()
{
modalScope
.
invitesSent
=
this
.
get
.
bind
(
this
);
this
.
get
();
};
var
src
=
this
.
showInviteUI
?
'public/app/features/org/partials/invite.html'
:
'public/app/features/org/partials/add_user.html'
;
this
.
$scope
.
appEvent
(
'show-modal'
,
{
this
.
$scope
.
appEvent
(
'show-modal'
,
{
src
:
'public/app/features/org/partials/invite.html'
,
src
:
src
,
modalClass
:
'invite-modal'
,
modalClass
:
'invite-modal'
,
scope
:
modalScope
scope
:
modalScope
});
});
}
}
}
}
coreModule
.
controller
(
'OrgUsersCtrl'
,
OrgUsersCtrl
);
coreModule
.
controller
(
'OrgUsersCtrl'
,
OrgUsersCtrl
);
public/app/features/org/partials/add_user.html
0 → 100644
View file @
970619ed
<div
class=
"modal-body"
ng-controller=
"UserInviteCtrl"
ng-init=
"init()"
>
<div
class=
"modal-header"
>
<h2
class=
"modal-header-title"
>
Add Users
</h2>
<a
class=
"modal-header-close"
ng-click=
"dismiss();"
>
<i
class=
"fa fa-remove"
></i>
</a>
</div>
<div
class=
"modal-content"
>
<div
class=
"modal-tagline p-b-2"
>
Add existing Grafana users to the organization
<span
class=
"highlight-word"
>
{{contextSrv.user.orgName}}
</span>
</div>
<form
name=
"inviteForm"
>
<div
class=
"gf-form-group"
>
<div
class=
"gf-form-inline"
ng-repeat=
"invite in invites"
>
<div
class=
"gf-form max-width-21"
>
<span
class=
"gf-form-label"
>
Email or Username
</span>
<input
type=
"text"
ng-model=
"invite.loginOrEmail"
required
class=
"gf-form-input"
placeholder=
"email@test.com"
>
</div>
<div
class=
"gf-form max-width-10"
>
<span
class=
"gf-form-label"
>
Role
</span>
<select
ng-model=
"invite.role"
class=
"gf-form-input"
ng-options=
"f for f in ['Viewer', 'Editor', 'Read Only Editor', 'Admin']"
>
</select>
</div>
<div
class=
"gf-form gf-size-auto"
>
<a
class=
"gf-form-label pointer"
tabindex=
"1"
ng-click=
"removeInvite(invite)"
>
<i
class=
"fa fa-remove"
></i>
</a>
</div>
</div>
</div>
<div
class=
"gf-form-inline gf-form-group"
>
<div
class=
"gf-form"
>
<a
class=
"btn btn-inverse btn-small"
ng-click=
"addInvite()"
>
<i
class=
"fa fa-plus"
></i>
Add another
</a>
</div>
</div>
<div
class=
"gf-form-button-row"
>
<button
type=
"submit"
class=
"btn btn-success"
ng-click=
"sendInvites();"
>
Add Users
</button>
<a
class=
"btn-text"
ng-click=
"dismiss()"
>
Cancel
</a>
</div>
<div
class=
"clearfix"
></div>
</form>
</div>
</div>
public/app/features/org/partials/orgUsers.html
View file @
970619ed
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<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.openInviteModal()"
>
<i
class=
"fa fa-plus"
></i>
<i
class=
"fa fa-plus"
></i>
Add or Invite
Add
<span
ng-show=
"ctrl.showInviteUI"
>
or Invite
</span>
</button>
</button>
<ul
class=
"gf-tabs"
>
<ul
class=
"gf-tabs"
>
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
Users ({{ctrl.users.length}})
Users ({{ctrl.users.length}})
</a>
</a>
</li>
</li>
<li
class=
"gf-tabs-item"
>
<li
class=
"gf-tabs-item"
ng-show=
"ctrl.showInviteUI"
>
<a
class=
"gf-tabs-link"
ng-click=
"ctrl.editor.index = 1"
ng-class=
"{active: ctrl.editor.index === 1}"
>
<a
class=
"gf-tabs-link"
ng-click=
"ctrl.editor.index = 1"
ng-class=
"{active: ctrl.editor.index === 1}"
>
Pending Invitations ({{ctrl.pendingInvites.length}})
Pending Invitations ({{ctrl.pendingInvites.length}})
</a>
</a>
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
</table>
</table>
</div>
</div>
<div
ng-if=
"ctrl.editor.index === 1
"
>
<div
ng-if=
"ctrl.editor.index === 1
&& ctrl.showInviteUI"
>
<table
class=
"filter-table form-inline"
>
<table
class=
"filter-table form-inline"
>
<thead>
<thead>
<tr>
<tr>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment