Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix user roles #101

Merged
merged 8 commits into from
Feb 25, 2024
Merged

Fix user roles #101

merged 8 commits into from
Feb 25, 2024

Conversation

darrenoh
Copy link
Contributor

No description provided.

@darrenoh darrenoh changed the title Fix user roles Fix user_roles() Nov 20, 2023
@darrenoh darrenoh force-pushed the fix-user_roles branch 2 times, most recently from d067d7b to 94fce30 Compare November 22, 2023 21:25
tests/data/menu_example/menu_example.module Outdated Show resolved Hide resolved
src/User/GlobalUser.php Outdated Show resolved Hide resolved
src/Entity/EntityTypeManager.php Outdated Show resolved Hide resolved
src/Entity/Role.php Show resolved Hide resolved

function user_role_load(string $rid): ?RoleInterface
{
return Role::load($rid);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use long-form \Drupal::entityTypeManager()->getStorage('user_role')->load($rid);

Copy link
Contributor Author

@darrenoh darrenoh Nov 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could. I actually like the simplicity of letting this static method do it for us. Every entity class has a static load method.
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21EntityInterface.php/function/EntityInterface%3A%3Aload/10

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarity I changed this to use our extended Role class.

@darrenoh darrenoh force-pushed the fix-user_roles branch 2 times, most recently from 99b9d28 to c611e42 Compare November 26, 2023 17:24
@darrenoh darrenoh changed the title Fix user_roles() Fix user roles Nov 26, 2023
@darrenoh darrenoh force-pushed the fix-user_roles branch 4 times, most recently from 0fc65c9 to 379f7d9 Compare December 10, 2023 00:42
@mglaman mglaman enabled auto-merge (squash) February 25, 2024 15:56
@mglaman mglaman merged commit 258389e into retrofit-drupal:main Feb 25, 2024
3 checks passed
@darrenoh darrenoh deleted the fix-user_roles branch March 7, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants