Skip to content

Commit

Permalink
Merge "Remove the 'named' user group, which is no longer used"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Jun 20, 2024
2 parents b64624a + 93e8350 commit 439ce10
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
6 changes: 2 additions & 4 deletions includes/Permissions/PermissionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1053,16 +1053,14 @@ private function checkQuickPermissions(
// User can't move anything
$userCanMove = $this->groupPermissionsLookup
->groupHasPermission( 'user', 'move' );
$namedCanMove = $this->groupPermissionsLookup
->groupHasPermission( 'named', 'move' );
$autoconfirmedCanMove = $this->groupPermissionsLookup
->groupHasPermission( 'autoconfirmed', 'move' );
if ( $user->isAnon()
&& ( $userCanMove || $namedCanMove || $autoconfirmedCanMove )
&& ( $userCanMove || $autoconfirmedCanMove )
) {
// custom message if logged-in users without any special rights can move
$errors[] = [ 'movenologintext' ];
} elseif ( $user->isTemp() && ( $namedCanMove || $autoconfirmedCanMove ) ) {
} elseif ( $user->isTemp() && $autoconfirmedCanMove ) {
// Temp user may be able to move if they log in as a proper account
$errors[] = [ 'movenologintext' ];
} else {
Expand Down
3 changes: 0 additions & 3 deletions includes/user/UserGroupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,6 @@ public function getUserImplicitGroups(
$groups[] = 'temp';
} elseif ( $user->isRegistered() ) {
$groups[] = 'user';
if ( $this->tempUserConfig->isKnown() ) {
$groups[] = 'named';
}
$groups = array_unique( array_merge(
$groups,
$this->getUserAutopromoteGroups( $user )
Expand Down
22 changes: 11 additions & 11 deletions tests/phpunit/includes/user/UserGroupManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ public function testGetImplicitGroups() {
$manager = $this->getManager();
$user = $this->getTestUser( 'unittesters' )->getUser();
$this->assertArrayEquals(
[ '*', 'user', 'named', 'autoconfirmed' ],
[ '*', 'user', 'autoconfirmed' ],
$manager->getUserImplicitGroups( $user )
);

$user = $this->getTestUser( [ 'bureaucrat', 'test' ] )->getUser();
$this->assertArrayEquals(
[ '*', 'user', 'named', 'autoconfirmed' ],
[ '*', 'user', 'autoconfirmed' ],
$manager->getUserImplicitGroups( $user )
);

Expand All @@ -205,7 +205,7 @@ public function testGetImplicitGroups() {
'added user to group'
);
$this->assertArrayEquals(
[ '*', 'user', 'named', 'autoconfirmed' ],
[ '*', 'user', 'autoconfirmed' ],
$manager->getUserImplicitGroups( $user )
);

Expand All @@ -217,27 +217,27 @@ public function testGetImplicitGroups() {
] ] );
$user = $this->getTestUser()->getUser();
$this->assertArrayEquals(
[ '*', 'user', 'named' ],
[ '*', 'user' ],
$manager->getUserImplicitGroups( $user )
);
$this->assertArrayEquals(
[ '*', 'user', 'named' ],
[ '*', 'user' ],
$manager->getUserEffectiveGroups( $user )
);
$user->confirmEmail();
$this->assertArrayEquals(
[ '*', 'user', 'named', 'dummy' ],
[ '*', 'user', 'dummy' ],
$manager->getUserImplicitGroups( $user, IDBAccessObject::READ_NORMAL, true )
);
$this->assertArrayEquals(
[ '*', 'user', 'named', 'dummy' ],
[ '*', 'user', 'dummy' ],
$manager->getUserEffectiveGroups( $user )
);

$user = $this->getTestUser( [ 'dummy' ] )->getUser();
$user->confirmEmail();
$this->assertArrayEquals(
[ '*', 'user', 'named', 'dummy' ],
[ '*', 'user', 'dummy' ],
$manager->getUserImplicitGroups( $user )
);

Expand All @@ -250,9 +250,9 @@ public function testGetImplicitGroups() {
}

public static function provideGetEffectiveGroups() {
yield [ [], [ '*', 'user', 'named', 'autoconfirmed' ] ];
yield [ [ 'bureaucrat', 'test' ], [ '*', 'user', 'named', 'autoconfirmed', 'bureaucrat', 'test' ] ];
yield [ [ 'autoconfirmed', 'test' ], [ '*', 'user', 'named', 'autoconfirmed', 'test' ] ];
yield [ [], [ '*', 'user', 'autoconfirmed' ] ];
yield [ [ 'bureaucrat', 'test' ], [ '*', 'user', 'autoconfirmed', 'bureaucrat', 'test' ] ];
yield [ [ 'autoconfirmed', 'test' ], [ '*', 'user', 'autoconfirmed', 'test' ] ];
}

/**
Expand Down

0 comments on commit 439ce10

Please sign in to comment.