mirror of
https://github.com/bringout/oca-server-auth.git
synced 2026-04-21 10:12:03 +02:00
Initial commit: OCA Server Auth packages (29 packages)
This commit is contained in:
commit
3ed80311c4
1325 changed files with 127292 additions and 0 deletions
|
|
@ -0,0 +1,45 @@
|
|||
/** @odoo-module **/
|
||||
// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
import {_t} from "@web/core/l10n/translation";
|
||||
import {registry} from "@web/core/registry";
|
||||
import {session} from "@web/session";
|
||||
|
||||
export function impersonateLoginItem(env) {
|
||||
return {
|
||||
type: "item",
|
||||
id: "impersonate_login",
|
||||
description: _t("Switch Login"),
|
||||
hide: session.impersonate_from_uid || !session.is_impersonate_user,
|
||||
callback: async function () {
|
||||
const actionImpersonateLogin = await env.services.orm.call(
|
||||
"res.users",
|
||||
"action_impersonate_login"
|
||||
);
|
||||
env.services.action.doAction(actionImpersonateLogin);
|
||||
},
|
||||
sequence: 55,
|
||||
};
|
||||
}
|
||||
|
||||
export function impersonateBackLoginItem(env) {
|
||||
return {
|
||||
type: "item",
|
||||
id: "impersonate_back",
|
||||
description: _t("Back to Original User"),
|
||||
hide: !session.impersonate_from_uid,
|
||||
callback: async function () {
|
||||
const actionBackToOriginLogin = await env.services.orm.call(
|
||||
"res.users",
|
||||
"back_to_origin_login"
|
||||
);
|
||||
env.services.action.doAction(actionBackToOriginLogin);
|
||||
},
|
||||
sequence: 55,
|
||||
};
|
||||
}
|
||||
|
||||
registry
|
||||
.category("user_menuitems")
|
||||
.add("impersonate_login", impersonateLoginItem, {force: true})
|
||||
.add("impersonate_back", impersonateBackLoginItem, {force: true});
|
||||
Loading…
Add table
Add a link
Reference in a new issue