Role Authenticated User is not visible

Created on 23 June 2023, over 1 year ago
Updated 17 April 2024, 7 months ago

Problem/Motivation

User Role Authenticated User disappeared

Created a custom module on a freshly installed drupal site, created the required permission file ,assigned it to a route and then uninstalled the module, then authenticated user role got disappeared.

I tried to clear the cache and removed the custom created module entirely from the files, still it doesn't work

How will i get the default Authenticated User Role, with all its default functionalities?

What I did

I went to /admin/people/permissions and assigned the custom module route permission to the authenticated user.

  • I created a custom module mymodule
  • I created the permission.yml file for it and made a custom permission named admin permission
  • I Assigned the permission to the authenticated users
  • I uninstalled the module, and the authenticated user role was deleted from the user role lists

info.yml file content

name: 'm2'
type: module
description: 'abcd'
package: Custom
core_version_requirement: ^10

permission.yml file content

m2 troubleshoot:
  title: My Module
  description: Troubleshooting is under way

Please check the below screen shot that is visible when i am uninstalling the module

Moreover this issue doesn't only persist with the custom created modules but also with any contributed modules that requires the user permission assignment.

๐Ÿ’ฌ Support request
Status

Closed: duplicate

Version

10.1 โœจ

Component
User systemย  โ†’

Last updated 1 day ago

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal282001

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue was unassigned.
  • If a custom module caused this we will have to see the code to offer support.

  • Status changed to Postponed: needs info over 1 year ago
  • Providing the actual code is the best way forward for support. This could be a bug however we don't have sufficient evidence.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States Greg Boggs Portland Oregon

    In config, when a role config or any config depends on something, like a view or a module, that config is deleted when the dependency is deleted. I don't think there's a good way to resolve this.

    One way resolve it so you can uninstall your module without deleting t he role is that you have to export your site config to yml, edit the yml file manually to remove the dependency, then reimport the config to active. After that, you can delete your custom module without deleting the role config.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain tunic Madrid
  • ๐Ÿ‡ช๐Ÿ‡ธSpain tunic Madrid

    @vishal282001, I'm not sure but from the link you rpovide to Github I see the "config/sync/user.role.authenticated_user.yml" has been removed (and some other related). That file holds the configuration for the authenticated user role. If you delete it and import configuration, the role is deleted because is not present anymore in the configuration.

    To fix this, I would recover those files:

    • config/sync/system.action.user_add_role_action.authenticated_user.yml
    • config/sync/system.action.user_remove_role_action.authenticated_user.yml
    • config/sync/user.role.authenticated_user.yml

    Then, import configuration. If you don't have relevant date in the site I would reinstall the site because removing the role may have impacted the integrity of the site.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain tunic Madrid

    That screenshot means uninstalling that module will update the Authenticated User role. Is not clear what the changes are, but if your module provides permissions probably the changes are removing those permissions form the role, what is safe.

    I would go ahead, but pelase have a backup if you have important data in the site.

  • @vishal282001

    There are two questions here:

    Why did my code do this?

    We donโ€™t know because you do not show your code.

    How do I fix this?

    Community members are giving you advice.

    You are posting screenshots.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal282001

    @Greg Boggs , @cilefen i have updated the problem description for the sake of better understanding, so kindly revisit the issue and provide with the any feasible solution if exists.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Vivek Panicker Kolkata

    @cliefen The code necessary to reproduce the issue has already been posted by @vishal.

    It's as simple as creating a module with defines a permisison, assigning that permission to a user role and then trying to uninstall the module.

    At that point, we see the issue as shown in the screenshot. The user role seems to be getting deleted.

    And this is also reproducible when we try to uninstall any contrib module which provides permissions.

    The Drupal version used here is 10.4.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain tunic Madrid

    #16 What you describe would modify the role because some permissions are changed (see my explanation on #12) but not remove the role completely. Please double check that your claims is true (any module providing Authenticated User permissions removes that role when uninstalled) because it is hard to believe because this issue would be flooded by user comments having the same issue.

  • @tunic is correct.

    Author a module that you verify reproduces the problem on a newly-installed Drupal site. Provide that module here and we'll have a look.

  • Status changed to Closed: cannot reproduce over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Vivek Panicker Kolkata

    @cliefen We checked again thoroughly, and actually the role is not getting deleted, it is just getting updated.

    Orignally when @vishal mentioned about the role getting deleted, that was because we were trying out some random stuff in code, which must have corrupted the data.

    So there's actually no issue and we're good to close this ticket.

    Thanks for your time everyone and apologies for any inconvenience caused.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States tr Cascadia

    This does happen, for the reason @Greg Boggs mentioned above in #8. I added some related issues.

    I personally think it's a very serious problem with core that was introduced in #2571235: [regression] Roles should depend on objects that are building the granted permissions โ†’ .

    I don't think that core should EVER automatically delete the Authenticated and Anonymous roles under any conditions because doing that destroys data (specifically how those roles are configured) and almost certainly breaks the website.

    Config dependencies should prevent the permissions from being deleted if they are being used, and should NOT be deleting the roles without confirmation if the permissions are removed.

  • Status changed to Active over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States tr Cascadia
  • So is this a duplicate of the issues linked in #21?

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom jaydenpearly

    This happened to me too after I uninstalled paragraphs demo and entity browser modules.

    I don't know which one is the killer or if these modules have something to do with it.

    I manually added a role with the machine name "authenticated" but all permissions were gone. "authenticated" is perceived as a new role. So it didn't work.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom jaydenpearly

    I've tested again. It's proven that entity browser module delete authenticated role when it's uninstalled.

  • Status changed to Closed: duplicate over 1 year ago
  • This issue should have been moved to entity browser, to preserve the history.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Krishna Mishra

    I can reproduce same issue: Custom roles like (editor, author) on drush deploy :
    1: Roles removed
    2: Then again role created as config files exits for roles during deploy process. But this causes issue that for users role assignment has been removed as in first stpe of deploy roles are deleted.

    Steps to reproduce :
    1: Update D9 to D10
    2: Manually edit core.extension.yml and remove entity_browser
    3: Execute drush deploy -y this will uninstall EB module and result above issue.

    Thanks!!

Production build 0.71.5 2024