Index: openacs-4/packages/acs-subsite/www/admin/relations/change-member-state.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/relations/change-member-state.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/acs-subsite/www/admin/relations/change-member-state.tcl 19 Jan 2018 14:09:48 -0000 1.5 +++ openacs-4/packages/acs-subsite/www/admin/relations/change-member-state.tcl 7 Jun 2018 17:46:16 -0000 1.6 @@ -14,14 +14,14 @@ {return_url:localurl ""} } -validate { permission_p -requires {rel_id:notnull} { - if { ![relation_permission_p -privilege admin $rel_id] } { - ad_complain "The relation either does not exist or you do not have permission to administer it" - } + if { ![permission::permission_p -object_id $rel_id -privilege "admin"] } { + ad_complain "The relation either does not exist or you do not have permission to administer it" + } } relation_in_scope_p -requires {rel_id:notnull permission_p} { - if { ![application_group::contains_relation_p -rel_id $rel_id]} { - ad_complain "The relation either does not exist or does not belong to this subsite." - } + if { ![application_group::contains_relation_p -rel_id $rel_id]} { + ad_complain "The relation either does not exist or does not belong to this subsite." + } } } Index: openacs-4/packages/acs-subsite/www/admin/relations/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/relations/one.tcl,v diff -u -N -r1.5 -r1.6 --- openacs-4/packages/acs-subsite/www/admin/relations/one.tcl 7 Aug 2017 23:47:58 -0000 1.5 +++ openacs-4/packages/acs-subsite/www/admin/relations/one.tcl 7 Jun 2018 17:46:16 -0000 1.6 @@ -26,14 +26,14 @@ possible_member_states:onelist } -validate { permission_p -requires {rel_id:notnull} { - if { ![relation_permission_p $rel_id] } { - ad_complain "The relation either does not exist or you do not have permission to view it" - } + if { ![permission::permission_p -object_id $rel_id -privilege "read"] } { + ad_complain "The relation either does not exist or you do not have permission to view it" + } } relation_in_scope_p -requires {rel_id:notnull permission_p} { - if { ![application_group::contains_relation_p -rel_id $rel_id]} { - ad_complain "The relation either does not exist or does not belong to this subsite." - } + if { ![application_group::contains_relation_p -rel_id $rel_id]} { + ad_complain "The relation either does not exist or does not belong to this subsite." + } } } @@ -45,7 +45,7 @@ set subsite_group_id [application_group::group_id_from_package_id] -if { ![db_0or1row select_rel_info {} -column_array rel] +if { ![db_0or1row select_rel_info {} -column_array rel] } { ad_return_error "Error" "Relation #rel_id does not exist" ad_script_abort @@ -62,10 +62,10 @@ set attr_list [attribute::array_for_type -start_with "relationship" attr_props enum_values $rel_type] attribute::multirow \ - -start_with relationship \ - -datasource_name attributes \ - -object_type $rel_type \ - $rel_id + -start_with relationship \ + -datasource_name attributes \ + -object_type $rel_type \ + $rel_id # Membership relations have a member_state. Composition relations don't. # This query will return null if the relation is not a membership relation. @@ -85,10 +85,10 @@ set object_two_write_p [permission::permission_p -object_id $rel(object_id_two) -privilege "write"] attribute::multirow \ - -start_with party \ - -datasource_name object_two_attributes \ - -object_type $rel(object_type_two) \ - $rel(object_id_two) + -start_with party \ + -datasource_name object_two_attributes \ + -object_type $rel(object_type_two) \ + $rel(object_id_two) } ad_return_template Index: openacs-4/packages/acs-subsite/www/admin/relations/remove-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/relations/remove-2.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/acs-subsite/www/admin/relations/remove-2.tcl 19 Jan 2018 14:09:48 -0000 1.6 +++ openacs-4/packages/acs-subsite/www/admin/relations/remove-2.tcl 7 Jun 2018 17:46:16 -0000 1.7 @@ -2,7 +2,7 @@ ad_page_contract { Removes relations - + @author Michael Bryzek (mbryzek@arsdigita.com) @creation-date 2000-12-16 @cvs-id $Id$ @@ -12,23 +12,23 @@ { return_url:localurl "" } } -validate { permission_p -requires {rel_id:notnull} { - if { ![relation_permission_p -privilege delete $rel_id] } { - ad_complain "The relation either does not exist or you do not have permission to remove it" - } + if { ![permission::permission_p -object_id $rel_id -privilege "delete"] } { + ad_complain "The relation either does not exist or you do not have permission to remove it" + } } } if {$operation eq "Yes, I really want to remove this relation"} { db_transaction { - relation_remove $rel_id + relation_remove $rel_id } on_error { - ad_return_error "Error creating the relation" "We got the following error while trying to remove the relation:
$errmsg
" - ad_script_abort + ad_return_error "Error creating the relation" "We got the following error while trying to remove the relation:
$errmsg
" + ad_script_abort } } else { if { $return_url eq "" } { - # redirect to the relation by default, if we haven't deleted it - set return_url [export_vars -base one rel_id] + # redirect to the relation by default, if we haven't deleted it + set return_url [export_vars -base one rel_id] } } Index: openacs-4/packages/acs-subsite/www/admin/relations/remove.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/relations/remove.tcl,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-subsite/www/admin/relations/remove.tcl 7 Aug 2017 23:47:58 -0000 1.4 +++ openacs-4/packages/acs-subsite/www/admin/relations/remove.tcl 7 Jun 2018 17:46:16 -0000 1.5 @@ -16,20 +16,20 @@ dependents:multirow } -validate { permission_p -requires {rel_id:notnull} { - if { ![relation_permission_p -privilege delete $rel_id] } { - ad_complain "The relation either does not exist or you do not have permission to remove it" - } + if { ![permission::permission_p -object_id $rel_id -privilege "delete"] } { + ad_complain "The relation either does not exist or you do not have permission to remove it" + } } relation_in_scope_p -requires {rel_id:notnull permission_p} { - if { ![application_group::contains_relation_p -rel_id $rel_id]} { - ad_complain "The relation either does not exist or does not belong to this subsite." - } + if { ![application_group::contains_relation_p -rel_id $rel_id]} { + ad_complain "The relation either does not exist or does not belong to this subsite." + } } } set context [list "Remove relation"] -if { ![db_0or1row select_rel_info {} -column_array rel] +if { ![db_0or1row select_rel_info {} -column_array rel] } { ad_return_error "Error" "Relation $rel_id does not exist" ad_script_abort @@ -44,7 +44,7 @@ template::multirow create dependents rel_id rel_type_pretty_name object_id_one_name object_id_two_name export_vars db_foreach select_dependents {} { - template::multirow append dependents $rel_id $rel_type_pretty_name $object_id_one_name $object_id_two_name [export_vars {rel_id return_url}] + template::multirow append dependents $rel_id $rel_type_pretty_name $object_id_one_name $object_id_two_name [export_vars {rel_id return_url}] } ad_return_template remove-dependents-exist return