From 9624ef2907b34464383f857b351144eb45afb346 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Wed, 27 Oct 2010 13:24:28 +0300 Subject: [PATCH] document: ACL setup, based on ir.rules bzr revid: p_christ@hol.gr-20101027102428-pyanpwxzhta3zqy3 --- addons/document/document_data.xml | 20 ++++++------- .../document/security/document_security.xml | 24 ++++++++++++++- addons/document/security/ir.model.access.csv | 1 + .../document_ftp/test/document_ftp_test5.yml | 30 +++++++++++++++++++ 4 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 addons/document_ftp/test/document_ftp_test5.yml diff --git a/addons/document/document_data.xml b/addons/document/document_data.xml index ef829b6e258..a4f546cbf83 100644 --- a/addons/document/document_data.xml +++ b/addons/document/document_data.xml @@ -16,13 +16,13 @@ Documents - + 0 - My Folder + Admin Folder 0 @@ -37,7 +37,7 @@ 0 - + @@ -46,7 +46,7 @@ [('category_id','in',[active_id])] - + 0 @@ -55,14 +55,14 @@ Personal Folders ressource + 0 - Products - + 0 @@ -70,7 +70,7 @@ Sales Order - + 0 @@ -78,7 +78,7 @@ All Sales Order - + 0 @@ -86,7 +86,7 @@ Quotations - + 0 @@ -94,7 +94,7 @@ Projects - + 0 diff --git a/addons/document/security/document_security.xml b/addons/document/security/document_security.xml index 2bf1a2adb57..e1a60165150 100644 --- a/addons/document/security/document_security.xml +++ b/addons/document/security/document_security.xml @@ -14,6 +14,28 @@ - + + + ['|',('user_id', '=', False), ('user_id', '=', user.id), '|', ('group_ids','=',False), ('group_ids','in',user.groups_id), '|', ('company_id','=',False), ('company_id','child_of',[user.company_id.id])] + Read public directories + + + + + + + + + + + [('user_id', '=', user.id), '|', ('group_ids','=',False), ('group_ids','in',user.groups_id), '|', ('company_id','=',False), ('company_id','child_of',[user.company_id.id]) ] + Document modify own directories + + + + + + + diff --git a/addons/document/security/ir.model.access.csv b/addons/document/security/ir.model.access.csv index 132daa1b7a6..d7aba7cbde7 100644 --- a/addons/document/security/ir.model.access.csv +++ b/addons/document/security/ir.model.access.csv @@ -1,6 +1,7 @@ "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" "access_document_directory_all","document.directory all","model_document_directory",,1,0,0,0 "access_document_directory_group_document_manager","document.directory document manager","model_document_directory","base.group_system",1,1,1,1 +"access_document_directory_group_knowledge","document.directory modify","model_document_directory","base.group_document_user",1,1,1,1 "access_document_directory_group_system","document.directory group system","model_document_directory","base.group_system",1,1,1,1 "access_document_directory_content_all","document.directory.content all","model_document_directory_content",,1,0,0,0 "access_document_directory_content_group_document_manager","document.directory.content document manager","model_document_directory_content","base.group_system",1,1,1,1 diff --git a/addons/document_ftp/test/document_ftp_test5.yml b/addons/document_ftp/test/document_ftp_test5.yml new file mode 100644 index 00000000000..a66f409905b --- /dev/null +++ b/addons/document_ftp/test/document_ftp_test5.yml @@ -0,0 +1,30 @@ +- + In order to check the permissions setup and functionality of the + document module: +- + I create a testing user for the documents +- + I assign some ... group to the testing user +- + I create a "group testing" user, which also belongs to the same ... group +- + I create a "blocked" user. +- + I create (as root) a testing folder in the document hierarchy, and + assign ownership to the testing user, groups to the ... group. +- + I create a "private" folder inside the testing folder. +- + I try to read the testing folder as the testing user +- + I try to read the folder as the group user, it should fail. +- + I try to read the folder as the blocked user. +- + I create a "group" folder, with the ... group. +- + I try to read the "group" folder as the testing user +- + I try to read the "group" folder as the group user +- + I try to read the "group" folder as the blocked user