Fill session context
This commit is contained in:
1 parent
0b770bb338
commit
dd0721f673
2 files changed
+14
-2
No files matched your search
+3
-1
@@ -8,12 +8,14 @@
|
||||
if (!session) {
|
||||
session = new Sao.Session();
|
||||
}
|
||||
var params = jQuery.extend([], args.params);
|
||||
params.push(jQuery.extend({}, session.context, params.pop()));
|
||||
|
||||
var ajax_prm = jQuery.ajax({
|
||||
'contentType': 'application/json',
|
||||
'data': JSON.stringify(Sao.rpc.prepareObject({
|
||||
'method': args.method,
|
||||
'params': [session.user_id, session.session].concat(args.params)
|
||||
'params': [session.user_id, session.session].concat(params)
|
||||
})),
|
||||
'dataType': 'json',
|
||||
'url': '/' + (session.database || ''),
|
||||
|
||||
+11
-1
@@ -9,7 +9,7 @@
|
||||
this.login = login;
|
||||
this.user_id = null;
|
||||
this.session = null;
|
||||
this.context = {}; // TODO fill
|
||||
this.context = {};
|
||||
if (!Sao.Session.current_session) {
|
||||
Sao.Session.current_session = this;
|
||||
}
|
||||
@@ -65,6 +65,16 @@
|
||||
this.user_id = null;
|
||||
this.session = null;
|
||||
return prm;
|
||||
},
|
||||
reload_context: function() {
|
||||
var args = {
|
||||
'method': 'model.res.user.get_preferences',
|
||||
'params': [true, {}]
|
||||
};
|
||||
var prm = Sao.rpc(args, this);
|
||||
return prm.then(function(context) {
|
||||
this.context = context;
|
||||
}.bind(this));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user