Index: openacs-4/packages/calendar/tcl/cal-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs.tcl,v diff -u -r1.35.2.7 -r1.35.2.8 --- openacs-4/packages/calendar/tcl/cal-item-procs.tcl 25 Jan 2022 14:00:42 -0000 1.35.2.7 +++ openacs-4/packages/calendar/tcl/cal-item-procs.tcl 15 Feb 2023 14:52:49 -0000 1.35.2.8 @@ -99,10 +99,10 @@ permission::set_not_inherit -object_id $cal_item_id } - assign_permission $cal_item_id $creation_user read - assign_permission $cal_item_id $creation_user write - assign_permission $cal_item_id $creation_user delete - assign_permission $cal_item_id $creation_user admin + ::permission::grant \ + -object_id $cal_item_id \ + -party_id $creation_user \ + -privilege admin calendar::do_notifications -mode New -cal_item_id $cal_item_id return $cal_item_id @@ -331,13 +331,18 @@ db_exec_plsql delete_cal_item {} } -ad_proc calendar::item::assign_permission { cal_item_id +ad_proc -deprecated calendar::item::assign_permission { cal_item_id party_id permission {revoke ""} } { update the permission of the specific cal_item if revoke is set to revoke, then we revoke all permissions + + DEPRECATED: this api is in fact a trivial wrapper for the permission api. + + @see permission::grant + @see permission::revoke } { if { $revoke ne "revoke" } { if { $permission ne "cal_item_read" } { Index: openacs-4/packages/calendar/tcl/test/cal-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/test/cal-item-procs.tcl,v diff -u -r1.8.2.10 -r1.8.2.11 --- openacs-4/packages/calendar/tcl/test/cal-item-procs.tcl 15 Feb 2023 14:09:22 -0000 1.8.2.10 +++ openacs-4/packages/calendar/tcl/test/cal-item-procs.tcl 15 Feb 2023 14:52:49 -0000 1.8.2.11 @@ -8,6 +8,7 @@ -procs { calendar::create calendar::item::add_recurrence + calendar::item::edit_recurrence calendar::item::delete_recurrence calendar::item::edit calendar::item::get @@ -226,6 +227,32 @@ aa_log "Create a private test calendar belonging to the other user" set calendar_id_2 [calendar::create $another_user t] + aa_log "Create a calendar item belonging to the other user" + set ci_start_date [clock format [clock seconds] -format "%Y-%m-%d"] + set ci_end_date [clock format [clock scan "tomorrow" -base [clock seconds]] -format "%Y-%m-%d"] + # + # Note: the creation_user can only be specified by altering + # the connection information. This is not great. + # + set old_user [ad_conn user_id] + ad_conn -set user_id $another_user + set another_cal_item_id \ + [calendar::item::new \ + -start_date $ci_start_date \ + -end_date $ci_end_date \ + -name Test \ + -description {Test Desc} \ + -calendar_id $calendar_id_2] + ad_conn -set user_id $old_user + foreach priv {cal_item_read read write delete admin} { + aa_true "Other user has privilege '$priv' on the cal item '$another_cal_item_id'" \ + [permission::permission_p \ + -party_id $another_user \ + -object_id $another_cal_item_id \ + -privilege $priv] + } + + aa_true "User '$another_user' has now a private calendar" \ [calendar::have_private_p -party_id $another_user] @@ -425,7 +452,10 @@ # Finally, clean up the calendar # calendar::delete -calendar_id $calendar_id - acs_user::delete -user_id $another_user -permanent + calendar::delete -calendar_id $calendar_id_2 + calendar::delete -calendar_id $calendar_id_3 + acs::test::user::delete -user_id $another_user \ + -delete_created_acs_objects } #