MediaWiki
1.28.0
|
Check if a user's password complies with any password policies that apply to that user, based on the user's group membership. More...
Public Member Functions | |
__construct (array $policies, array $checks) | |
checkUserPassword (User $user, $password, $purpose= 'login') | |
Check if a passwords meets the effective password policy for a User. More... | |
checkUserPasswordForGroups (User $user, $password, array $groups) | |
Check if a passwords meets the effective password policy for a User, using a set of groups they may or may not belong to. More... | |
getPoliciesForUser (User $user, $purpose= 'login') | |
Get the policy for a user, based on their group membership. More... | |
Static Public Member Functions | |
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. More... | |
static | maxOfPolicies (array $p1, array $p2) |
Utility function to get a policy that is the most restrictive of $p1 and $p2. More... | |
Private Member Functions | |
checkPolicies (User $user, $password, $policies, $policyCheckFunctions) | |
Private Attributes | |
array | $policies |
array | $policyCheckFunctions |
Mapping of statements to the function that will test the password for compliance. More... | |
Check if a user's password complies with any password policies that apply to that user, based on the user's group membership.
Definition at line 28 of file UserPasswordPolicy.php.
array | $policies | |
array | $checks | mapping statement to its checking function. Checking functions are called with the policy value for this user, the user object, and the password to check. |
Definition at line 48 of file UserPasswordPolicy.php.
|
private |
User | $user | |
string | $password | |
array | $policies | |
array | $policyCheckFunctions |
Definition at line 115 of file UserPasswordPolicy.php.
References $status, $value, as, and StatusValue\newGood().
Referenced by checkUserPassword(), and checkUserPasswordForGroups().
Check if a passwords meets the effective password policy for a User.
User | $user | who's policy we are checking |
string | $password | the password to check |
string | $purpose | one of 'login', 'create', 'reset' |
Definition at line 74 of file UserPasswordPolicy.php.
References checkPolicies(), and getPoliciesForUser().
Check if a passwords meets the effective password policy for a User, using a set of groups they may or may not belong to.
This function does not use the DB, so can be used in the installer.
User | $user | who's policy we are checking |
string | $password | the password to check |
array | $groups | list of groups to which we assume the user belongs |
Definition at line 94 of file UserPasswordPolicy.php.
References checkPolicies().
|
static |
Utility function to get the effective policy from a list of policies, based on a list of groups.
array | $policies | list of policies to consider |
array | $userGroups | the groups from which we calculate the effective policy |
array | $defaultPolicy | the default policy to start from |
Definition at line 163 of file UserPasswordPolicy.php.
References as.
Referenced by UserPasswordPolicyTest\testGetPoliciesForGroups().
Get the policy for a user, based on their group membership.
Public so UI elements can access and inform the user.
User | $user | |
string | $purpose | one of 'login', 'create', 'reset' |
Definition at line 140 of file UserPasswordPolicy.php.
References User\getEffectiveGroups(), and Hooks\run().
Referenced by checkUserPassword().
Utility function to get a policy that is the most restrictive of $p1 and $p2.
For simplicity, we setup the policy values so the maximum value is always more restrictive.
array | $p1 | |
array | $p2 |
Definition at line 186 of file UserPasswordPolicy.php.
References $keys, $ret, and as.
Referenced by UserPasswordPolicyTest\testMaxOfPolicies().
|
private |
Definition at line 33 of file UserPasswordPolicy.php.
Referenced by __construct().
|
private |
Mapping of statements to the function that will test the password for compliance.
The checking functions take the policy value, the user, and password, and return a Status object indicating compliance.
Definition at line 41 of file UserPasswordPolicy.php.