Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php |
— | — | @@ -663,7 +663,7 @@ |
664 | 664 | } elseif ( $component == 'hidden' ) { |
665 | 665 | $is_hidden = true; |
666 | 666 | } elseif ( $component == 'restricted' ) { |
667 | | - $is_restricted = true; |
| 667 | + $is_restricted = ( ! $wgUser || ! $wgUser->isAllowed( 'editrestrictedfields' ) ); |
668 | 668 | } elseif ( $component == 'uploadable' ) { |
669 | 669 | $field_args['is_uploadable'] = true; |
670 | 670 | } elseif ( $component == 'list' ) { |
— | — | @@ -765,6 +765,11 @@ |
766 | 766 | // Parse value, so default filename can include parser functions. |
767 | 767 | $default_filename = $wgParser->recursiveTagParse( $default_filename ); |
768 | 768 | $field_args['default filename'] = $default_filename; |
| 769 | + } elseif ( $sub_components[0] == 'restricted' ) { |
| 770 | + $is_restricted = !array_intersect( |
| 771 | + $wgUser->getEffectiveGroups(), |
| 772 | + array_map( 'trim', explode( ',', $sub_components[1] ) ) |
| 773 | + ); |
769 | 774 | } |
770 | 775 | } |
771 | 776 | } |
— | — | @@ -992,8 +997,7 @@ |
993 | 998 | } |
994 | 999 | // disable this field if either the whole form is disabled, or |
995 | 1000 | // it's a restricted field and user doesn't have sysop privileges |
996 | | - $is_disabled = ( $form_is_disabled || |
997 | | - ( $is_restricted && ( ! $wgUser || ! $wgUser->isAllowed( 'editrestrictedfields' ) ) ) ); |
| 1001 | + $is_disabled = ( $form_is_disabled || $is_restricted ); |
998 | 1002 | // Create an SFFormField instance based on all the parameters |
999 | 1003 | // in the form definition, and any information from the template |
1000 | 1004 | // definition (contained in the $all_fields parameter). |