[MediaWiki-commits] [Gerrit] added editmyprivateinfo right check - change (mediawiki...PluggableAuth)
Cicalese has submitted this change and it was merged. Change subject: added editmyprivateinfo right check .. added editmyprivateinfo right check Change-Id: Idfcf5fccfdbf8fdffe8ebb7b02fa6dd80912a10f --- M PluggableAuth.class.php 1 file changed, 21 insertions(+), 11 deletions(-) Approvals: Cicalese: Verified; Looks good to me, approved diff --git a/PluggableAuth.class.php b/PluggableAuth.class.php index eeb030f..901f3a3 100644 --- a/PluggableAuth.class.php +++ b/PluggableAuth.class.php @@ -329,17 +329,27 @@ private static function updateUser( $user, $realname, $email ) { if ( $user-mRealName != $realname || $user-mEmail != $email ) { - $user-mRealName = $realname; - $user-mEmail = $email; - $dbw = wfGetDB( DB_MASTER ); - $dbw-update( 'user', - array( // SET - 'user_real_name' = $realname, - 'user_email' = $email - ), array( // WHERE - 'user_id' = $user-mId - ), __METHOD__ - ); + $rights = $user-getRights(); + if ( in_array( editmyprivateinfo, $rights ) ) { + wfDebug( updateUser(): User has editmyprivateinfo right. . PHP_EOL ); + wfDebug( updateUser(): Did not save updated real name and email address. . PHP_EOL ); + } else { + wfDebug( updateUser(): User does not have editmyprivateinfo right. . PHP_EOL ); + $user-mRealName = $realname; + $user-mEmail = $email; + $dbw = wfGetDB( DB_MASTER ); + $dbw-update( 'user', + array( // SET + 'user_real_name' = $realname, + 'user_email' = $email + ), array( // WHERE + 'user_id' = $user-mId + ), __METHOD__ + ); + wfDebug( updateUser(): Saved updated real name and email address. . PHP_EOL ); + } + } else { + wfDebug( updateUser(): Real name and email address did not change. . PHP_EOL ); } } -- To view, visit https://gerrit.wikimedia.org/r/208517 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Idfcf5fccfdbf8fdffe8ebb7b02fa6dd80912a10f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PluggableAuth Gerrit-Branch: master Gerrit-Owner: Cicalese cical...@mitre.org Gerrit-Reviewer: Cicalese cical...@mitre.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] added editmyprivateinfo right check - change (mediawiki...PluggableAuth)
Cicalese has uploaded a new change for review. https://gerrit.wikimedia.org/r/208517 Change subject: added editmyprivateinfo right check .. added editmyprivateinfo right check Change-Id: Idfcf5fccfdbf8fdffe8ebb7b02fa6dd80912a10f --- M PluggableAuth.class.php 1 file changed, 21 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PluggableAuth refs/changes/17/208517/1 diff --git a/PluggableAuth.class.php b/PluggableAuth.class.php index eeb030f..901f3a3 100644 --- a/PluggableAuth.class.php +++ b/PluggableAuth.class.php @@ -329,17 +329,27 @@ private static function updateUser( $user, $realname, $email ) { if ( $user-mRealName != $realname || $user-mEmail != $email ) { - $user-mRealName = $realname; - $user-mEmail = $email; - $dbw = wfGetDB( DB_MASTER ); - $dbw-update( 'user', - array( // SET - 'user_real_name' = $realname, - 'user_email' = $email - ), array( // WHERE - 'user_id' = $user-mId - ), __METHOD__ - ); + $rights = $user-getRights(); + if ( in_array( editmyprivateinfo, $rights ) ) { + wfDebug( updateUser(): User has editmyprivateinfo right. . PHP_EOL ); + wfDebug( updateUser(): Did not save updated real name and email address. . PHP_EOL ); + } else { + wfDebug( updateUser(): User does not have editmyprivateinfo right. . PHP_EOL ); + $user-mRealName = $realname; + $user-mEmail = $email; + $dbw = wfGetDB( DB_MASTER ); + $dbw-update( 'user', + array( // SET + 'user_real_name' = $realname, + 'user_email' = $email + ), array( // WHERE + 'user_id' = $user-mId + ), __METHOD__ + ); + wfDebug( updateUser(): Saved updated real name and email address. . PHP_EOL ); + } + } else { + wfDebug( updateUser(): Real name and email address did not change. . PHP_EOL ); } } -- To view, visit https://gerrit.wikimedia.org/r/208517 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idfcf5fccfdbf8fdffe8ebb7b02fa6dd80912a10f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PluggableAuth Gerrit-Branch: master Gerrit-Owner: Cicalese cical...@mitre.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits