From 78a0c20305ac8e9e4c8266b7cd47187ece395142 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 1 Jan 2013 19:51:35 +0530 Subject: [PATCH] new permission manager --- .../leave_application/leave_application.txt | 47 ++++++--------- patches/january_2013/__init__.py | 0 .../january_2013/remove_bad_permissions.py | 7 +++ patches/patch_list.py | 4 ++ setup/page/setup/setup.html | 12 ++-- utilities/doctype/question/question.txt | 58 ++++--------------- website/utils.py | 2 +- 7 files changed, 46 insertions(+), 84 deletions(-) create mode 100644 patches/january_2013/__init__.py create mode 100644 patches/january_2013/remove_bad_permissions.py diff --git a/hr/doctype/leave_application/leave_application.txt b/hr/doctype/leave_application/leave_application.txt index edebe4bfd9..6af6529f8e 100644 --- a/hr/doctype/leave_application/leave_application.txt +++ b/hr/doctype/leave_application/leave_application.txt @@ -2,9 +2,9 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-12-10 10:25:20", + "creation": "2012-12-19 12:46:47", "modified_by": "Administrator", - "modified": "2012-12-18 11:06:54" + "modified": "2013-01-01 15:13:51" }, { "is_submittable": 1, @@ -28,6 +28,7 @@ "parent": "Leave Application", "read": 1, "doctype": "DocPerm", + "write": 1, "parenttype": "DocType", "parentfield": "permissions" }, @@ -49,6 +50,7 @@ "description": "Leave can be approved by users with Role, \"Leave Approver\"", "doctype": "DocField", "label": "Leave Approver", + "options": "link:Profile", "fieldname": "leave_approver", "fieldtype": "Select", "permlevel": 0 @@ -90,6 +92,7 @@ "permlevel": 0 }, { + "print_width": "50%", "doctype": "DocField", "width": "50%", "fieldname": "column_break1", @@ -115,29 +118,32 @@ "in_filter": 1 }, { + "read_only": 1, "search_index": 0, "doctype": "DocField", "label": "Employee Name", "fieldname": "employee_name", "fieldtype": "Data", - "permlevel": 1, + "permlevel": 0, "in_filter": 1 }, { + "read_only": 1, "no_copy": 1, "doctype": "DocField", "label": "Leave Balance Before Application", "fieldname": "leave_balance", "fieldtype": "Currency", - "permlevel": 1 + "permlevel": 0 }, { + "read_only": 1, "no_copy": 1, "doctype": "DocField", "label": "Total Leave Days", "fieldname": "total_leave_days", "fieldtype": "Currency", - "permlevel": 1 + "permlevel": 0 }, { "doctype": "DocField", @@ -157,6 +163,7 @@ "permlevel": 2 }, { + "read_only": 0, "search_index": 0, "doctype": "DocField", "label": "Fiscal Year", @@ -168,6 +175,7 @@ "in_filter": 1 }, { + "read_only": 0, "print_hide": 1, "doctype": "DocField", "label": "Letter Head", @@ -177,38 +185,27 @@ "permlevel": 2 }, { + "print_hide": 1, + "no_copy": 1, "doctype": "DocField", "label": "Amended From", + "options": "Sales Invoice", "fieldname": "amended_from", - "fieldtype": "Data", - "permlevel": 2 - }, - { - "doctype": "DocField", - "label": "Amendment Date", - "fieldname": "amendment_date", - "fieldtype": "Date", - "permlevel": 2 + "fieldtype": "Link", + "permlevel": 1 }, { "create": 1, "doctype": "DocPerm", - "write": 1, "role": "Employee", "permlevel": 0, "match": "employee" }, - { - "doctype": "DocPerm", - "role": "All", - "permlevel": 1 - }, { "amend": 1, "create": 1, "doctype": "DocPerm", "submit": 1, - "write": 1, "role": "HR User", "cancel": 1, "permlevel": 0 @@ -218,7 +215,6 @@ "create": 1, "doctype": "DocPerm", "submit": 1, - "write": 1, "role": "Leave Approver", "cancel": 1, "permlevel": 0, @@ -226,7 +222,6 @@ }, { "doctype": "DocPerm", - "write": 1, "role": "HR User", "permlevel": 2 }, @@ -235,14 +230,8 @@ "create": 0, "doctype": "DocPerm", "submit": 0, - "write": 1, "role": "Leave Approver", "cancel": 0, "permlevel": 2 - }, - { - "doctype": "DocPerm", - "role": "All", - "permlevel": 3 } ] \ No newline at end of file diff --git a/patches/january_2013/__init__.py b/patches/january_2013/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/patches/january_2013/remove_bad_permissions.py b/patches/january_2013/remove_bad_permissions.py new file mode 100644 index 0000000000..58d5de27d4 --- /dev/null +++ b/patches/january_2013/remove_bad_permissions.py @@ -0,0 +1,7 @@ +import webnotes + +def execute(): + webnotes.conn.sql("""update tabDocPerm set permlevel=0 where permlevel is null""") + webnotes.conn.sql("""update tabDocPerm set `create`=0, `submit`=0, `cancel`=0, + `amend`=0, `match`='' where permlevel>0""") + webnotes.delete_doc("Permission Control") \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index b1ebdef5ed..318ce25407 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -574,4 +574,8 @@ patch_list = [ 'patch_module': 'patches.december_2012', 'patch_file': 'update_print_width', }, + { + 'patch_module': 'patches.january_2013', + 'patch_file': 'remove_bad_permissions', + }, ] \ No newline at end of file diff --git a/setup/page/setup/setup.html b/setup/page/setup/setup.html index 1e7607f6c0..676dd179ee 100644 --- a/setup/page/setup/setup.html +++ b/setup/page/setup/setup.html @@ -23,9 +23,13 @@ Add/remove users, set roles, passwords etc

- Permission Manager
+ Permission Manager
Set permissions on transactions / masters

+

+ User Properties
+ Set default values for users (also used for permissions). +

Workflow Manager
Set workflow rules. @@ -118,12 +122,6 @@ Print Headings
Add headers for standard print formats

-

Style Settings
Change background fonts etc diff --git a/utilities/doctype/question/question.txt b/utilities/doctype/question/question.txt index b63df41106..ef9d7d3d1c 100644 --- a/utilities/doctype/question/question.txt +++ b/utilities/doctype/question/question.txt @@ -2,24 +2,18 @@ { "owner": "Administrator", "docstatus": 0, - "creation": "2012-03-27 14:36:01", + "creation": "2012-07-03 13:30:42", "modified_by": "Administrator", - "modified": "2012-03-27 14:36:01" + "modified": "2013-01-01 18:58:55" }, { - "section_style": "Simple", - "allow_attach": 0, - "module": "Utilities", - "allow_trash": 1, - "server_code_error": " ", - "in_create": 1, "read_only": 1, "autoname": "QUES.#######", + "in_create": 1, "name": "__common__", - "colour": "White:FFF", "doctype": "DocType", - "show_in_menu": 0, - "version": 7 + "module": "Utilities", + "allow_attach": 0 }, { "name": "__common__", @@ -32,10 +26,10 @@ { "parent": "Question", "read": 1, - "doctype": "DocPerm", "cancel": 1, "name": "__common__", "create": 1, + "doctype": "DocPerm", "write": 1, "parenttype": "DocType", "role": "All", @@ -46,9 +40,6 @@ "name": "Question", "doctype": "DocType" }, - { - "doctype": "DocPerm" - }, { "oldfieldtype": "Text", "doctype": "DocField", @@ -79,41 +70,11 @@ "fieldtype": "Data", "hidden": 1 }, - { - "search_index": 0, - "doctype": "DocField", - "label": "Tag 1", - "oldfieldname": "tag_1", - "fieldname": "tag_1", - "fieldtype": "Link", - "oldfieldtype": "Link", - "options": "Question Tag" - }, { "doctype": "DocField", + "label": "Users Voted", "fieldname": "_users_voted", - "fieldtype": "Text", - "label": "Users Voted" - }, - { - "search_index": 0, - "doctype": "DocField", - "label": "Tag 2", - "oldfieldname": "tag_2", - "fieldname": "tag_2", - "fieldtype": "Link", - "oldfieldtype": "Link", - "options": "Question Tag" - }, - { - "search_index": 0, - "doctype": "DocField", - "label": "Tag 3", - "oldfieldname": "tag_3", - "fieldname": "tag_3", - "fieldtype": "Link", - "oldfieldtype": "Link", - "options": "Question Tag" + "fieldtype": "Text" }, { "oldfieldtype": "Text", @@ -123,5 +84,8 @@ "fieldname": "file_list", "fieldtype": "Text", "hidden": 1 + }, + { + "doctype": "DocPerm" } ] \ No newline at end of file diff --git a/website/utils.py b/website/utils.py index b7fd88da35..96fbdc8dc9 100644 --- a/website/utils.py +++ b/website/utils.py @@ -145,7 +145,7 @@ def prepare_args(page_name): if page_name in get_template_pages(): args = webnotes._dict({ - 'template': 'pages/%s' % page_name, + 'template': 'pages/%s.html' % page_name, 'name': page_name, }) if page_name in page_settings_map: