Problem/Motivation

As of #2347799: Remove bugged session-related methods from AccountInterface the AccountInterface does not have any session related methods anymore. In addition #2345611: Load user entity in Cookie AuthenticationProvider instead of using manual queries removes the usage UserSession from production code entirely.

Proposed resolution

Move the AccountInterface and AnonymousUser to \Drupal\Core\Authentication interface. Replace UserSession with a User entity in the remaining test code.

Remaining tasks

approve change
commit

User interface changes

no

API changes

  • Move \Drupal\Core\Session\AccountInterface to \Drupal\Core\Authentication\AccountInterface, but leave a deprecated subinterface thereof at the old place.
  • Move \Drupal\Core\Session\AnonymousUserSession to \Drupal\Core\Authentication\AnonymousUser.
  • Remove \Drupal\Core\Session\UserSession and replace it with user entity #2345611: Load user entity in Cookie AuthenticationProvider instead of using manual queries.
  • Move \Drupal\Core\Session\AccountProxy to \Drupal\Core\Authentication\AccountProxy
  • Move \Drupal\Core\Session\AccountSwitcher to \Drupal\Core\Authentication\AccountSwitcher

Follow-up to #2347799: Remove bugged session-related methods from AccountInterface

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

znerol’s picture

Status: Active » Postponed
andypost’s picture

Issue tags: +Needs change record

maybe just update some records

jibran’s picture

Status: Postponed » Active
andypost’s picture

Status: Active » Needs review
FileSize
254.36 KB

WIP phpstorm "move" refactoring

Status: Needs review » Needs work

The last submitted patch, 5: 2477213-account-core-5.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
10.36 KB
262.3 KB

move AnonymousUserSession and related test
Plus fix AccountProxyInterface

Status: Needs review » Needs work

The last submitted patch, 7: 2477213-account-core-6.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
714 bytes
262.41 KB

Somehow file was not moved

andypost’s picture

Assigned: Unassigned » catch
Issue tags: +Needs committer feedback

262k and green, suppose we need feedback from commiter and separate issue for UserSession removal

znerol’s picture

Issue summary: View changes
dawehner’s picture

262k and green, suppose we need feedback from commiter and separate issue for UserSession removal

In case we want to do that, I would propose to keep the current interface as alias for the new one. Its IMHO not worth to break that much contrib/custom code.

andypost’s picture

Assigned: catch » andypost
FileSize
17.22 KB
281.01 KB

Implement BC wrappers and move proxy and switcher

Working on rename AnonymousUser

Status: Needs review » Needs work

The last submitted patch, 13: 2477213-account-core-13.patch, failed testing.

andypost’s picture

Status: Needs work » Needs review
FileSize
17.33 KB
296 KB

Fix usage

andypost’s picture

FileSize
14.7 KB
302.26 KB

rename AnonymousUserSession to AnonymousUser

andypost’s picture

Assigned: andypost » Unassigned
Issue summary: View changes
FileSize
407 bytes
302.22 KB

a bit of clean-up

dawehner’s picture

+ * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.0. Use
+ *    \Drupal\Core\Authentication\AccountInterface instead.

IMHO its not something worth breaking before 8.0.0, given how many instances of AccountInterface are probably out there.

andypost’s picture

I think there's enough time before release to allow contrib to clean-up usage
Anyway it needs commiters to decide

catch’s picture

Status: Needs review » Needs work
Issue tags: -Needs committer feedback

Yes there are enough usages of this in contrib we should keep bc here and deprecate for 9.0.0.

cilefen’s picture

Issue tags: +Needs beta evaluation

This needs a beta evaluation. The fact that a committer has evaluated it should help.

jaimeguzman’s picture

I'm working on this issue, also I used refactor with Phpstorm, it was really easy and validate each namesapce,(like patch comment on #13 and #17). I ran some local test and all to them passed, but I have some doubt about 2 things:

  1. Remove \Drupal\Core\Session\UserSession, I try to replace user entities, but no have automatic test for check. How this can be validated?
  2. Also I think when test are running, written test for Session they should be migrate to Authentication namespace.
andypost’s picture

related could add new getDisplayName() method to account

Crell’s picture

Version: 8.0.x-dev » 8.1.x-dev
Issue tags: -WSCCI

This isn't WSCCI. Also not a 8.0-safe change.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mgifford’s picture

Re-uploading #17 for the bots.

Status: Needs review » Needs work

The last submitted patch, 26: 2477213-account-core-17.patch, failed testing.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

znerol’s picture

Issue tags: +Needs reroll, +ddd2023

Needs a reroll for 11.x. I'll stick around for reviews here. Find me in the sky lounge at DDD vienna if there are any questions.

andypost’s picture

Issue tags: -Needs beta evaluation

not sure it still makes sense as very disruptive