49 parent::__construct(
'PasswordPolicies' );
50 $this->userGroupManager = $userGroupManager;
62 $out->addModuleStyles(
'mediawiki.special' );
68 Xml::openElement(
'table', [
'class' =>
'wikitable mw-passwordpolicies-table' ] ) .
70 Xml::element(
'th',
null, $this->
msg(
'passwordpolicies-group' )->text() ) .
71 Xml::element(
'th',
null, $this->
msg(
'passwordpolicies-policies' )->text() ) .
78 $implicitGroups = $this->userGroupManager->listAllImplicitGroups();
79 $allGroups = array_merge(
80 $this->userGroupManager->listAllGroups(),
88 foreach ( $allGroups as $group ) {
89 if ( $group ==
'*' ) {
93 $groupnameLocalized = $lang->getGroupName( $group );
95 $grouppageLocalizedTitle = UserGroupMembership::getGroupPage( $group )
98 $grouppage = $linkRenderer->makeLink(
99 $grouppageLocalizedTitle,
103 if ( $group ===
'user' ) {
105 $grouplink =
'<br />' . $linkRenderer->makeKnownLink(
107 $this->
msg(
'listgrouprights-members' )->text()
109 } elseif ( !in_array( $group, $implicitGroups ) ) {
110 $grouplink =
'<br />' . $linkRenderer->makeKnownLink(
112 $this->
msg(
'listgrouprights-members' )->text(),
114 [
'group' => $group ]
121 $out->addHTML( Html::rawElement(
'tr', [
'id' => Sanitizer::escapeIdForAttribute( $group ) ],
"
122 <td>$grouppage$grouplink</td>
123 <td>" . $this->formatPolicies( $policies, $group ) .
'</td>
140 private function formatPolicies( $policies, $group ) {
141 $groupPolicies = UserPasswordPolicy::getPoliciesForGroups(
142 $policies[
'policies'],
144 $policies[
'policies'][
'default']
148 foreach ( $groupPolicies as $gp => $settings ) {
149 if ( !is_array( $settings ) ) {
150 $settings = [
'value' => $settings ];
152 $val = $settings[
'value'];
153 $flags = array_diff_key( $settings, [
'value' =>
true ] );
158 $msg = $this->
msg(
'passwordpolicies-policy-' . strtolower( $gp ) )->numParams( $val );
160 foreach ( array_filter( $flags ) as $flag => $value ) {
161 $flagMsg = $this->
msg(
'passwordpolicies-policyflag-' . strtolower( $flag ) );
162 $flagMsg->params( $value );
163 $flagMsgs[] = $flagMsg;
167 'passwordpolicies-policy-displaywithflags',
169 '<span class="mw-passwordpolicies-policy-name">' . $gp .
'</span>',
174 'passwordpolicies-policy-display',
176 '<span class="mw-passwordpolicies-policy-name">' . $gp .
'</span>'
183 return '<ul><li>' . implode(
"</li>\n<li>", $ret ) .
'</li></ul>';
196class_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.