Index: openacs-4/packages/rules/www/add-action.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/add-action.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/rules/www/add-action.adp 9 Dec 2004 20:11:25 -0000 1.4 +++ openacs-4/packages/rules/www/add-action.adp 10 Dec 2004 17:34:27 -0000 1.5 @@ -1,12 +1,21 @@ -Registration Rules - -@context@ - \ No newline at end of file + + + Permission Denied +
+
You don't have permission to admin Rule.
+
+
+ +Registration Rules + + +
Index: openacs-4/packages/rules/www/add-action.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/add-action.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/rules/www/add-action.tcl 7 Dec 2004 19:57:46 -0000 1.2 +++ openacs-4/packages/rules/www/add-action.tcl 10 Dec 2004 17:34:27 -0000 1.3 @@ -13,10 +13,20 @@ # Just while I get the assessment package ready set context [list [list "one-rule?rule_id=$rule_id" "Rule Properties"] "Add Action"] +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set context [list "Add rule"] +set rule_admin "" +set admin [permission::permission_p -object_id $package_id -party_id $user_id -privilege "admin"] +if { [exists_and_not_null rule_id] } { +set rule_admin [permission::permission_p -object_id $rule_id -party_id $user_id -privilege "admin"] +} + if { [exists_and_not_null selected_a]} { set default_action $selected_a } + set actions { {"add user to" 1} {"add to list of" 2} {"add user to the system" 3}} set results [list] if { $default_action != 3 } { Index: openacs-4/packages/rules/www/add-rule.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/add-rule.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/rules/www/add-rule.adp 3 Dec 2004 17:55:36 -0000 1.1 +++ openacs-4/packages/rules/www/add-rule.adp 10 Dec 2004 17:34:27 -0000 1.2 @@ -1,3 +1,15 @@ @context@ - \ No newline at end of file + + + Permission Denied +
+
You don't have permission to admin Rule.
+
+
+ + + Edit Rule + + +
\ No newline at end of file Index: openacs-4/packages/rules/www/add-rule.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/add-rule.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/rules/www/add-rule.tcl 9 Dec 2004 20:11:25 -0000 1.4 +++ openacs-4/packages/rules/www/add-rule.tcl 10 Dec 2004 17:34:27 -0000 1.5 @@ -13,8 +13,16 @@ # Just while I get the assessment package ready +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] set context [list "Add rule"] +set rule_admin "" +set admin [permission::permission_p -object_id $package_id -party_id $user_id -privilege "admin"] +if { [exists_and_not_null rule_id] } { +set rule_admin [permission::permission_p -object_id $rule_id -party_id $user_id -privilege "admin"] +} + set assessments [rules::rule::get_assessments] ad_form -name add_rule -export { return_url } -form { rule_id:key @@ -30,12 +38,19 @@ {options {{Yes y} { No n}}} } } -new_data { - - rules::rule::new_rule -rule_id $rule_id -rule_name $rule_name -asm_id $asm_id -active_p $active_p + set user_id [ad_conn user_id] + set rule_id [rules::rule::new_rule -rule_id $rule_id -rule_name $rule_name -asm_id $asm_id -active_p $active_p] + permission::grant -object_id $rule_id -privilege "admin" -party_id $user_id } -edit_request { db_1row get_rule_properties {select * from rules where rule_id=:rule_id} } -edit_data { +if { $rule_admin == 0 && $admin == 0 } { + ad_script_abort + + +} + db_dml update_rule { update rules set rule_name=:rule_name, active_p=:active_p, asm_id=:asm_id where rule_id=:rule_id } } -after_submit { Index: openacs-4/packages/rules/www/add-trigger.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/add-trigger.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/rules/www/add-trigger.adp 8 Dec 2004 21:18:13 -0000 1.2 +++ openacs-4/packages/rules/www/add-trigger.adp 10 Dec 2004 17:34:27 -0000 1.3 @@ -1,6 +1,5 @@ @context@ -Registration Rules - - \ No newline at end of file + + + Permission Denied +
+
You don't have permission to admin Rule.
+
+
+ +Registration Rules + + +
Index: openacs-4/packages/rules/www/add-trigger.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/add-trigger.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/rules/www/add-trigger.tcl 8 Dec 2004 22:34:24 -0000 1.4 +++ openacs-4/packages/rules/www/add-trigger.tcl 10 Dec 2004 17:34:27 -0000 1.5 @@ -11,6 +11,16 @@ set qs_sel 0 set context [list [list "one-rule?rule_id=$rule_id" "Rule Properties"] "Add Trigger"] +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set context [list "Add rule"] +set rule_admin "" +set admin [permission::permission_p -object_id $package_id -party_id $user_id -privilege "admin"] +if { [exists_and_not_null rule_id] } { +set rule_admin [permission::permission_p -object_id $rule_id -party_id $user_id -privilege "admin"] +} + + # Just while get the assessment package ready set questions [list] @@ -42,6 +52,7 @@ } + form create add_trigger element create add_trigger rule_id\ Index: openacs-4/packages/rules/www/change-actions-result.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/change-actions-result.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/rules/www/change-actions-result.tcl 3 Dec 2004 17:56:11 -0000 1.1 +++ openacs-4/packages/rules/www/change-actions-result.tcl 10 Dec 2004 17:34:27 -0000 1.2 @@ -11,6 +11,23 @@ } +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set context [list "Add rule"] +set rule_admin "" +set admin [permission::permission_p -object_id $package_id -party_id $user_id -privilege "admin"] +if { [exists_and_not_null rule_id] } { +set rule_admin [permission::permission_p -object_id $rule_id -party_id $user_id -privilege "admin"] +} + +if { $rule_admin == 0 && $admin == 0 } { + doc_return 200 text/html "

Permission Denied

+ You don't have permission to admin Rule. " + ad_script_abort + + +} + db_transaction { db_dml update_action_result { update rules_actions set group_id=:res where rule_action_id=:action_id} Index: openacs-4/packages/rules/www/change-active.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/change-active.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/rules/www/change-active.tcl 3 Dec 2004 17:56:28 -0000 1.1 +++ openacs-4/packages/rules/www/change-active.tcl 10 Dec 2004 17:34:27 -0000 1.2 @@ -8,6 +8,23 @@ res:notnull rule_id:integer,notnull } +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set context [list "Add rule"] +set rule_admin "" +set admin [permission::permission_p -object_id $package_id -party_id $user_id -privilege "admin"] +if { [exists_and_not_null rule_id] } { +set rule_admin [permission::permission_p -object_id $rule_id -party_id $user_id -privilege "admin"] +} + +if { $rule_admin == 0 && $admin == 0 } { + doc_return 200 text/html "

Permission Denied

+ You don't have permission to admin Rule. " + ad_script_abort + + +} + set active_p "y" if { $res == "y"} { Index: openacs-4/packages/rules/www/delete-action.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/delete-action.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/rules/www/delete-action.tcl 3 Dec 2004 17:56:44 -0000 1.1 +++ openacs-4/packages/rules/www/delete-action.tcl 10 Dec 2004 17:34:27 -0000 1.2 @@ -8,6 +8,22 @@ rule_action_id:integer,notnull,multiple rule_id:integer,notnull } +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set context [list "Add rule"] +set rule_admin "" +set admin [permission::permission_p -object_id $package_id -party_id $user_id -privilege "admin"] +if { [exists_and_not_null rule_id] } { +set rule_admin [permission::permission_p -object_id $rule_id -party_id $user_id -privilege "admin"] +} + +if { $rule_admin == 0 && $admin == 0 } { + doc_return 200 text/html "

Permission Denied

+ You don't have permission to admin this Rule. " + ad_script_abort + + +} set rules_count [llength $rule_action_id] for { set i 0} { $i < $rules_count } { incr i } { Index: openacs-4/packages/rules/www/delete-rule.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/delete-rule.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/rules/www/delete-rule.tcl 3 Dec 2004 17:56:54 -0000 1.1 +++ openacs-4/packages/rules/www/delete-rule.tcl 10 Dec 2004 17:34:27 -0000 1.2 @@ -11,10 +11,26 @@ set rules $rule_id set rules_count [llength $rule_id] +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set rule_admin "" +set admin [permission::permission_p -object_id $package_id -party_id $user_id -privilege "admin"] + set rules_table "" for { set i 0} { $i < $rules_count } { incr i } { + +set rule_admin [permission::permission_p -object_id [lindex $rule_id $i] -party_id $user_id -privilege "admin"] + +if { $rule_admin == 0 && $admin == 0 } { + doc_return 200 text/html "

Permission Denied

+ You don't have permission to admin this Rule. " + ad_script_abort + + +} + set rule_name [rules::rule::get_rule_name -rule_id [lindex $rule_id $i]] set asm_name [rules::rule::get_asm_name -rule_id [lindex $rule_id $i]] append rules_table "" Index: openacs-4/packages/rules/www/delete-trigger.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/delete-trigger.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/rules/www/delete-trigger.tcl 3 Dec 2004 17:56:54 -0000 1.1 +++ openacs-4/packages/rules/www/delete-trigger.tcl 10 Dec 2004 17:34:27 -0000 1.2 @@ -4,6 +4,22 @@ rule_def_id:integer,notnull,multiple rule_id:integer,notnull } +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set context [list "Add rule"] +set rule_admin "" +set admin [permission::permission_p -object_id $package_id -party_id $user_id -privilege "admin"] +if { [exists_and_not_null rule_id] } { +set rule_admin [permission::permission_p -object_id $rule_id -party_id $user_id -privilege "admin"] +} + +if { $rule_admin == 0 && $admin == 0 } { + doc_return 200 text/html "

Permission Denied

+ You don't have permission to admin this Rule. " + ad_script_abort + + +} set rules_count [llength $rule_def_id] for { set i 0} { $i < $rules_count } { incr i } { Index: openacs-4/packages/rules/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/index.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/rules/www/index.adp 9 Dec 2004 20:11:25 -0000 1.5 +++ openacs-4/packages/rules/www/index.adp 10 Dec 2004 17:34:27 -0000 1.6 @@ -3,7 +3,7 @@
Rule NameAssessment Related
$rule_name$asm_name
Index: openacs-4/packages/rules/www/one-rule.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/one-rule.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/rules/www/one-rule.tcl 9 Dec 2004 20:11:25 -0000 1.6 +++ openacs-4/packages/rules/www/one-rule.tcl 10 Dec 2004 17:34:27 -0000 1.7 @@ -10,7 +10,23 @@ qs:optional trigger:optional } +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set context [list "Add rule"] +set rule_admin "" +set admin [permission::permission_p -object_id $package_id -party_id $user_id -privilege "admin"] +if { [exists_and_not_null rule_id] } { +set rule_admin [permission::permission_p -object_id $rule_id -party_id $user_id -privilege "admin"] +} +if { $rule_admin == 0 && $admin == 0 } { + doc_return 200 text/html "

Permission Denied

+ You don't have permission to admin this Rule. " + ad_script_abort + + +} + set context [list "Rule Properties"] set qs_id_2 0 if { ![exists_and_not_null qs]} { Index: openacs-4/packages/rules/www/process-response-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/process-response-oracle.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/rules/www/process-response-oracle.xql 9 Dec 2004 21:26:50 -0000 1.3 +++ openacs-4/packages/rules/www/process-response-oracle.xql 10 Dec 2004 17:34:27 -0000 1.4 @@ -7,32 +7,4 @@ from survey_sections ss where ss.survey_id=:survey_id) - - - select * from survey_responses where survey_id=:survey_id - - - - - select * from survey_questions_responses where response_id=:response_id - and question_id=:question_id - - - - - select * from rules where asm_id=:survey_id - - - - - select * from rules_triggers where rule_id=:rule_id - - - - - select choice_id from survey_questions_responses where - question_id=:qs_id and response_id= (select response_id from survey_responses where survey_id=:survey_id) - - - \ No newline at end of file Index: openacs-4/packages/rules/www/process-response.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/process-response.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/rules/www/process-response.tcl 9 Dec 2004 21:55:25 -0000 1.6 +++ openacs-4/packages/rules/www/process-response.tcl 10 Dec 2004 17:34:27 -0000 1.7 @@ -34,8 +34,10 @@ set username [db_string name {select p.first_names || ' ' || p.last_name as name from persons p where p.person_id = :user_id}] if { $action_type == 1} { append message "
  • You have joined the $community_name community." - append notif_text "The user $user_name has joined the $community_name community." + append notif_text "The user user has joined the $community_name community." + if {![dotlrn::user_is_community_member_p -user_id $user_id -community_id $group_id]} { dotlrn_community::add_user $group_id $user_id + } db_transaction { db_dml add_history { insert into rule_history_actions (rha_id,group_id,user_id,rule_action_id,request_date,processing_date,approved_p) values (:rha_id,:group_id,:user_id,:rule_action_id,to_date(:today,'YYYY-MM-DD'),to_date(:today,'YYYY-MM-DD'),'y')} } @@ -64,7 +66,12 @@ Password: $user_info" append notif_text "A user has joined to the system User Name: $user_info@viaro.net" + if { ![exists_and_not_null user_new_info(user_id)]} { + ad_return_complaint 1 "The user $user_info@viaro.net alredy exists in the system" + ad_script_abort + } set user_id $user_new_info(user_id) + dotlrn_privacy::set_user_guest_p -user_id $user_id -value "t" dotlrn::user_add -can_browse -user_id $user_id db_transaction { db_dml add_history { insert into rule_history_actions (rha_id,group_id,user_id,rule_action_id,request_date,processing_date,approved_p) values (:rha_id,-1,:user_id,:rule_action_id,to_date(:today,'YYYY-MM-DD'),to_date(:today,'YYYY-MM-DD'),'y')} Index: openacs-4/packages/rules/www/request-notification.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/request-notification.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/rules/www/request-notification.tcl 3 Dec 2004 17:57:45 -0000 1.1 +++ openacs-4/packages/rules/www/request-notification.tcl 10 Dec 2004 17:34:27 -0000 1.2 @@ -15,6 +15,23 @@ } +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set context [list "Add rule"] +set rule_admin "" +set admin [permission::permission_p -object_id $package_id -party_id $user_id -privilege "admin"] +if { [exists_and_not_null object_id] } { +set rule_admin [permission::permission_p -object_id $object_id -party_id $user_id -privilege "admin"] +} + +if { $rule_admin == 0 && $admin == 0 } { + doc_return 200 text/html "

    Permission Denied

    + You don't have permission to admin Rule. " + ad_script_abort + + +} + # Check that the object can be subcribed to notification::security::require_notify_object -object_id $object_id Index: openacs-4/packages/rules/www/admin/admin-request.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/admin/Attic/admin-request.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/rules/www/admin/admin-request.adp 9 Dec 2004 21:26:51 -0000 1.5 +++ openacs-4/packages/rules/www/admin/admin-request.adp 10 Dec 2004 17:34:28 -0000 1.6 @@ -1,5 +1,5 @@ -Registration Rules Administration +General Registration Rules Administration
  • - Add New Rule Add New Rule Waiting Lists Add new Questionnaire Index: openacs-4/packages/rules/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/index.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/rules/www/index.tcl 9 Dec 2004 20:11:25 -0000 1.4 +++ openacs-4/packages/rules/www/index.tcl 10 Dec 2004 17:34:27 -0000 1.5 @@ -8,6 +8,12 @@ } +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set context [list "Add rule"] +set rule_admin "" +set admin [permission::permission_p -object_id $package_id -party_id $user_id -privilege "admin"] + template::list::create -name rules\ -multirow all_rules\ -key rule_id\ @@ -37,6 +43,7 @@ label "Active" display_template { + Yes / No Index: openacs-4/packages/rules/www/one-rule.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rules/www/Attic/one-rule.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/rules/www/one-rule.adp 9 Dec 2004 20:11:25 -0000 1.4 +++ openacs-4/packages/rules/www/one-rule.adp 10 Dec 2004 17:34:27 -0000 1.5 @@ -51,6 +51,9 @@ Add Notification for this Rule + Waiting List +