mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
User / Account model split, User and account now seperate entities, collaborators are now AccountUsers
This commit is contained in:
@@ -14,18 +14,18 @@ type AuthOptions struct {
|
||||
ReqSignedIn bool
|
||||
}
|
||||
|
||||
func getRequestAccountId(c *Context) int64 {
|
||||
accountId := c.Session.Get("accountId")
|
||||
func getRequestUserId(c *Context) int64 {
|
||||
userId := c.Session.Get("userId")
|
||||
|
||||
if accountId != nil {
|
||||
return accountId.(int64)
|
||||
if userId != nil {
|
||||
return userId.(int64)
|
||||
}
|
||||
|
||||
// TODO: figure out a way to secure this
|
||||
if c.Query("render") == "1" {
|
||||
accountId := c.QueryInt64("accountId")
|
||||
c.Session.Set("accountId", accountId)
|
||||
return accountId
|
||||
userId := c.QueryInt64("userId")
|
||||
c.Session.Set("userId", userId)
|
||||
return userId
|
||||
}
|
||||
|
||||
return 0
|
||||
@@ -54,7 +54,7 @@ func RoleAuth(roles ...m.RoleType) macaron.Handler {
|
||||
return func(c *Context) {
|
||||
ok := false
|
||||
for _, role := range roles {
|
||||
if role == c.UserRole {
|
||||
if role == c.AccountRole {
|
||||
ok = true
|
||||
break
|
||||
}
|
||||
|
Reference in New Issue
Block a user