/** * Add the given User to a temporary group if he is a responsible editor * for the given Title. This group will have special permissions for the * Title's namespace. The group assignment exists only during the current * request. This method needs to be called before a permission check is * performed on the Title. * @param Title $oTitle * @param User $oUser * @return boolean */ public function applyTempPermissionsForRespEditor(Title $oTitle, User $oUser) { $iArticleID = $oTitle->getArticleID(); $aResponsibleEditorsIDs = $this->getResponsibleEditorIdsByArticleId($iArticleID); if (!in_array($oUser->getId(), $aResponsibleEditorsIDs)) { return false; } $aAvailablePermissions = BsConfig::get('MW::ResponsibleEditors::AutoPermissions'); if (empty($aAvailablePermissions)) { return false; } BsGroupHelper::addTemporaryGroupToUser($oUser, 'tmprespeditors', $aAvailablePermissions, $oTitle); return true; }