From 107b589a11dfa6a81d97d081d8b2bcb60f05b4e9 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 17 Apr 2015 17:08:17 +0200 Subject: [FIX] *: correct previous forward port Due to files renaming, some patched should be applied manually to the correct files. Forgot to `git add` these files when committing the forward port... --- addons/web/static/src/js/framework/session.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'addons/web/static/src/js/framework/session.js') diff --git a/addons/web/static/src/js/framework/session.js b/addons/web/static/src/js/framework/session.js index 8b084f640fd..38fa3465808 100644 --- a/addons/web/static/src/js/framework/session.js +++ b/addons/web/static/src/js/framework/session.js @@ -4,6 +4,7 @@ odoo.define('web.Session', function (require) { var ajax = require('web.ajax'); var core = require('web.core'); var utils = require('web.utils'); +var Model = require('web.Model'); var _t = core._t; var qweb = core.qweb; @@ -41,6 +42,7 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { // TODO: session store in cookie should be optional this.qweb_mutex = new utils.Mutex(); this.currencies = {}; + this._groups_def = {}; }, setup: function(origin, options) { // must be able to customize server @@ -129,6 +131,17 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { $.bbq.removeState(); return this.rpc("/web/session/destroy", {}); }, + user_has_group: function(group) { + if (!this.uid) { + return $.when().resolve(false); + } + var def = this._groups_def[group]; + if (!def) { + var Users = new Model('res.users'); + def = this._groups_def[group] = Users.call('has_group', [group]); + } + return def; + }, get_cookie: function (name) { if (!this.name) { return null; } var nameEQ = this.name + '|' + name + '='; -- cgit v1.2.3