37 private $userGroupManager;
43 parent::__construct(
'PasswordPolicies' );
44 $this->userGroupManager = $userGroupManager;
56 $out->addModuleStyles(
'mediawiki.special' );
62 Xml::openElement(
'table', [
'class' =>
'wikitable mw-passwordpolicies-table' ] ) .
64 Xml::element(
'th',
null, $this->
msg(
'passwordpolicies-group' )->text() ) .
65 Xml::element(
'th',
null, $this->
msg(
'passwordpolicies-policies' )->text() ) .
70 $policies = $config->get( MainConfigNames::PasswordPolicy );
72 $implicitGroups = $this->userGroupManager->listAllImplicitGroups();
73 $allGroups = array_merge(
74 $this->userGroupManager->listAllGroups(),
82 foreach ( $allGroups as $group ) {
83 if ( $group ==
'*' ) {
87 $groupnameLocalized =
$lang->getGroupName( $group );
89 $grouppageLocalizedTitle = UserGroupMembership::getGroupPage( $group )
92 $grouppage = $linkRenderer->makeLink(
93 $grouppageLocalizedTitle,
97 if ( $group ===
'user' ) {
99 $grouplink =
'<br />' . $linkRenderer->makeKnownLink(
101 $this->
msg(
'listgrouprights-members' )->text()
103 } elseif ( !in_array( $group, $implicitGroups ) ) {
104 $grouplink =
'<br />' . $linkRenderer->makeKnownLink(
106 $this->
msg(
'listgrouprights-members' )->text(),
108 [
'group' => $group ]
115 $out->addHTML( Html::rawElement(
'tr', [
'id' => Sanitizer::escapeIdForAttribute( $group ) ],
"
116 <td>$grouppage$grouplink</td>
117 <td>" . $this->formatPolicies( $policies, $group ) .
'</td>
123 $out->addHTML( Xml::closeElement(
'table' ) );
134 private function formatPolicies( $policies, $group ) {
136 $policies[
'policies'],
138 $policies[
'policies'][
'default']
142 foreach ( $groupPolicies as $gp => $settings ) {
143 if ( !is_array( $settings ) ) {
144 $settings = [
'value' => $settings ];
146 $val = $settings[
'value'];
147 $flags = array_diff_key( $settings, [
'value' =>
true ] );
152 $msg = $this->
msg(
'passwordpolicies-policy-' . strtolower( $gp ) )->numParams( $val );
154 foreach ( array_filter( $flags ) as $flag => $value ) {
155 $flagMsg = $this->
msg(
'passwordpolicies-policyflag-' . strtolower( $flag ) );
156 $flagMsg->params( $value );
157 $flagMsgs[] = $flagMsg;
161 'passwordpolicies-policy-displaywithflags',
163 '<span class="mw-passwordpolicies-policy-name">' . $gp .
'</span>',
168 'passwordpolicies-policy-display',
170 '<span class="mw-passwordpolicies-policy-name">' . $gp .
'</span>'
177 return '<ul><li>' . implode(
"</li>\n<li>", $ret ) .
'</li></ul>';
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
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,...
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
static getPoliciesForGroups(array $policies, array $userGroups, array $defaultPolicy)
Utility function to get the effective policy from a list of policies, based on a list of groups.