-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure a users own tasks are the only ones returned when the users ro…
…le has View/My Tasks Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1639387
- Loading branch information
Showing
3 changed files
with
55 additions
and
10 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
module Api | ||
class TasksController < BaseController | ||
def find_collection(klass) | ||
return klass.where(:userid => [current_user.userid]) if current_user.only_my_user_tasks? | ||
|
||
klass.all | ||
end | ||
|
||
def find_resource(klass, key_id, id) | ||
return klass.find_by(key_id => id, :userid => [current_user.userid]) if current_user.only_my_user_tasks? | ||
|
||
key_id == "id" ? klass.find(id) : klass.find_by(key_id => id) | ||
end | ||
end | ||
end |
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