I think at some situations users don't want the role to be changed permanently.

Comments

hkirsman’s picture

Status: Active » Needs review
StatusFileSize
new1.84 KB

Here's a working demo of this feature. Needs more testing, probably a admin infterface to switch between the old and new feature.

vaartio’s picture

Status: Needs review » Fixed

This is an interesting approach. It has pros and cons. A clear advantage is that overriding the actual roles of a user from the database doesn't make possible to switch the role to anonymous. Session storage makes it possible. One disadvantage is that some modules may check permissions by loading user object again from the database.

I applied your patch and add an admin user interface and fixed couple things. There's a brand new release candidate available now.

hkirsman’s picture

Status: Fixed » Needs review

Cool!

About the disadvantage, maby duplicate the code in hook_boot to hook_user_load?

  • vaartio committed 7cf75e8 on 8.x-1.x
    #1853690 by hkirsman, vaartio: Added option to store switched role to a...
vaartio’s picture

Issue summary: View changes
Status: Needs review » Closed (fixed)