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

Admin acts as another user #3525

Merged
merged 6 commits into from
Jan 7, 2019
Merged

Admin acts as another user #3525

merged 6 commits into from
Jan 7, 2019

Conversation

aivils
Copy link
Contributor

@aivils aivils commented Dec 6, 2018

No description provided.

@aivils aivils force-pushed the admin-acts-as-another-user branch from 34cfa7b to c682823 Compare December 21, 2018 07:43
@@ -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
Copy link
Member

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
Copy link
Member

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!

@aivils aivils force-pushed the admin-acts-as-another-user branch from c682823 to 964a81a Compare January 4, 2019 07:00
@aivils aivils force-pushed the admin-acts-as-another-user branch from 964a81a to 8a7d553 Compare January 4, 2019 07:05
@aivils
Copy link
Contributor Author

aivils commented Jan 4, 2019

@bladealslayer
Changes applied in the last commit.

Copy link
Member

@bladealslayer bladealslayer left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@bladealslayer
Copy link
Member

@aivils you could still add test case with two marketplaces where admin of one can't post listing as user of another marketplace.

@aivils aivils merged commit a060d1b into master Jan 7, 2019
@aivils aivils deleted the admin-acts-as-another-user branch January 7, 2019 09:39
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