Index: openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl,v diff -u -N -r1.85.2.4 -r1.85.2.5 --- openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl 13 Sep 2022 17:22:04 -0000 1.85.2.4 +++ openacs-4/packages/dotlrn-calendar/tcl/dotlrn-calendar-procs.tcl 4 Oct 2022 15:35:57 -0000 1.85.2.5 @@ -82,18 +82,29 @@ {-community_id:required} {-package_id:required} } { - A helper proc to create a calendar for a comm, returns the new calendar_id + A helper proc to create a new public calendar for a community. + + @return the new calendar_id } { - # create the community's calendar, the "f" is for a public calendar set community_name [dotlrn_community::get_community_name $community_id] - # return [calendar_create [ad_conn "user_id"] "f" $community_name] - # New calendar proc - return [calendar::new \ - -owner_id [ad_conn user_id] \ - -private_p "f" \ - -calendar_name $community_name \ - -package_id $package_id] + set owner_id [ad_conn user_id] + + set calendar_id [calendar::new \ + -owner_id $owner_id \ + -private_p "f" \ + -calendar_name $community_name \ + -package_id $package_id] + + # + # The calendar.new stored procedure will assign "calendar_admin" + # permission to the creation user. We remove it, as the creation + # user already has either already admin privileges or in the case + # of automatic creation, the creation user (-20) does not need it + # + permission::revoke -party_id $owner_id -object_id $calendar_id -privilege "calendar_admin" + + return $calendar_id } ad_proc -public dotlrn_calendar::add_applet_to_community {