Commit graph

15 commits

Author SHA1 Message Date
Thalia
878602ad97 Disallow hiding temporary users via blocks
Ensure that temporary users cannot have their name hidden via a block.

Temporary users are now handled the same as IP users:
* SpecialBlock: the option to hide a user is disabled if the target
  entered is a temporary user name
* BlockUser: the option to hide a user cannot be set to true if the
  target is a temporary user; however a non-hiding block is still made

Bug: T343705
Change-Id: I47b2ca55797d4e7d9dc1b61d0368e1269ad0fd3c
2023-08-14 18:12:03 +01:00
thiemowmde
70aa9c8e35 Make use of ?:, ?? and ??= operators in mostly trivial cases
The motivation is to make the code less confusing. I hope this is the
case.

?? is an older PHP 7.0 feature.
??= was added in PHP 7.4, which we can finally use.

Change-Id: Id807affa52bd1151a74c064623b41d950a389560
2022-12-05 21:37:13 +01:00
Amir Sarabadani
09b18a8f4c Reorg: Move Title-related classes to title/
These three classes:
 - TitleArray
 - TitleArrayFromResult
 - TitleFactory

We need to move these and the rest of files under title/ to Title/ (and
namespace them) but the patch will become way too big given that Title class is
also one of them.

Bug: T321882
Change-Id: Iac1688172ee457348a08a470c86e047571feb8e0
2022-11-26 09:30:32 +00:00
Thiemo Kreuz
b4c63c64ae Remove some more comments that literally repeat the code
Nothing to learn from these.

You can find a longer explanation in the comments in I93751e6.

Change-Id: I195aae70fc282b58be5b18160783f27d38605d15
2021-12-09 19:01:36 +01:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
tsepothoabala
b4a60fecdf Allow action blocks to be logged via block log parameters
Bug: T279560
Change-Id: Icd6ba193a2ce7af83a074cd135470a5097638791
2021-05-05 19:45:52 +02:00
STran
2d3243b76b Don't allow blocking on pages that don't exist
Bug: T269341
Change-Id: I5836d72960c3f9df874ac3348602e3f8e6322afa
2021-04-08 07:44:53 -07:00
Petr Pchelko
1494b73969 Convert (Un)BlockUser target to user identity
Change-Id: Ie049cc18cac27203a38486d97b2b4d9f056bdd42
2021-03-24 09:39:21 -06:00
Petr Pchelko
f984d3f83b Hard-deprecate AbstractBlock::parseTarget
Bug: T276610
Change-Id: I2f10ae5da1d9b1ca4aa20492b943e0c94d32a0b6
2021-03-19 07:22:48 -06:00
Petr Pchelko
c04328bdef Convert (Un)BlockUser to Authority
Change-Id: I5084b5523f15b7d55b2f5dc67ae19ec7059799ad
2021-03-18 02:10:45 +00:00
Umherirrender
3f1c5d0eea Document list of change tags as string[]
Change-Id: I0ce2a8154af82a363fef126033b5819c4ee84842
2020-11-20 14:12:54 +01:00
Martin Urbanec
b5ef266181 Do not call SpecialBlock from BlockUser
Bug: T263189
Change-Id: If7c0a5929826265045ebba3c19663ec19d3dfc0b
2020-10-04 23:20:06 +02:00
Martin Urbanec
a656d03597 Introduce backend class for blocking users
Rather than having to do DatabaseBlock calls directly,
and then ManualLogEntry calls to facilitate logging,
let's create a BlockUser service, capable of blocking users
and logging, optionally with permission checking.

This should make blocking users easier for developers,
for instance, AbuseFilter or CheckUser can easily
benefit from this commit.

Bug: T189073
Change-Id: Ifdced735b694b85116cb0e43dadbfa8e4cdb8cab
2020-09-22 14:14:01 +01:00
Thalia
addb098c39 Deprecate DatabaseBlock methods moved to DatabaseBlockStore
Following 23c3c70d7f, soft deprecate the static methods on
DatabaseBlock that have been moved to DatabaseBlockStore:
* ::insert
* ::delete
* ::update
* ::purgeExpired

Update calls to the deprecated methods from core.

Change-Id: I1272eb978594fd4f386bda12cbc24131ad7d882f
2020-09-13 22:17:27 +00:00
Martin Urbanec
d64efdeacb Introduce backend class for unblocking users
Create UnblockUserFactory service, which returns an UnblockUser.
UnblockUser::unblock replaces SpecialUnblock::processUnblock, which
is now deprecated.

Update SpecialUnblock and ApiUnblock to use UnblockUser, removing
the API module's dependency on the special page.

Update SpecialUnblock::processUIUnblock to use UnblockUser, and mark
it for internal use only. It now returns a Status object.

Also add BlockPermissionChecker::checkBasePermissions, which checks
for the 'block' right and the 'hideuser' right if necessary.

Bug: T250020
Change-Id: Ide31da469297f4582ad0e3f7f1a7c40d542923f8
2020-08-25 13:34:36 +01:00