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
23f163e8
Unverified
Commit
23f163e8
authored
Mar 19, 2018
by
Dan Cech
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes
parent
d2eab2ff
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
10 deletions
+20
-10
pkg/login/ext_user.go
+11
-9
pkg/models/user_auth.go
+5
-0
pkg/services/sqlstore/migrations/user_auth_mig.go
+1
-1
pkg/services/sqlstore/user_auth.go
+3
-0
No files found.
pkg/login/ext_user.go
View file @
23f163e8
...
...
@@ -53,6 +53,17 @@ func UpsertUser(ctx *m.ReqContext, cmd *m.UpsertUserCommand) error {
}
}
if
userQuery
.
UserAuth
==
nil
&&
extUser
.
AuthModule
!=
""
&&
extUser
.
AuthId
!=
""
{
cmd2
:=
m
.
SetAuthInfoCommand
{
UserId
:
cmd
.
User
.
Id
,
AuthModule
:
extUser
.
AuthModule
,
AuthId
:
extUser
.
AuthId
,
}
if
err
:=
bus
.
Dispatch
(
&
cmd2
);
err
!=
nil
{
return
err
}
}
err
=
syncOrgRoles
(
cmd
.
User
,
extUser
)
if
err
!=
nil
{
return
err
...
...
@@ -71,15 +82,6 @@ func createUser(extUser *m.ExternalUserInfo) (*m.User, error) {
return
nil
,
err
}
cmd2
:=
m
.
SetAuthInfoCommand
{
UserId
:
cmd
.
Result
.
Id
,
AuthModule
:
extUser
.
AuthModule
,
AuthId
:
extUser
.
AuthId
,
}
if
err
:=
bus
.
Dispatch
(
&
cmd2
);
err
!=
nil
{
return
nil
,
err
}
return
&
cmd
.
Result
,
nil
}
...
...
pkg/models/user_auth.go
View file @
23f163e8
package
models
import
(
"time"
)
type
UserAuth
struct
{
Id
int64
UserId
int64
AuthModule
string
AuthId
string
Created
time
.
Time
}
type
ExternalUserInfo
struct
{
...
...
pkg/services/sqlstore/migrations/user_auth_mig.go
View file @
23f163e8
...
...
@@ -8,7 +8,7 @@ func addUserAuthMigrations(mg *Migrator) {
Columns
:
[]
*
Column
{
{
Name
:
"id"
,
Type
:
DB_BigInt
,
IsPrimaryKey
:
true
,
IsAutoIncrement
:
true
},
{
Name
:
"user_id"
,
Type
:
DB_BigInt
,
Nullable
:
false
},
{
Name
:
"auth_module"
,
Type
:
DB_NVarchar
,
Length
:
3
0
,
Nullable
:
false
},
{
Name
:
"auth_module"
,
Type
:
DB_NVarchar
,
Length
:
19
0
,
Nullable
:
false
},
{
Name
:
"auth_id"
,
Type
:
DB_NVarchar
,
Length
:
100
,
Nullable
:
false
},
{
Name
:
"created"
,
Type
:
DB_DateTime
,
Nullable
:
false
},
},
...
...
pkg/services/sqlstore/user_auth.go
View file @
23f163e8
package
sqlstore
import
(
"time"
"github.com/grafana/grafana/pkg/bus"
m
"github.com/grafana/grafana/pkg/models"
)
...
...
@@ -107,6 +109,7 @@ func SetAuthInfo(cmd *m.SetAuthInfoCommand) error {
UserId
:
cmd
.
UserId
,
AuthModule
:
cmd
.
AuthModule
,
AuthId
:
cmd
.
AuthId
,
Created
:
time
.
Now
(),
}
_
,
err
:=
sess
.
Insert
(
&
authUser
)
...
...
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