jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/350116 )

Change subject: Expire the cache of a User object when a group membership is 
set to expire
......................................................................


Expire the cache of a User object when a group membership is set to expire

To avoid user permissions persisting for up to 1 hour beyond their expiry
time.

Bug: T163691
Change-Id: I85b578e6b7816639c3d0101d66efb1efedb17af6
---
M includes/user/User.php
1 file changed, 11 insertions(+), 0 deletions(-)

Approvals:
  Krinkle: Looks good to me, but someone else must approve
  jenkins-bot: Verified
  Anomie: Looks good to me, approved



diff --git a/includes/user/User.php b/includes/user/User.php
index b8a36b8..3edd49f 100644
--- a/includes/user/User.php
+++ b/includes/user/User.php
@@ -509,6 +509,17 @@
 
                                $ttl = $cache->adaptiveTTL( wfTimestamp( 
TS_UNIX, $this->mTouched ), $ttl );
 
+                               // if a user group membership is about to 
expire, the cache needs to
+                               // expire at that time (T163691)
+                               foreach ( $this->mGroupMemberships as $ugm ) {
+                                       if ( $ugm->getExpiry() ) {
+                                               $secondsUntilExpiry = 
wfTimestamp( TS_UNIX, $ugm->getExpiry() ) - time();
+                                               if ( $secondsUntilExpiry > 0 && 
$secondsUntilExpiry < $ttl ) {
+                                                       $ttl = 
$secondsUntilExpiry;
+                                               }
+                                       }
+                               }
+
                                return $data;
 
                        },

-- 
To view, visit https://gerrit.wikimedia.org/r/350116
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I85b578e6b7816639c3d0101d66efb1efedb17af6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TTO <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to