-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix time tracker permissions #150
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CuddlyBunion341
commented
Oct 9, 2024
Comment on lines
9
to
13
def verify_permission! | ||
return unless User.current | ||
return if User.current.allowed_to_globally?(action: action_name.to_sym, controller: controller_name.to_s) | ||
return if User.current&.allowed_to_globally?(action: action_name.to_sym, controller: controller_name.to_s) | ||
|
||
render_403(flash: { error: t('timer_sessions.messages.errors.permission.no_access') }) | ||
end |
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.
Does the 403 get rendered because of the plugin initializer?
CuddlyBunion341
commented
Oct 9, 2024
@@ -19,8 +19,8 @@ class TimeTrackerControllerTest < ActionController::TestCase | |||
:custom_fields, :custom_fields_projects, :custom_fields_trackers, :custom_values | |||
|
|||
def setup | |||
@controller.logged_user = User.find(1) | |||
@request.session[:user_id] = 1 | |||
@controller.logged_user = User.find(2) |
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.
Test on a user with an associated project, instead of the administrator.
4c7f161
to
b49fdfc
Compare
schmijos
approved these changes
Oct 15, 2024
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
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.
Testing on develop showed that timer sessions cannot be managed by regular user accounts.
In the refactoring PR #142, I forgot to update the controller permissions in the plugin initializer.
Because the tests used the admin user and because the local testing was also done with the admin account, this issue never showed up.
Todo