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
737c29ec
Commit
737c29ec
authored
Mar 17, 2017
by
Dan Cech
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable inviting new users to orgs if login form is disabled
parent
38cab50a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
8 deletions
+81
-8
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
+10
-5
public/app/features/org/partials/addUser.html
+55
-0
public/app/features/org/partials/orgUsers.html
+7
-3
No files found.
pkg/api/frontendsettings.go
View file @
737c29ec
...
...
@@ -142,6 +142,7 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro
"ldapEnabled"
:
setting
.
LdapEnabled
,
"alertingEnabled"
:
setting
.
AlertingEnabled
,
"googleAnalyticsId"
:
setting
.
GoogleAnalyticsId
,
"disableLoginForm"
:
setting
.
DisableLoginForm
,
"buildInfo"
:
map
[
string
]
interface
{}{
"version"
:
setting
.
BuildVersion
,
"commit"
:
setting
.
BuildCommit
,
...
...
pkg/api/login.go
View file @
737c29ec
...
...
@@ -94,6 +94,10 @@ func LoginApiPing(c *middleware.Context) {
}
func
LoginPost
(
c
*
middleware
.
Context
,
cmd
dtos
.
LoginCommand
)
Response
{
if
setting
.
DisableLoginForm
{
return
ApiError
(
401
,
"Login is disabled"
,
nil
)
}
authQuery
:=
login
.
LoginUserQuery
{
Username
:
cmd
.
User
,
Password
:
cmd
.
Password
,
...
...
pkg/api/org_invite.go
View file @
737c29ec
...
...
@@ -38,6 +38,10 @@ func AddOrgInvite(c *middleware.Context, inviteDto dtos.AddInviteForm) Response
if
err
!=
m
.
ErrUserNotFound
{
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
{
return
inviteExistingUserToOrg
(
c
,
userQuery
.
Result
,
&
inviteDto
)
}
...
...
public/app/features/org/org_users_ctrl.ts
View file @
737c29ec
///<reference path="../../headers/common.d.ts" />
import
angular
from
'angular
'
;
import
config
from
'app/core/config
'
;
import
_
from
'lodash'
;
import
coreModule
from
'
../..
/core/core_module'
;
import
coreModule
from
'
app
/core/core_module'
;
export
class
OrgUsersCtrl
{
...
...
@@ -19,6 +19,8 @@ export class OrgUsersCtrl {
};
this
.
get
();
this
.
editor
=
{
index
:
0
};
$scope
.
disableInvites
=
config
.
disableLoginForm
;
}
get
()
{
...
...
@@ -69,17 +71,20 @@ export class OrgUsersCtrl {
openInviteModal
()
{
var
modalScope
=
this
.
$scope
.
$new
();
modalScope
.
invitesSent
=
function
()
{
modalScope
.
invitesSent
=
()
=>
{
this
.
get
();
};
var
src
=
!
this
.
$scope
.
disableInvites
?
'public/app/features/org/partials/invite.html'
:
'public/app/features/org/partials/addUser.html'
;
this
.
$scope
.
appEvent
(
'show-modal'
,
{
src
:
'public/app/features/org/partials/invite.html'
,
src
:
src
,
modalClass
:
'invite-modal'
,
scope
:
modalScope
});
}
}
coreModule
.
controller
(
'OrgUsersCtrl'
,
OrgUsersCtrl
);
public/app/features/org/partials/addUser.html
0 → 100644
View file @
737c29ec
<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 @
737c29ec
...
...
@@ -6,10 +6,14 @@
<h1>
Organization users
</h1>
<div
class=
"page-header-tabs"
>
<button
class=
"btn btn-success"
ng-click=
"ctrl.openInviteModal()"
>
<button
class=
"btn btn-success"
ng-click=
"ctrl.openInviteModal()"
ng-show=
"!disableInvites"
>
<i
class=
"fa fa-plus"
></i>
Add or Invite
</button>
<button
class=
"btn btn-success"
ng-click=
"ctrl.openInviteModal()"
ng-show=
"!!disableInvites"
>
<i
class=
"fa fa-plus"
></i>
Add
</button>
<ul
class=
"gf-tabs"
>
<li
class=
"gf-tabs-item"
>
...
...
@@ -17,7 +21,7 @@
Users ({{ctrl.users.length}})
</a>
</li>
<li
class=
"gf-tabs-item"
>
<li
class=
"gf-tabs-item"
ng-show=
"!disableInvites"
>
<a
class=
"gf-tabs-link"
ng-click=
"ctrl.editor.index = 1"
ng-class=
"{active: ctrl.editor.index === 1}"
>
Pending Invitations ({{ctrl.pendingInvites.length}})
</a>
...
...
@@ -52,7 +56,7 @@
</table>
</div>
<div
ng-if=
"ctrl.editor.index === 1
"
>
<div
ng-if=
"ctrl.editor.index === 1
&& !disableInvites"
>
<table
class=
"filter-table form-inline"
>
<thead>
<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