@@ -105,7 +105,7 @@ function file_row($app, $variant, $dir, $f) {
105105}
106106
107107function variant_view ($ user ) {
108- global $ buda_root, $ manage_access ;
108+ global $ buda_root ;
109109 $ app = get_str ('app ' );
110110 if (!is_valid_filename ($ app )) die ('bad arg ' );
111111 $ app_desc = get_buda_app_desc ($ app );
@@ -134,7 +134,7 @@ function variant_view($user) {
134134 end_table ();
135135 echo '<hr> ' ;
136136
137- if ($ manage_access && user_can_manage ($ user , $ app_desc )) {
137+ if (user_can_manage ($ user , $ app_desc )) {
138138 echo '<p> ' ;
139139 show_button_small (
140140 "buda.php?action=variant_form&app= $ app&variant= $ variant " ,
@@ -266,7 +266,7 @@ function create_templates($app, $desc, $dir) {
266266 $ x = "<output_template> \n" ;
267267 $ i = 0 ;
268268 foreach ($ desc ->output_file_names as $ fname ) {
269- $ x .= file_info_out ($ i ++);
269+ $ x .= file_info_out ($ i ++, $ desc -> max_nbytes_mb * MEGA );
270270 }
271271 $ x .= " <result> \n" ;
272272 $ i = 0 ;
@@ -490,6 +490,7 @@ function app_form($desc=null) {
490490 $ desc ->long_name = null ;
491491 $ desc ->input_file_names = [];
492492 $ desc ->output_file_names = [];
493+ $ desc ->max_nbytes_mb = 10 ;
493494 $ desc ->min_nsuccess = 1 ;
494495 $ desc ->max_total = 2 ;
495496 $ desc ->max_delay_days = 7 ;
@@ -510,6 +511,14 @@ function app_form($desc=null) {
510511 'output_file_names ' ,
511512 implode (' ' , $ desc ->output_file_names )
512513 );
514+ if (empty ($ desc ->max_nbytes_mb )) {
515+ $ desc ->max_nbytes_mb = 10 ;
516+ }
517+ form_input_text (
518+ 'Max output file size, MB ' ,
519+ 'max_nbytes_mb ' ,
520+ $ desc ->max_nbytes_mb
521+ );
513522 form_input_text (
514523 'Run at most this many total instances of each job ' ,
515524 'max_total ' ,
@@ -620,6 +629,7 @@ function app_action($user) {
620629 } else {
621630 $ output_file_names = [];
622631 }
632+ $ desc ->max_nbytes_mb = get_int ('max_nbytes_mb ' );
623633 $ desc ->long_name = get_str ('long_name ' );
624634 $ desc ->input_file_names = $ input_file_names ;
625635 $ desc ->output_file_names = $ output_file_names ;
@@ -674,7 +684,7 @@ function handle_app_edit() {
674684}
675685
676686function app_details ($ user ) {
677- global $ buda_root, $ manage_access ;
687+ global $ buda_root ;
678688 $ name = get_str ('name ' );
679689 $ desc = get_buda_app_desc ($ name );
680690 if (!$ desc ) error_page ("no desc file $ path " );
@@ -699,6 +709,12 @@ function app_details($user) {
699709 'Output filenames: ' ,
700710 implode (', ' , $ desc ->output_file_names )
701711 );
712+ if (!empty ($ desc ->max_nbytes_mb )) {
713+ row2 (
714+ 'Max output file size, MB ' ,
715+ $ desc ->max_nbytes_mb
716+ );
717+ }
702718 if (!empty ($ desc ->max_total )) {
703719 row2 ('Max total instances per job: ' , $ desc ->max_total );
704720 } else {
@@ -714,7 +730,7 @@ function app_details($user) {
714730 } else {
715731 row2 ('Max job turnaround time, days: ' , '7 ' );
716732 }
717- if ($ manage_access && user_can_manage ($ user , $ desc )) {
733+ if (user_can_manage ($ user , $ desc )) {
718734 row2 ('' ,
719735 button_text_small (
720736 sprintf ('buda.php?action=%s&name=%s ' , 'app_edit ' , $ desc ->name ),
@@ -731,15 +747,15 @@ function app_details($user) {
731747 );
732748 }
733749 row2 ('Variants ' , implode ('<p> ' , $ x ));
734- if ($ manage_access && user_can_manage ($ user , $ desc )) {
750+ if (user_can_manage ($ user , $ desc )) {
735751 row2 ('' ,
736752 button_text_small (
737753 "buda.php?action=variant_form&app= $ name " ,
738754 'Add variant '
739755 )
740756 );
741757 }
742- } else if ($ manage_access ) {
758+ } else if (user_can_manage ( $ user , $ desc ) ) {
743759 row2 ('Variants ' ,
744760 button_text_small (
745761 "buda.php?action=variant_form&app= $ name " ,
@@ -759,42 +775,39 @@ function app_details($user) {
759775 page_tail ();
760776}
761777
762- // Users with manage access to BUDA can add/delete apps and variants.
763- // Others can just view.
764- // Might want to refine this at some point
765-
766778$ user = get_logged_in_user ();
767779$ buda_app = BoincApp::lookup ("name='buda' " );
768780if (!$ buda_app ) error_page ('no buda app ' );
769- $ manage_access = has_manage_access ($ user , $ buda_app ->id );
781+
782+ // does user have right to right to view and create BUDA apps?
783+ //
784+ if (!has_manage_access ($ user , $ buda_app ->id )) {
785+ error_page ('no access ' );
786+ }
787+
788+ $ us = BoincUserSubmit::lookup_userid ($ user ->id );
789+ $ manage_all = $ us ->manage_all ;
770790
771791$ action = get_str ('action ' , true );
772792switch ($ action ) {
773793case 'app_edit ' :
774- if (!$ manage_access ) error_page ('no access ' );
775794 handle_app_edit (); break ;
776795case 'app_form ' :
777- if (!$ manage_access ) error_page ('no access ' );
778796 app_form (); break ;
779797case 'app_action ' :
780- if (!$ manage_access ) error_page ('no access ' );
781798 app_action ($ user ); break ;
782799case 'app_details ' :
783800 app_details ($ user ); break ;
784801case 'app_delete ' :
785- if (!$ manage_access ) error_page ('no access ' );
786802 app_delete (); break ;
787803case 'variant_view ' :
788804 variant_view ($ user ); break ;
789805case 'variant_form ' :
790- if (!$ manage_access ) error_page ('no access ' );
791806 variant_form ($ user ); break ;
792807case 'variant_action ' :
793- if (!$ manage_access ) error_page ('no access ' );
794808 variant_action ($ user );
795809 break ;
796810case 'variant_delete ' :
797- if (!$ manage_access ) error_page ('no access ' );
798811 variant_delete ();
799812 break ;
800813case 'view_file ' :
0 commit comments