Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Author versus Admin views on puzzles #148
Author versus Admin views on puzzles #148
Changes from 1 commit
b74d8d9
db9c017
79646c1
3f24e4e
d39ea8f
60f20c2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This should be handled through the authorization policy. Give me a little time now that I'm not visiting family and I'll get those changes merged in.
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.
Thanks for checking in the authorization stuff - which parts of this can the authorization policy handle?
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.
https://docs.microsoft.com/en-us/aspnet/core/security/authorization/views?view=aspnetcore-2.2&tabs=aspnetcore2x
For example, in this case you'd have an attribute on the StatusModel page that's [Authorize(Policy = "IsEventAdminOrEventAuthor")]
The base class & child classes need an IAuthorizationService passed into the constructor (I believe asp.net handles getting that to them, it just needs to be requested).
Then to see if someone is the author of a puzzle you'd do a check against the policy:
bool isAuthorized = await AuthorizationService.AuthorizeAsync(User, "IsAuthorOfPuzzle"); (I don't have the exact syntax in front of me and we have people who just arrived for dinner, but if you can't find it let me know and I'll track it down after dinner)
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 see the example of an [Authorize] attribute on event create, and I see the example of AuthorizeAsync() in the link you provided - but this comment suggests that I need both at all times, and neither example appears to use both. Do I need to use both mechanisms at the same time, or do I choose only one at a time depending on need?