when user roles are updated, the relevant session roles are updated as well

Этот коммит содержится в:
JoramWilander
2015-08-17 09:28:20 -04:00
родитель e5a3817488
Коммит b068cc1058
4 изменённых файлов: 57 добавлений и 5 удалений

Просмотреть файл

@@ -175,3 +175,22 @@ func (me SqlSessionStore) UpdateLastActivityAt(sessionId string, time int64) Sto
return storeChannel
}
func (me SqlSessionStore) UpdateRoles(userId, roles string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
result := StoreResult{}
if _, err := me.GetMaster().Exec("UPDATE Sessions SET Roles = :Roles WHERE UserId = :UserId", map[string]interface{}{"Roles": roles, "UserId": userId}); err != nil {
result.Err = model.NewAppError("SqlSessionStore.UpdateRoles", "We couldn't update the roles", "userId="+userId)
} else {
result.Data = userId
}
storeChannel <- result
close(storeChannel)
}()
return storeChannel
}