From 8a436500f0423bcd0d84a35b2620fe9b75a55768 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 19 Dec 2013 19:11:30 +0530 Subject: [PATCH] [refactor] Client-side permission handling --- accounts/doctype/account/account.js | 2 +- .../p02_update_user_properties.py} | 0 .../p03_move_warehouse_user_to_restrictions.py} | 0 .../p04_new_permissions.py} | 0 patches/patch_list.py | 8 ++++---- setup/doctype/customer_group/customer_group.js | 2 +- setup/doctype/item_group/item_group.js | 2 +- setup/doctype/sales_person/sales_person.js | 2 +- setup/doctype/territory/territory.js | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) rename patches/{1311/p06_update_user_properties.py => 1312/p02_update_user_properties.py} (100%) rename patches/{1311/p07_move_warehouse_user_to_restrictions.py => 1312/p03_move_warehouse_user_to_restrictions.py} (100%) rename patches/{1311/p08_new_permissions.py => 1312/p04_new_permissions.py} (100%) diff --git a/accounts/doctype/account/account.js b/accounts/doctype/account/account.js index 8837586b06..407b2d452d 100644 --- a/accounts/doctype/account/account.js +++ b/accounts/doctype/account/account.js @@ -37,7 +37,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { // read-only for root accounts if(!doc.parent_account) { - cur_frm.perm = [[1,0,0], [1,0,0]]; + cur_frm.set_read_only(); cur_frm.set_intro(wn._("This is a root account and cannot be edited.")); } else { // credit days and type if customer or supplier diff --git a/patches/1311/p06_update_user_properties.py b/patches/1312/p02_update_user_properties.py similarity index 100% rename from patches/1311/p06_update_user_properties.py rename to patches/1312/p02_update_user_properties.py diff --git a/patches/1311/p07_move_warehouse_user_to_restrictions.py b/patches/1312/p03_move_warehouse_user_to_restrictions.py similarity index 100% rename from patches/1311/p07_move_warehouse_user_to_restrictions.py rename to patches/1312/p03_move_warehouse_user_to_restrictions.py diff --git a/patches/1311/p08_new_permissions.py b/patches/1312/p04_new_permissions.py similarity index 100% rename from patches/1311/p08_new_permissions.py rename to patches/1312/p04_new_permissions.py diff --git a/patches/patch_list.py b/patches/patch_list.py index 30a4fc92ac..d5d50b6ed0 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -254,15 +254,15 @@ patch_list = [ "patches.1311.p04_update_comments", "patches.1311.p05_website_brand_html", "patches.1311.p06_fix_report_columns", - "patches.1311.p06_update_user_properties", "execute:webnotes.delete_doc('DocType', 'Documentation Tool')", "execute:webnotes.delete_doc('Report', 'Stock Ledger') #2013-11-29", - "patches.1312.p01_delete_old_stock_reports", "execute:webnotes.delete_doc('Report', 'Payment Collection With Ageing')", "execute:webnotes.delete_doc('Report', 'Payment Made With Ageing')", "patches.1311.p07_scheduler_errors_digest", "patches.1311.p08_email_digest_recipients", "execute:webnotes.delete_doc('DocType', 'Warehouse Type')", - "patches.1311.p07_move_warehouse_user_to_restrictions", - "patches.1311.p08_new_permissions", + "patches.1312.p01_delete_old_stock_reports", + "patches.1312.p02_update_user_properties", + "patches.1312.p03_move_warehouse_user_to_restrictions", + "patches.1312.p04_new_permissions", ] \ No newline at end of file diff --git a/setup/doctype/customer_group/customer_group.js b/setup/doctype/customer_group/customer_group.js index 3e76986948..17a08c6d70 100644 --- a/setup/doctype/customer_group/customer_group.js +++ b/setup/doctype/customer_group/customer_group.js @@ -8,7 +8,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.set_root_readonly = function(doc) { // read-only for root customer group if(!doc.parent_customer_group) { - cur_frm.perm = [[1,0,0], [1,0,0]]; + cur_frm.set_read_only(); cur_frm.set_intro(wn._("This is a root customer group and cannot be edited.")); } else { cur_frm.set_intro(null); diff --git a/setup/doctype/item_group/item_group.js b/setup/doctype/item_group/item_group.js index 78df60925b..65e0588ebd 100644 --- a/setup/doctype/item_group/item_group.js +++ b/setup/doctype/item_group/item_group.js @@ -18,7 +18,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.set_root_readonly = function(doc) { // read-only for root item group if(!doc.parent_item_group) { - cur_frm.perm = [[1,0,0], [1,0,0]]; + cur_frm.set_read_only(); cur_frm.set_intro(wn._("This is a root item group and cannot be edited.")); } else { cur_frm.set_intro(null); diff --git a/setup/doctype/sales_person/sales_person.js b/setup/doctype/sales_person/sales_person.js index 55d8684653..a2db271574 100644 --- a/setup/doctype/sales_person/sales_person.js +++ b/setup/doctype/sales_person/sales_person.js @@ -8,7 +8,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.set_root_readonly = function(doc) { // read-only for root if(!doc.parent_sales_person) { - cur_frm.perm = [[1,0,0], [1,0,0]]; + cur_frm.set_read_only(); cur_frm.set_intro(wn._("This is a root sales person and cannot be edited.")); } else { cur_frm.set_intro(null); diff --git a/setup/doctype/territory/territory.js b/setup/doctype/territory/territory.js index 18dbbb3017..9cb1d7094b 100644 --- a/setup/doctype/territory/territory.js +++ b/setup/doctype/territory/territory.js @@ -8,7 +8,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.set_root_readonly = function(doc) { // read-only for root territory if(!doc.parent_territory) { - cur_frm.perm = [[1,0,0], [1,0,0]]; + cur_frm.set_read_only(); cur_frm.set_intro(wn._("This is a root territory and cannot be edited.")); } else { cur_frm.set_intro(null);