-
Notifications
You must be signed in to change notification settings - Fork 168
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
PROD-31305: Non verified users are not able to see their profile properly #4236
base: main
Are you sure you want to change the base?
PROD-31305: Non verified users are not able to see their profile properly #4236
Conversation
2edea62
to
badf9d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find on where the issue was coming from with the custom code in social_user
.
There is a potential security issue in here and I think we should reconsider why we need _custom_access
here.
modules/social_features/social_profile/src/Plugin/views/access/SocialProfilePagesAccess.php
Outdated
Show resolved
Hide resolved
// Load the user entity. | ||
$user_id = $this->routeMatch->getRawParameter('user'); | ||
$user = $this->entityTypeManager->getStorage('user') | ||
->load($user_id); | ||
if (!$user instanceof UserInterface) { | ||
return AccessResult::forbidden(); | ||
} | ||
|
||
// If user is blocked, check special permission. | ||
if ($user->isBlocked()) { | ||
return AccessResult::allowedIfHasPermissions($account, ['view blocked user']); | ||
} | ||
|
||
// Check if current page is from logged user. | ||
if ($account->id() === $user->id()) { | ||
return AccessResult::allowedIfHasPermissions($account, ['view own profile profile']); | ||
} | ||
|
||
// Check if logged user can view all profiles. | ||
return AccessResult::allowedIfHasPermissions($account, ['view any profile profile']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this logic differ from what would be evaluated if we called $profile->access('view', $account);
?
What happens if other modules change when a user can be viewed by using Drupal's access APIs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I debugged with entity-access instead of custom-access and I found where and why the isn't give access.
The validation happen here: html/core/lib/Drupal/Core/Entity/EntityAccessCheck.php:65
The code try to found a parameter with profile, but the view has user as parameter, so to work we need to add this on view.
badf9d0
to
6c5b246
Compare
6c5b246
to
c578657
Compare
c578657
to
90ef4d0
Compare
Tugboat has finished building the preview for this pull request! Link: Dashboard: |
Problem (for internal)
Non verified user can't access they own profile information page.
Solution (for internal)
I created a custom Access View for check the access for User Information page.
Release notes (to customers)
Fixed the access for non-verified user on Profile User Information page.
Issue tracker
PROD-31305
Theme issue tracker
N/A
How to test
Change Record
N/A
Translations
N/A