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

OCC-32: Add Checkout permission #161

Merged
merged 4 commits into from Aug 22, 2022
Merged

OCC-32: Add Checkout permission #161

merged 4 commits into from Aug 22, 2022

Conversation

DemeSzabolcs
Copy link
Contributor

OCC-32

Fixes #154

ICardPaymentService cardPaymentService,
IStringLocalizer<PaymentController> stringLocalizer,
IAuthorizationService authorizationService,
IHttpContextAccessor hca)
Copy link
Contributor

Choose a reason for hiding this comment

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

This class is a Controller. It already had this.HttpContext and this.User so you don't need HCA.

{
var user = _hca.HttpContext?.User;

if (user != null && !await _authorizationService.AuthorizeAsync(user, Permissions.Checkout))
Copy link
Contributor

Choose a reason for hiding this comment

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

HttpContext is never null in an MVC controller, so you don't need to check for that.

@sarahelsaig sarahelsaig merged commit b903f62 into main Aug 22, 2022
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.

Add Checkout permission (OCC-32)
2 participants