-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Admin acts as another user #3525
Conversation
34cfa7b
to
c682823
Compare
app/presenters/listing_presenter.rb
Outdated
@@ -288,5 +289,30 @@ def payments_enabled? | |||
process == :preauthorize | |||
end | |||
|
|||
def acts_as_person | |||
params[:person_id].present? ? Person.find_by!(username: params[:person_id]) : nil |
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.
Might want to add community_id in the find_by!
just in case.
@@ -488,4 +500,8 @@ def create_booking(shape, listing_uuid) | |||
true | |||
end | |||
end | |||
|
|||
def new_listing_author | |||
@new_listing_author ||= params[:person_id].present? ? Person.find_by!(username: params[:person_id]) : @current_user |
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.
Make sure find_by!
also includes community_id!
c682823
to
964a81a
Compare
964a81a
to
8a7d553
Compare
@bladealslayer |
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.
👍 LGTM
@aivils you could still add test case with two marketplaces where admin of one can't post listing as user of another marketplace. |
No description provided.