Index: openacs-4/contrib/packages/simulation/tcl/sim-case-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/sim-case-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/contrib/packages/simulation/tcl/sim-case-procs.tcl	6 Jan 2004 13:11:54 -0000	1.4
+++ openacs-4/contrib/packages/simulation/tcl/sim-case-procs.tcl	16 Jan 2004 10:20:39 -0000	1.5
@@ -109,3 +109,45 @@
         order by scrom.order_n
     }]
 }
+
+ad_proc -public simulation::case::assert_user_may_play_role {
+    {-case_id:required}
+    {-role_id:required}
+} {
+    Check that the currently logged in user is authorized to play a certain role
+    in a simulation case. Display a permission denied page if the user is not authorized.
+
+    @author Peter Marklund
+} {
+    # If the user is an admin player he may play the role
+    set package_id [ad_conn package_id]
+    set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer]    
+    if { $adminplayer_p } {
+        return 1
+    }
+
+    # The user is not an admin player, he needs to play the role
+    set user_id [ad_conn user_id]
+    set user_plays_role_p 0
+    foreach assignee_list [workflow::case::role::get_assignees -case_id $case_id -role_id $role_id] {
+        array set assignee $assignee_list
+        if { [string equal $assignee(party_id) $user_id] } {
+            set user_plays_role_p 1
+            break
+        }
+    }
+
+    if { !$user_plays_role_p } {
+        simulation::role::get -role_id $role_id -array role
+        simulation::case::get -case_id $case_id -array case_array
+        ad_return_forbidden \
+                "Permission Denied" \
+                "<blockquote>
+  You don't have permission to play role $role(pretty_name) in case $case_array(label).
+</blockquote>"
+
+        ad_script_abort
+    }
+
+    return 1
+}
Index: openacs-4/contrib/packages/simulation/test/demo-data-setup.test
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/test/Attic/demo-data-setup.test,v
diff -u -r1.18 -r1.19
--- openacs-4/contrib/packages/simulation/test/demo-data-setup.test	8 Jan 2004 15:54:01 -0000	1.18
+++ openacs-4/contrib/packages/simulation/test/demo-data-setup.test	16 Jan 2004 10:20:39 -0000	1.19
@@ -12,7 +12,7 @@
 
     ::twt::simulation::setup::all_templates   
 
-    ::twt::simulation::play::tilburg_template_user_1
+    ::twt::simulation::play::tilburg_template
 
     ::twt::simulation::test::permissions_all
 
Index: openacs-4/contrib/packages/simulation/test/simulation-test-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/test/Attic/simulation-test-procs.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/contrib/packages/simulation/test/simulation-test-procs.tcl	14 Jan 2004 15:12:40 -0000	1.10
+++ openacs-4/contrib/packages/simulation/test/simulation-test-procs.tcl	16 Jan 2004 10:20:39 -0000	1.11
@@ -389,39 +389,53 @@
 #
 ##############################
 
-ad_proc ::twt::simulation::play::tilburg_template_user_1 {} {
-    set user_name "Demo User 1"
+ad_proc ::twt::simulation::play::tilburg_template {} {
+    # First find the user with the assigned action
+
+    ::twt::log_section "Play Tilburg template"
+
+    # Find the user with the assigned task
+    set group_name "Case Authors"
+    ::twt::log_section "Logging in case author to find the user with assigned action"
+    ::twt::user::login [::twt::simulation::permission_user_email $group_name]
+    do_request /simulation/simplay
+    # Follow first case admin link
+    link follow ~u case-admin
+    # Show the assigned task
+    link follow ~u {case-admin.*assigned%5fonly%5fp=1}
+    # Regexp out the user name
+    regexp {Demo User [0-9]+} [response body] user_name
+
     ::twt::log_section "Login with $user_name and play tilburg simulation"
 
     ::twt::user::login [::twt::simulation::email_from_user_name $user_name]
 
     do_request /simulation/simplay
-    link follow ~u "case.+case"
 
-    # Execute the ask client task
+    ::twt::log "Execute the ask client task"
     link follow ~u task-detail
     form find ~n action
     field fill "ask client subject" ~n subject
     field fill "ask client body" ~n body
     form submit
 
-    # Execute the finalizing task
+    ::twt::log " Execute the finalizing task"
     link follow ~c "Write legal advice"
     form find ~n action
     field fill "legal advice subject" ~n subject
     field fill "legal advice body" ~n body
     form submit
 
-    # Legal advice was the last task so there shouldn't be any left
+    ::twt::log "Legal advice was the last task so there shouldn't be any left"
     if { [regexp {task-detail\?} [response body]] } {
         error "Completed last task ask legal advice but there are still tasks remaining"
     }
 
-    # Visit case index page again
+    ::twt::log "Visit case index page again"
     do_request /simulation/simplay
     link follow ~u "case.+case"    
 
-    # Send a message
+    ::twt::log "Send a message"
     link follow ~u "message\\?"
     form find ~n message
     field find ~n recipient_role_id ~t checkbox
@@ -430,7 +444,7 @@
     field fill "message body" ~n body
     form submit
 
-    # Upload a document
+    ::twt::log "Upload a document"
     link follow ~u document-upload
     form find ~n document
     field find ~n document_file
Index: openacs-4/contrib/packages/simulation/www/simplay/case-admin-user-move.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/case-admin-user-move.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/simulation/www/simplay/case-admin-user-move.tcl	15 Jan 2004 13:19:18 -0000	1.1
+++ openacs-4/contrib/packages/simulation/www/simplay/case-admin-user-move.tcl	16 Jan 2004 10:20:39 -0000	1.2
@@ -50,28 +50,6 @@
                     -role_id $role_id \
                     -party_ids [list $user_id]
             }
-
-            # TODO: this should removed because we don't want to put the admin user
-            # in when the admin is trying to swap two users
-            # Assign the admin to any unassigned roles after the move
-#             set unassigned_roles [db_list unassigned_roles {
-#                 select wr.role_id
-#                 from workflow_roles wr,
-#                      workflow_cases wc
-#                 where wc.case_id = :case_id
-#                   and wc.workflow_id = wr.workflow_id
-#                   and not exists (select 1
-#                                   from workflow_case_role_party_map wcrpm
-#                                   where wcrpm.case_id = :case_id
-#                                     and wcrpm.role_id = wr.role_id
-#                                   )
-#             }]
-#             foreach role_id $unassigned_roles {
-#                 workflow::case::role::assignee_insert \
-#                     -case_id $case_id \
-#                     -role_id $role_id \
-#                     -party_ids [list [ad_conn user_id]]
-#             }            
         }
         
         ad_returnredirect [export_vars -base case-admin { case_id }]
Index: openacs-4/contrib/packages/simulation/www/simplay/case-admin-user-remove.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/case-admin-user-remove.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/simulation/www/simplay/case-admin-user-remove.tcl	15 Jan 2004 13:19:18 -0000	1.1
+++ openacs-4/contrib/packages/simulation/www/simplay/case-admin-user-remove.tcl	16 Jan 2004 10:20:39 -0000	1.2
@@ -15,17 +15,4 @@
     -role_id $role_id \
     -party_id $user_id
 
-# TODO: this should removed because we don't want to put the admin user
-# in when the admin is trying to swap two users
-# # Assign the admin if the role is now unmapped
-# set remaining_assignees [workflow::case::role:get_assignees \
-#                              -case_id $case_id \
-#                              -role_id $role_id]
-# if { [llength $remaining_assignees] == 0 } {
-#     workflow::case::role::assignee_insert \
-#         -case_id $case_id \
-#         -role_id $role_id \
-#         -party_ids [list [ad_conn user_id]]
-# }
-
 ad_returnredirect [export_vars -base case-admin { case_id }]
Index: openacs-4/contrib/packages/simulation/www/simplay/case.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/case.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/contrib/packages/simulation/www/simplay/case.tcl	12 Jan 2004 13:43:14 -0000	1.5
+++ openacs-4/contrib/packages/simulation/www/simplay/case.tcl	16 Jan 2004 10:20:39 -0000	1.6
@@ -5,6 +5,8 @@
     role_id:integer,notnull
 }
 
+simulation::case::assert_user_may_play_role -case_id $case_id -role_id $role_id
+
 set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id]
 set simulation_name [simulation::template::get_element -workflow_id $workflow_id -element pretty_name]
 
@@ -14,6 +16,4 @@
 set package_id [ad_conn package_id]
 set section_uri [apm_package_url_from_id $package_id]simplay/
 
-set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer]
-
 set messages_url [export_vars -base messages { case_id role_id }]
Index: openacs-4/contrib/packages/simulation/www/simplay/control-bar.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/control-bar.tcl,v
diff -u -r1.11 -r1.12
--- openacs-4/contrib/packages/simulation/www/simplay/control-bar.tcl	12 Jan 2004 13:43:14 -0000	1.11
+++ openacs-4/contrib/packages/simulation/www/simplay/control-bar.tcl	16 Jan 2004 10:20:39 -0000	1.12
@@ -12,7 +12,6 @@
 set package_id [ad_conn package_id]
 set user_id [ad_conn user_id]
 set section_uri [apm_package_url_from_id $package_id]simplay/
-set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer]
 
 set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id]    
 
@@ -93,4 +92,3 @@
 " {
     set character_url [simulation::object::url -name $character_name]
 }
-
Index: openacs-4/contrib/packages/simulation/www/simplay/document-upload.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/document-upload.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/contrib/packages/simulation/www/simplay/document-upload.tcl	12 Jan 2004 15:37:28 -0000	1.5
+++ openacs-4/contrib/packages/simulation/www/simplay/document-upload.tcl	16 Jan 2004 10:20:39 -0000	1.6
@@ -8,6 +8,8 @@
     item_id:optional
 }
 
+simulation::case::assert_user_may_play_role -case_id $case_id -role_id $role_id
+
 set page_title "Upload new document to portfolio"
 set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "Case"] $page_title]
 
Index: openacs-4/contrib/packages/simulation/www/simplay/message.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/message.tcl,v
diff -u -r1.19 -r1.20
--- openacs-4/contrib/packages/simulation/www/simplay/message.tcl	12 Jan 2004 15:37:28 -0000	1.19
+++ openacs-4/contrib/packages/simulation/www/simplay/message.tcl	16 Jan 2004 10:20:39 -0000	1.20
@@ -10,6 +10,8 @@
     body_mime_type:optional
 }
 
+simulation::case::assert_user_may_play_role -case_id $case_id -role_id $role_id
+
 # TODO (1h): Message should have parent_id be the object of the case, just like the workflow-case-log comments do
 
 set page_title "Message"
Index: openacs-4/contrib/packages/simulation/www/simplay/portfolio.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/portfolio.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/contrib/packages/simulation/www/simplay/portfolio.tcl	12 Jan 2004 13:43:14 -0000	1.5
+++ openacs-4/contrib/packages/simulation/www/simplay/portfolio.tcl	16 Jan 2004 10:20:39 -0000	1.6
@@ -14,5 +14,3 @@
 set user_id [ad_conn user_id]
 set package_id [ad_conn package_id]
 set section_uri [apm_package_url_from_id $package_id]simplay/
-
-set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer]
Index: openacs-4/contrib/packages/simulation/www/simplay/task-detail.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/task-detail.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/contrib/packages/simulation/www/simplay/task-detail.tcl	12 Jan 2004 13:43:14 -0000	1.10
+++ openacs-4/contrib/packages/simulation/www/simplay/task-detail.tcl	16 Jan 2004 10:20:39 -0000	1.11
@@ -6,6 +6,8 @@
     enabled_action_id:integer
 }
 
+simulation::case::assert_user_may_play_role -case_id $case_id -role_id $role_id
+
 workflow::case::enabled_action_get -enabled_action_id $enabled_action_id -array enabled_action
 
 set action_id $enabled_action(action_id)
Index: openacs-4/contrib/packages/simulation/www/simplay/tasks.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/simplay/Attic/tasks.adp,v
diff -u -r1.8 -r1.9
--- openacs-4/contrib/packages/simulation/www/simplay/tasks.adp	12 Jan 2004 15:37:28 -0000	1.8
+++ openacs-4/contrib/packages/simulation/www/simplay/tasks.adp	16 Jan 2004 10:20:39 -0000	1.9
@@ -2,8 +2,7 @@
   <property name="title">@title;noquote@</property>
   <property name="context">@context;noquote@</property>
 
-<include src="/packages/simulation/lib/tasks" user_id="@user_id@" case_id="@case_id@">
+<include src="/packages/simulation/lib/tasks" user_id="@user_id@" case_id="@case_id@" role_id="@role_id@">
 
 TODO (1h): make sure to show all completed tasks (one reason is that this
 is the only way to see documents that are part of tasks)
-
Index: openacs-4/packages/simulation/tcl/sim-case-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/sim-case-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/simulation/tcl/sim-case-procs.tcl	6 Jan 2004 13:11:54 -0000	1.4
+++ openacs-4/packages/simulation/tcl/sim-case-procs.tcl	16 Jan 2004 10:20:39 -0000	1.5
@@ -109,3 +109,45 @@
         order by scrom.order_n
     }]
 }
+
+ad_proc -public simulation::case::assert_user_may_play_role {
+    {-case_id:required}
+    {-role_id:required}
+} {
+    Check that the currently logged in user is authorized to play a certain role
+    in a simulation case. Display a permission denied page if the user is not authorized.
+
+    @author Peter Marklund
+} {
+    # If the user is an admin player he may play the role
+    set package_id [ad_conn package_id]
+    set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer]    
+    if { $adminplayer_p } {
+        return 1
+    }
+
+    # The user is not an admin player, he needs to play the role
+    set user_id [ad_conn user_id]
+    set user_plays_role_p 0
+    foreach assignee_list [workflow::case::role::get_assignees -case_id $case_id -role_id $role_id] {
+        array set assignee $assignee_list
+        if { [string equal $assignee(party_id) $user_id] } {
+            set user_plays_role_p 1
+            break
+        }
+    }
+
+    if { !$user_plays_role_p } {
+        simulation::role::get -role_id $role_id -array role
+        simulation::case::get -case_id $case_id -array case_array
+        ad_return_forbidden \
+                "Permission Denied" \
+                "<blockquote>
+  You don't have permission to play role $role(pretty_name) in case $case_array(label).
+</blockquote>"
+
+        ad_script_abort
+    }
+
+    return 1
+}
Index: openacs-4/packages/simulation/test/demo-data-setup.test
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/test/demo-data-setup.test,v
diff -u -r1.18 -r1.19
--- openacs-4/packages/simulation/test/demo-data-setup.test	8 Jan 2004 15:54:01 -0000	1.18
+++ openacs-4/packages/simulation/test/demo-data-setup.test	16 Jan 2004 10:20:39 -0000	1.19
@@ -12,7 +12,7 @@
 
     ::twt::simulation::setup::all_templates   
 
-    ::twt::simulation::play::tilburg_template_user_1
+    ::twt::simulation::play::tilburg_template
 
     ::twt::simulation::test::permissions_all
 
Index: openacs-4/packages/simulation/test/simulation-test-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/test/simulation-test-procs.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/simulation/test/simulation-test-procs.tcl	14 Jan 2004 15:12:40 -0000	1.10
+++ openacs-4/packages/simulation/test/simulation-test-procs.tcl	16 Jan 2004 10:20:39 -0000	1.11
@@ -389,39 +389,53 @@
 #
 ##############################
 
-ad_proc ::twt::simulation::play::tilburg_template_user_1 {} {
-    set user_name "Demo User 1"
+ad_proc ::twt::simulation::play::tilburg_template {} {
+    # First find the user with the assigned action
+
+    ::twt::log_section "Play Tilburg template"
+
+    # Find the user with the assigned task
+    set group_name "Case Authors"
+    ::twt::log_section "Logging in case author to find the user with assigned action"
+    ::twt::user::login [::twt::simulation::permission_user_email $group_name]
+    do_request /simulation/simplay
+    # Follow first case admin link
+    link follow ~u case-admin
+    # Show the assigned task
+    link follow ~u {case-admin.*assigned%5fonly%5fp=1}
+    # Regexp out the user name
+    regexp {Demo User [0-9]+} [response body] user_name
+
     ::twt::log_section "Login with $user_name and play tilburg simulation"
 
     ::twt::user::login [::twt::simulation::email_from_user_name $user_name]
 
     do_request /simulation/simplay
-    link follow ~u "case.+case"
 
-    # Execute the ask client task
+    ::twt::log "Execute the ask client task"
     link follow ~u task-detail
     form find ~n action
     field fill "ask client subject" ~n subject
     field fill "ask client body" ~n body
     form submit
 
-    # Execute the finalizing task
+    ::twt::log " Execute the finalizing task"
     link follow ~c "Write legal advice"
     form find ~n action
     field fill "legal advice subject" ~n subject
     field fill "legal advice body" ~n body
     form submit
 
-    # Legal advice was the last task so there shouldn't be any left
+    ::twt::log "Legal advice was the last task so there shouldn't be any left"
     if { [regexp {task-detail\?} [response body]] } {
         error "Completed last task ask legal advice but there are still tasks remaining"
     }
 
-    # Visit case index page again
+    ::twt::log "Visit case index page again"
     do_request /simulation/simplay
     link follow ~u "case.+case"    
 
-    # Send a message
+    ::twt::log "Send a message"
     link follow ~u "message\\?"
     form find ~n message
     field find ~n recipient_role_id ~t checkbox
@@ -430,7 +444,7 @@
     field fill "message body" ~n body
     form submit
 
-    # Upload a document
+    ::twt::log "Upload a document"
     link follow ~u document-upload
     form find ~n document
     field find ~n document_file
Index: openacs-4/packages/simulation/www/simplay/case-admin-user-move.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case-admin-user-move.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/simulation/www/simplay/case-admin-user-move.tcl	15 Jan 2004 13:19:18 -0000	1.1
+++ openacs-4/packages/simulation/www/simplay/case-admin-user-move.tcl	16 Jan 2004 10:20:39 -0000	1.2
@@ -50,28 +50,6 @@
                     -role_id $role_id \
                     -party_ids [list $user_id]
             }
-
-            # TODO: this should removed because we don't want to put the admin user
-            # in when the admin is trying to swap two users
-            # Assign the admin to any unassigned roles after the move
-#             set unassigned_roles [db_list unassigned_roles {
-#                 select wr.role_id
-#                 from workflow_roles wr,
-#                      workflow_cases wc
-#                 where wc.case_id = :case_id
-#                   and wc.workflow_id = wr.workflow_id
-#                   and not exists (select 1
-#                                   from workflow_case_role_party_map wcrpm
-#                                   where wcrpm.case_id = :case_id
-#                                     and wcrpm.role_id = wr.role_id
-#                                   )
-#             }]
-#             foreach role_id $unassigned_roles {
-#                 workflow::case::role::assignee_insert \
-#                     -case_id $case_id \
-#                     -role_id $role_id \
-#                     -party_ids [list [ad_conn user_id]]
-#             }            
         }
         
         ad_returnredirect [export_vars -base case-admin { case_id }]
Index: openacs-4/packages/simulation/www/simplay/case-admin-user-remove.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case-admin-user-remove.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/simulation/www/simplay/case-admin-user-remove.tcl	15 Jan 2004 13:19:18 -0000	1.1
+++ openacs-4/packages/simulation/www/simplay/case-admin-user-remove.tcl	16 Jan 2004 10:20:39 -0000	1.2
@@ -15,17 +15,4 @@
     -role_id $role_id \
     -party_id $user_id
 
-# TODO: this should removed because we don't want to put the admin user
-# in when the admin is trying to swap two users
-# # Assign the admin if the role is now unmapped
-# set remaining_assignees [workflow::case::role:get_assignees \
-#                              -case_id $case_id \
-#                              -role_id $role_id]
-# if { [llength $remaining_assignees] == 0 } {
-#     workflow::case::role::assignee_insert \
-#         -case_id $case_id \
-#         -role_id $role_id \
-#         -party_ids [list [ad_conn user_id]]
-# }
-
 ad_returnredirect [export_vars -base case-admin { case_id }]
Index: openacs-4/packages/simulation/www/simplay/case.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/simulation/www/simplay/case.tcl	12 Jan 2004 13:43:14 -0000	1.5
+++ openacs-4/packages/simulation/www/simplay/case.tcl	16 Jan 2004 10:20:39 -0000	1.6
@@ -5,6 +5,8 @@
     role_id:integer,notnull
 }
 
+simulation::case::assert_user_may_play_role -case_id $case_id -role_id $role_id
+
 set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id]
 set simulation_name [simulation::template::get_element -workflow_id $workflow_id -element pretty_name]
 
@@ -14,6 +16,4 @@
 set package_id [ad_conn package_id]
 set section_uri [apm_package_url_from_id $package_id]simplay/
 
-set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer]
-
 set messages_url [export_vars -base messages { case_id role_id }]
Index: openacs-4/packages/simulation/www/simplay/control-bar.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/control-bar.tcl,v
diff -u -r1.11 -r1.12
--- openacs-4/packages/simulation/www/simplay/control-bar.tcl	12 Jan 2004 13:43:14 -0000	1.11
+++ openacs-4/packages/simulation/www/simplay/control-bar.tcl	16 Jan 2004 10:20:39 -0000	1.12
@@ -12,7 +12,6 @@
 set package_id [ad_conn package_id]
 set user_id [ad_conn user_id]
 set section_uri [apm_package_url_from_id $package_id]simplay/
-set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer]
 
 set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id]    
 
@@ -93,4 +92,3 @@
 " {
     set character_url [simulation::object::url -name $character_name]
 }
-
Index: openacs-4/packages/simulation/www/simplay/document-upload.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/document-upload.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/simulation/www/simplay/document-upload.tcl	12 Jan 2004 15:37:28 -0000	1.5
+++ openacs-4/packages/simulation/www/simplay/document-upload.tcl	16 Jan 2004 10:20:39 -0000	1.6
@@ -8,6 +8,8 @@
     item_id:optional
 }
 
+simulation::case::assert_user_may_play_role -case_id $case_id -role_id $role_id
+
 set page_title "Upload new document to portfolio"
 set context [list [list . "SimPlay"] [list [export_vars -base case { case_id role_id }] "Case"] $page_title]
 
Index: openacs-4/packages/simulation/www/simplay/message.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/message.tcl,v
diff -u -r1.19 -r1.20
--- openacs-4/packages/simulation/www/simplay/message.tcl	12 Jan 2004 15:37:28 -0000	1.19
+++ openacs-4/packages/simulation/www/simplay/message.tcl	16 Jan 2004 10:20:39 -0000	1.20
@@ -10,6 +10,8 @@
     body_mime_type:optional
 }
 
+simulation::case::assert_user_may_play_role -case_id $case_id -role_id $role_id
+
 # TODO (1h): Message should have parent_id be the object of the case, just like the workflow-case-log comments do
 
 set page_title "Message"
Index: openacs-4/packages/simulation/www/simplay/portfolio.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/portfolio.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/simulation/www/simplay/portfolio.tcl	12 Jan 2004 13:43:14 -0000	1.5
+++ openacs-4/packages/simulation/www/simplay/portfolio.tcl	16 Jan 2004 10:20:39 -0000	1.6
@@ -14,5 +14,3 @@
 set user_id [ad_conn user_id]
 set package_id [ad_conn package_id]
 set section_uri [apm_package_url_from_id $package_id]simplay/
-
-set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer]
Index: openacs-4/packages/simulation/www/simplay/task-detail.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/task-detail.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/simulation/www/simplay/task-detail.tcl	12 Jan 2004 13:43:14 -0000	1.10
+++ openacs-4/packages/simulation/www/simplay/task-detail.tcl	16 Jan 2004 10:20:39 -0000	1.11
@@ -6,6 +6,8 @@
     enabled_action_id:integer
 }
 
+simulation::case::assert_user_may_play_role -case_id $case_id -role_id $role_id
+
 workflow::case::enabled_action_get -enabled_action_id $enabled_action_id -array enabled_action
 
 set action_id $enabled_action(action_id)
Index: openacs-4/packages/simulation/www/simplay/tasks.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/tasks.adp,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/simulation/www/simplay/tasks.adp	12 Jan 2004 15:37:28 -0000	1.8
+++ openacs-4/packages/simulation/www/simplay/tasks.adp	16 Jan 2004 10:20:39 -0000	1.9
@@ -2,8 +2,7 @@
   <property name="title">@title;noquote@</property>
   <property name="context">@context;noquote@</property>
 
-<include src="/packages/simulation/lib/tasks" user_id="@user_id@" case_id="@case_id@">
+<include src="/packages/simulation/lib/tasks" user_id="@user_id@" case_id="@case_id@" role_id="@role_id@">
 
 TODO (1h): make sure to show all completed tasks (one reason is that this
 is the only way to see documents that are part of tasks)
-