Index: openacs-4/packages/notifications/notifications.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/notifications.info,v diff -u -r1.61.2.8 -r1.61.2.9 --- openacs-4/packages/notifications/notifications.info 13 Jul 2023 13:12:32 -0000 1.61.2.8 +++ openacs-4/packages/notifications/notifications.info 28 Aug 2024 06:34:03 -0000 1.61.2.9 @@ -19,7 +19,7 @@ - + Index: openacs-4/packages/notifications/tcl/notifications-security-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notifications-security-procs.tcl,v diff -u -r1.9.2.2 -r1.9.2.3 --- openacs-4/packages/notifications/tcl/notifications-security-procs.tcl 12 Jul 2022 11:30:59 -0000 1.9.2.2 +++ openacs-4/packages/notifications/tcl/notifications-security-procs.tcl 28 Aug 2024 06:34:03 -0000 1.9.2.3 @@ -25,6 +25,7 @@ @param user_id @param delivery_method_id + @return boolean value } { return [expr {[acs_user::get_user_info -user_id $user_id -element member_state] eq "approved"}] } @@ -37,8 +38,7 @@ @param user_id @param object_id - - @see permission::permission_p + @return boolean value } { return [permission::permission_p -party_id $user_id -object_id $object_id -privilege "read"] } @@ -47,12 +47,14 @@ {-user_id ""} {-object_id:required} } { - Require the ability to notify on an object. + Require the ability to notify on an object. The function + raised potentially a script_abort exception, when the user is + not logged in. + @param user_id @param object_id - - @see permission::require_permission + @return boolean value expressing if we can notify the user } { # require user to be logged in auth::require_login @@ -67,8 +69,7 @@ @param user_id @param request_id - - @see permission::permission_p + @return boolean value } { # owner of notification or side-wide admin set allowed 0 @@ -91,10 +92,13 @@ {-user_id ""} {-request_id:required} } { - Require the ability to admin a request. + Require the ability to admin a request. The function + raised potentially a script_abort exception, when the user is + not logged in. @param user_id @param request_id + @return boolean value expressing if the user can issued an admin request @see permission::require_permission } { Index: openacs-4/packages/notifications/tcl/test/notifications-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/test/notifications-test-procs.tcl,v diff -u -r1.1.2.17 -r1.1.2.18 --- openacs-4/packages/notifications/tcl/test/notifications-test-procs.tcl 27 Aug 2024 18:08:50 -0000 1.1.2.17 +++ openacs-4/packages/notifications/tcl/test/notifications-test-procs.tcl 28 Aug 2024 06:34:04 -0000 1.1.2.18 @@ -144,7 +144,7 @@ aa_equals "No intervals have been assigned to the new type" \ 0 [llength [notification::get_intervals -type_id $type_id]] - aa_log "Deleleting notification type '$short_name'" + aa_log "Deleting notification type '$short_name'" notification::type::delete -short_name $short_name aa_false "Notification type is no more" \ @@ -596,13 +596,14 @@ -cats {api smoke} \ -procs { acs_sc::impl::new_from_spec - notification::type::new + ad_unless_script_abort notification::request::new notification::security::can_admin_request_p notification::security::can_notify_object_p notification::security::can_notify_user notification::security::require_admin_request notification::security::require_notify_object + notification::type::new } \ notification_permission_tests { Tests permission API @@ -717,14 +718,12 @@ aa_section "Requiring admin permission for request '$request_id'" ns_register_proc GET __notification_security_require_admin_request [subst -nocommands { - ad_try -auto_abort=false { - notification::security::require_admin_request \ - -user_id $user_id \ - -request_id $request_id - } trap {AD EXCEPTION ad_script_abort} {r} { ns_log notice SCRIPT ABORT - } on ok r { - ns_log notice OK - ns_return 200 text/plain [set r] + ad_unless_script_abort { + set ok [notification::security::require_admin_request \ + -user_id $user_id \ + -request_id $request_id] + } { + ns_return 200 text/plain [set ok] } }] set d [acs::test::http __notification_security_require_admin_request] @@ -737,14 +736,12 @@ aa_section "Requiring notification permissions for object '$object_id'" ns_register_proc GET __notification_security_require_notify_object [subst -nocommands { - ad_try -auto_abort=false { - notification::security::require_notify_object \ - -user_id $user_id \ - -object_id $object_id - } trap {AD EXCEPTION ad_script_abort} {r} { ns_log notice SCRIPT ABORT - } on ok r { - ns_log notice OK - ns_return 200 text/plain [set r] + ad_unless_script_abort { + set ok [notification::security::require_notify_object \ + -user_id $user_id \ + -object_id $object_id] + } { + ns_return 200 text/plain [set ok] } }] set d [acs::test::http __notification_security_require_notify_object]