34 parent::__construct(
'PasswordPolicies' );
46 $out->addModuleStyles(
'mediawiki.special' );
52 Xml::openElement(
'table', [
'class' =>
'wikitable mw-passwordpolicies-table' ] ) .
54 Xml::element(
'th',
null, $this->
msg(
'passwordpolicies-group' )->text() ) .
55 Xml::element(
'th',
null, $this->
msg(
'passwordpolicies-policies' )->text() ) .
60 $policies = $config->get(
'PasswordPolicy' );
62 $groupPermissions = $config->get(
'GroupPermissions' );
63 $revokePermissions = $config->get(
'RevokePermissions' );
64 $addGroups = $config->get(
'AddGroups' );
65 $removeGroups = $config->get(
'RemoveGroups' );
66 $groupsAddToSelf = $config->get(
'GroupsAddToSelf' );
67 $groupsRemoveFromSelf = $config->get(
'GroupsRemoveFromSelf' );
68 $allGroups = array_unique( array_merge(
69 array_keys( $groupPermissions ),
70 array_keys( $revokePermissions ),
71 array_keys( $addGroups ),
72 array_keys( $removeGroups ),
73 array_keys( $groupsAddToSelf ),
74 array_keys( $groupsRemoveFromSelf )
80 foreach ( $allGroups as $group ) {
81 if ( $group ==
'*' ) {
85 $groupnameLocalized = UserGroupMembership::getGroupName( $group );
87 $grouppageLocalizedTitle = UserGroupMembership::getGroupPage( $group )
91 $grouppageLocalizedTitle,
95 if ( $group ===
'user' ) {
99 $this->
msg(
'listgrouprights-members' )->text()
101 } elseif ( !in_array( $group, $config->get(
'ImplicitGroups' ) ) ) {
104 $this->
msg(
'listgrouprights-members' )->text(),
106 [
'group' => $group ]
113 $out->addHTML( Html::rawElement(
'tr', [
'id' => Sanitizer::escapeIdForAttribute( $group ) ],
"
114 <td>$grouppage$grouplink</td>
121 $out->addHTML( Xml::closeElement(
'table' ) );
134 $policies[
'policies'],
136 $policies[
'policies'][
'default']
140 foreach ( $groupPolicies as $gp => $settings ) {
141 if ( !is_array( $settings ) ) {
142 $settings = [
'value' => $settings ];
144 $val = $settings[
'value'];
145 $flags = array_diff_key( $settings, [
'value' =>
true ] );
150 $msg = $this->
msg(
'passwordpolicies-policy-' . strtolower( $gp ) )->numParams( $val );
152 foreach ( array_filter( $flags ) as $flag => $value ) {
153 $flagMsg = $this->
msg(
'passwordpolicies-policyflag-' . strtolower( $flag ) );
154 $flagMsg->params( $value );
155 $flagMsgs[] = $flagMsg;
159 'passwordpolicies-policy-displaywithflags',
161 '<span class="mw-passwordpolicies-policy-name">' . $gp .
'</span>',
166 'passwordpolicies-policy-display',
168 '<span class="mw-passwordpolicies-policy-name">' . $gp .
'</span>'
175 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,...
LinkRenderer null $linkRenderer
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.
This special page lists the defined password policies for user groups.
formatPolicies( $policies, $group)
Create a HTML list of password policies for $group.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
execute( $par)
Show the special page.
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.