Skip to content

Commit

Permalink
Check managewiki-* rights
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentIsai authored Dec 31, 2023
1 parent a63379a commit 2202365
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions includes/FormFactory/ManageWikiFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function getForm(
->getMainLB( $config->get( 'CreateWikiDatabase' ) )
->getMaintenanceConnectionRef( DB_PRIMARY, [], $config->get( 'CreateWikiDatabase' ) );

$ceMW = ManageWiki::checkPermission( $remoteWiki, $context->getUser() );
$ceMW = ManageWiki::checkPermission( $remoteWiki, $context->getUser(), $module );

$formDescriptor = $this->getFormDescriptor( $module, $wiki, $ceMW, $context, $remoteWiki, $config, $special, $filtered );

Expand Down Expand Up @@ -99,14 +99,32 @@ protected function submitForm(
$errorOut = [];
foreach ( $mwReturn as $errors ) {
foreach ( $errors as $msg => $params ) {
$errorOut[] = wfMessage( $msg, $params )->escaped();
$errorOut[] = wfMessage( $msg, $params )->plain();
}
}

$out->addHTML( Html::errorBox( 'The following errors occurred:<br>' . implode( '<br>', $errorOut ) ) );
$out->addHTML(
Html::warningBox(
Html::element(
'p',
[],
'The following errors occurred:<br>' . implode( '<br>', $errorOut )
),
'mw-notify-error'
)
);
return null;
}

$out->addHTML( Html::successBox( wfMessage( 'managewiki-success' )->escaped() ) );
$out->addHTML(
Html::successBox(
Html::element(
'p',
[],
wfMessage( 'managewiki-success' )->plain()
),
'mw-notify-success'
)
);
}
}

0 comments on commit 2202365

Please sign in to comment.