Hide the checkbox for protecting a filter from users without the right

Any filter using protected variables must be marked as protected via
the a checkbox on the filter edit form. This checkbox should not be
visible to users without the right to use protected variables.

Bug: T364485
Change-Id: If2c4b8f50f447e951d820798f181839d10501aa3
This commit is contained in:
Thalia 2024-06-06 17:46:52 +01:00
parent 1c96981117
commit 6428ff9232

View file

@ -474,7 +474,10 @@ class AbuseFilterViewEdit extends AbuseFilterView {
}
if ( $checkboxId == 'protected' ) {
if ( $filterObj->isProtected() ) {
if ( !$this->afPermManager->canViewProtectedVariables( $user ) ) {
$checkboxAttribs['classes'] = [ 'oo-ui-element-hidden' ];
$labelAttribs['classes'] = [ 'oo-ui-element-hidden' ];
} elseif ( $filterObj->isProtected() ) {
$checkboxAttribs['disabled'] = true;
$labelAttribs['label'] = $this->msg(
'abusefilter-edit-protected-variable-already-protected'