fix: mange specific roles without saving the user doc
This commit is contained in:
parent
7dcc670ca8
commit
42c104fa76
1 changed files with 20 additions and 12 deletions
|
|
@ -37,18 +37,6 @@ frappe.ui.form.on("User", {
|
|||
}
|
||||
},
|
||||
|
||||
role_profiles: function (frm) {
|
||||
if (frm.doc.role_profiles && frm.doc.role_profiles.length) {
|
||||
frm.roles_editor.disable = 1;
|
||||
frm.call("populate_role_profile_roles").then(() => {
|
||||
frm.roles_editor.show();
|
||||
});
|
||||
} else {
|
||||
frm.roles_editor.disable = 0;
|
||||
frm.roles_editor.show();
|
||||
}
|
||||
},
|
||||
|
||||
module_profile: function (frm) {
|
||||
if (frm.doc.module_profile) {
|
||||
frappe.call({
|
||||
|
|
@ -431,6 +419,26 @@ frappe.ui.form.on("User Email", {
|
|||
},
|
||||
});
|
||||
|
||||
frappe.ui.form.on("User Role Profile", {
|
||||
role_profiles_add: function (frm) {
|
||||
if (frm.doc.role_profiles.length > 0) {
|
||||
frm.roles_editor.disable = 1;
|
||||
frm.call("populate_role_profile_roles").then(() => {
|
||||
frm.roles_editor.show();
|
||||
});
|
||||
$(".deselect-all, .select-all").prop("disabled", true);
|
||||
}
|
||||
},
|
||||
role_profiles_remove: function (frm) {
|
||||
if (frm.doc.role_profiles.length == 0) {
|
||||
console.log(frm.doc.role_profiles.length == 0);
|
||||
frm.roles_editor.disable = 0;
|
||||
frm.roles_editor.show();
|
||||
$(".deselect-all, .select-all").prop("disabled", false);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
function has_access_to_edit_user() {
|
||||
return has_common(frappe.user_roles, get_roles_for_editing_user());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue