new permission manager

This commit is contained in:
Rushabh Mehta 2013-01-01 19:51:35 +05:30
parent 5f183982cd
commit 78a0c20305
7 changed files with 46 additions and 84 deletions

View File

@ -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
}
]

View File

View File

@ -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")

View File

@ -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',
},
]

View File

@ -23,9 +23,13 @@
<span class="help">Add/remove users, set roles, passwords etc</span>
</p>
<p>
<b><a href="#Permission Engine">Permission Manager</a></b><br>
<b><a href="#user-properties">Permission Manager</a></b><br>
<span class="help">Set permissions on transactions / masters</span>
</p>
<p>
<b><a href="#permission-manager">User Properties</a></b><br>
<span class="help">Set default values for users (also used for permissions).</span>
</p>
<p>
<b><a href="#List/Workflow">Workflow Manager</a></b><br>
<span class="help">Set workflow rules.</span>
@ -118,12 +122,6 @@
<b><a href="#List/Print Heading">Print Headings</a></b><br>
<span class="help">Add headers for standard print formats</span>
</p>
<!--
<p>
<b><a href="#Form/Personalize/Personalize">Home Banner</a></b><br>
<span class="help">Add a home page banner</span>
</p>
-->
<p>
<b><a href="#Form/Style Settings/Style Settings">Style Settings</a></b><br>
<span class="help">Change background fonts etc</span>

View File

@ -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"
}
]

View File

@ -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: