Index: openacs-4/packages/xowiki/tcl/package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 17 Aug 2006 01:44:26 -0000 1.8 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 17 Aug 2006 11:21:20 -0000 1.9 @@ -140,6 +140,12 @@ } else { regexp {../([^/]+)$} $object _ object set standard_page "en:$object" + # maybe we are calling from a different language, but the + # standard page with en: was already instantiated + set page [my resolve_request -path $standard_page] + if {$page ne ""} { + return $page + } } my log "--W object='$object'" @@ -515,5 +521,37 @@ } } + Policy policy3 -contains { + # + # we require side wide admin rights for deletions + # we perform checking on item_ids for pages. + # + + Class Package -array set require_permission { + reindex {{id admin}} + rss none + delete swa + edit-new {{{has_class ::xowiki::Object} id admin} {id create}} + } + + Class Page -array set require_permission { + view {{item_id read}} + revisions {{item_id write}} + edit {{item_id write}} + make-live-revision {{item_id write}} + delete-revision swa + delete swa + save-tags login + popular-tags login + } + + Class Object -array set require_permission { + edit {{package_id admin}} + } + Class File -array set require_permission { + download {{package_id read}} + } + } + } Index: openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 17 Aug 2006 01:44:26 -0000 1.10 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 17 Aug 2006 11:21:20 -0000 1.11 @@ -95,7 +95,7 @@ set href [$package_id package_url]weblog?summary=1 foreach cat_id [category::get_mapped_categories $item_id] { foreach {category_id category_name tree_id tree_name} [category::get_data $cat_id] break - my log "--cat $cat_id $category_id $category_name $tree_id $tree_name" + #my log "--cat $cat_id $category_id $category_name $tree_id $tree_name" set entry "$category_name ($tree_name)" if {[info exists notification_image]} { set notification_text "Subscribe category $category_name in tree $tree_name" Index: openacs-4/packages/xowiki/www/admin/list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/list.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/xowiki/www/admin/list.tcl 17 Aug 2006 01:44:26 -0000 1.4 +++ openacs-4/packages/xowiki/www/admin/list.tcl 17 Aug 2006 11:21:20 -0000 1.5 @@ -47,10 +47,17 @@ }] } +set ::individual_permissions [expr {[$package_id set policy] eq "::xowiki::policy3"}] + TableWidget t1 -volatile \ -actions $actions \ -columns { - ImageField_EditIcon edit -label "" + ImageField_EditIcon edit -label "" -html {style "padding-right: 2px;"} + if {$::individual_permissions} { + ImageField permissions -src /resources/xowiki/permissions.png -width 16 \ + -height 16 -border 0 -title "Manage Individual Permssions for this Item" \ + -alt permsissions -label "" -html {style "padding: 2px;"} + } AnchorField name -label [_ xowiki.name] -orderby name Field object_type -label [_ xowiki.page_type] -orderby object_type Field size -label "Size" -orderby size -html {align right} @@ -65,6 +72,7 @@ set order_clause "order by ci.name" # -page_size 10 # -page_number 1 + db_foreach instance_select \ [$object_type instance_select_query \ -folder_id [::$package_id folder_id] \ @@ -84,6 +92,11 @@ -edit.href [export_vars -base $page_link {{m edit} return_url}] \ -mod_user [::xo::get_user_name $creation_user] \ -delete.href [export_vars -base [$package_id package_url] {{delete 1} item_id name return_url}] + if {$::individual_permissions} { + # TODO: this should get some architectural support + [lindex [t1 set __children] end] set permissions.href \ + [export_vars -base permissions {item_id return_url}] + } } set t1 [t1 asHTML] Index: openacs-4/packages/xowiki/www/admin/permissions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/permissions.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/xowiki/www/admin/permissions.adp 10 Aug 2006 08:32:06 -0000 1.1 +++ openacs-4/packages/xowiki/www/admin/permissions.adp 17 Aug 2006 11:21:20 -0000 1.2 @@ -2,4 +2,4 @@ @page_title@ @context@ - + Index: openacs-4/packages/xowiki/www/admin/permissions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/permissions.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/xowiki/www/admin/permissions.tcl 10 Aug 2006 08:32:06 -0000 1.1 +++ openacs-4/packages/xowiki/www/admin/permissions.tcl 17 Aug 2006 11:21:20 -0000 1.2 @@ -1,15 +1,26 @@ -ad_page_contract { - Permissions for the subsite itself. - - @author Gustaf Neumann - @creation-date 2006-08-10 - @cvs-id $Id$ -} { - package_id:integer +::xowiki::Package initialize -ad_doc { + Security management for xowiki pages + + @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at) + @creation-date Aug 16, 2006 + @cvs-id $Id$ + +} -parameter { + {-item_id:optional} } -set page_title "[apm_instance_name_from_id $package_id] Permissions" +if {[info exists item_id]} { + set page [::Generic::CrItem instantiate -item_id $item_id] + $page volatile + set object_id $item_id + set page_title "Manage Permissions for Page: [$page name]" + set return_url [$package_id query_parameter return_url [$package_id package_url]admin/list] +} else { + set object_id $package_id + set page_title "Manage Permissions for Package [apm_instance_name_from_id $package_id]" + set return_url [$package_id query_parameter return_url [$package_id package_url]admin] +} set context [list $page_title] -set return_url [apm_package_url_from_id $package_id]admin + Index: openacs-4/packages/xowiki/www/resources/permissions.png =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/permissions.png,v diff -u Binary files differ