33 parent::__construct(
'PasswordPolicies' );
45 $out->addModuleStyles(
'mediawiki.special' );
51 Html::openElement(
'table', [
'class' => [
'wikitable',
'mw-passwordpolicies-table' ] ] ) .
54 Html::element(
'th', [], $this->
msg(
'passwordpolicies-policies' )->text() ) .
61 $implicitGroups = $this->userGroupManager->listAllImplicitGroups();
62 $allGroups = array_merge(
63 $this->userGroupManager->listAllGroups(),
71 foreach ( $allGroups as $group ) {
72 if ( $group ==
'*' ) {
76 $groupnameLocalized = $lang->getGroupName( $group );
78 $grouppageLocalizedTitle = UserGroupMembership::getGroupPage( $group )
81 $grouppage = $linkRenderer->makeLink(
82 $grouppageLocalizedTitle,
86 if ( $group ===
'user' ) {
88 $grouplink =
'<br />' . $linkRenderer->makeKnownLink(
90 $this->
msg(
'listgrouprights-members' )->text()
92 } elseif ( !in_array( $group, $implicitGroups ) ) {
93 $grouplink =
'<br />' . $linkRenderer->makeKnownLink(
95 $this->
msg(
'listgrouprights-members' )->text(),
104 $out->addHTML( Html::rawElement(
'tr', [
'id' => Sanitizer::escapeIdForAttribute( $group ) ],
"
105 <td>$grouppage$grouplink</td>
106 <td>" . $this->formatPolicies( $policies, $group ) .
'</td>
112 $out->addHTML( Html::closeElement(
'table' ) );
123 private function formatPolicies( $policies, $group ) {
124 $groupPolicies = UserPasswordPolicy::getPoliciesForGroups(
125 $policies[
'policies'],
127 $policies[
'policies'][
'default']
131 foreach ( $groupPolicies as $gp => $settings ) {
132 if ( !is_array( $settings ) ) {
133 $settings = [
'value' => $settings ];
135 $val = $settings[
'value'];
136 $flags = array_diff_key( $settings, [
'value' =>
true ] );
142 $msg = $this->
msg(
'passwordpolicies-policy-' . strtolower( $gp ) );
144 if ( is_numeric( $val ) ) {
145 $msg->numParams( $val );
149 foreach ( array_filter( $flags ) as $flag => $unused ) {
150 $flagMsg = $this->
msg(
'passwordpolicies-policyflag-' . strtolower( $flag ) );
151 $flagMsgs[] = $flagMsg;
155 'passwordpolicies-policy-displaywithflags',
157 '<span class="mw-passwordpolicies-policy-name">' . $gp .
'</span>',
162 'passwordpolicies-policy-display',
164 '<span class="mw-passwordpolicies-policy-name">' . $gp .
'</span>'
171 return '<ul><li>' . implode(
"</li>\n<li>", $ret ) .
'</li></ul>';
185class_alias( SpecialPasswordPolicies::class,
'SpecialPasswordPolicies' );
A class containing constants representing the names of configuration variables.
const PasswordPolicy
Name constant for the PasswordPolicy setting, for use with Config::get()
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getConfig()
Shortcut to get main config object.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
getLanguage()
Shortcut to get user's language.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages By default the message key is the canonical name of...
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.