@@ -56,9 +56,10 @@ func (a *keystoneAuther) login(query *LoginUserQuery) error {
56
56
}
57
57
58
58
func (a * keystoneAuther ) authenticate (username , password string ) error {
59
+ user , _ := keystone .UserDomain (username )
59
60
auth := keystone.Auth_data {
60
61
Server : a .server ,
61
- Username : username ,
62
+ Username : user ,
62
63
Password : password ,
63
64
Domain : a .domainname ,
64
65
}
@@ -109,10 +110,14 @@ func (a *keystoneAuther) updateGrafanaUserPermissions(userid int64, isAdmin bool
109
110
}
110
111
111
112
func (a * keystoneAuther ) getGrafanaOrgFor (orgname string ) (* m.Org , error ) {
113
+
114
+ log .Debug ("getGrafanaOrgFor( %v )" , orgname )
115
+
112
116
// get org from grafana db
113
117
orgQuery := m.GetOrgByNameQuery {Name : orgname }
114
118
if err := bus .Dispatch (& orgQuery ); err != nil {
115
119
if err == m .ErrOrgNotFound {
120
+ log .Debug ("orgname %s not found - create it" , orgname )
116
121
return a .createGrafanaOrg (orgname )
117
122
} else {
118
123
return nil , err
@@ -209,6 +214,7 @@ func (a *keystoneAuther) syncOrgRoles(username, password string, user *m.User) e
209
214
// add missing org roles
210
215
for project , _ := range a .project_list {
211
216
if grafanaOrg , err := a .getGrafanaOrgFor (project ); err != nil {
217
+ log .Error (3 , "Couldn't find Grafana org %s" , project )
212
218
return err
213
219
} else {
214
220
if _ , exists := handledOrgIds [grafanaOrg .Id ]; exists {
@@ -284,6 +290,7 @@ func (a *keystoneAuther) syncOrgRoles(username, password string, user *m.User) e
284
290
}
285
291
286
292
func (a * keystoneAuther ) getProjectList (username , password string ) error {
293
+ log .Trace ("getProjectList() with username %s" , username )
287
294
projects_data := keystone.Projects_data {
288
295
Token : a .token ,
289
296
Server : a .server ,
@@ -306,12 +313,13 @@ func (a *keystoneAuther) getProjectList(username, password string) error {
306
313
for _ , role := range auth .Roles {
307
314
roles = append (roles , role .Name )
308
315
}
309
- a .project_list [project ] = roles
316
+ a .project_list [project + "@" + a . domainname ] = roles
310
317
}
311
318
return nil
312
319
}
313
320
314
321
func (a * keystoneAuther ) getRole (user_roles []string ) m.RoleType {
322
+ log .Trace ("getRole(%v)" , user_roles )
315
323
role_map := make (map [string ]bool )
316
324
for _ , role := range user_roles {
317
325
role_map [role ] = true
0 commit comments