33 parent::__construct(
'PasswordPolicies' );
34 $this->userGroupManager = $userGroupManager;
46 $out->addModuleStyles(
'mediawiki.special' );
52 Html::openElement(
'table', [
'class' => [
'wikitable',
'mw-passwordpolicies-table' ] ] ) .
55 Html::element(
'th', [], $this->
msg(
'passwordpolicies-policies' )->text() ) .
62 $implicitGroups = $this->userGroupManager->listAllImplicitGroups();
63 $allGroups = array_merge(
64 $this->userGroupManager->listAllGroups(),
72 foreach ( $allGroups as $group ) {
73 if ( $group ==
'*' ) {
77 $groupnameLocalized = $lang->getGroupName( $group );
79 $grouppageLocalizedTitle = UserGroupMembership::getGroupPage( $group )
82 $grouppage = $linkRenderer->makeLink(
83 $grouppageLocalizedTitle,
87 if ( $group ===
'user' ) {
89 $grouplink =
'<br />' . $linkRenderer->makeKnownLink(
91 $this->
msg(
'listgrouprights-members' )->text()
93 } elseif ( !in_array( $group, $implicitGroups ) ) {
94 $grouplink =
'<br />' . $linkRenderer->makeKnownLink(
96 $this->
msg(
'listgrouprights-members' )->text(),
105 $out->addHTML( Html::rawElement(
'tr', [
'id' => Sanitizer::escapeIdForAttribute( $group ) ],
"
106 <td>$grouppage$grouplink</td>
107 <td>" . $this->formatPolicies( $policies, $group ) .
'</td>
113 $out->addHTML( Html::closeElement(
'table' ) );
124 private function formatPolicies( $policies, $group ) {
125 $groupPolicies = UserPasswordPolicy::getPoliciesForGroups(
126 $policies[
'policies'],
128 $policies[
'policies'][
'default']
132 foreach ( $groupPolicies as $gp => $settings ) {
133 if ( !is_array( $settings ) ) {
134 $settings = [
'value' => $settings ];
136 $val = $settings[
'value'];
137 $flags = array_diff_key( $settings, [
'value' =>
true ] );
143 $msg = $this->
msg(
'passwordpolicies-policy-' . strtolower( $gp ) );
145 if ( is_numeric( $val ) ) {
146 $msg->numParams( $val );
150 foreach ( array_filter( $flags ) as $flag => $unused ) {
151 $flagMsg = $this->
msg(
'passwordpolicies-policyflag-' . strtolower( $flag ) );
152 $flagMsgs[] = $flagMsg;
156 'passwordpolicies-policy-displaywithflags',
158 '<span class="mw-passwordpolicies-policy-name">' . $gp .
'</span>',
163 'passwordpolicies-policy-display',
165 '<span class="mw-passwordpolicies-policy-name">' . $gp .
'</span>'
172 return '<ul><li>' . implode(
"</li>\n<li>", $ret ) .
'</li></ul>';
186class_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.