Class: Todos::AllowedTargetFilterService
- Inherits:
-
Object
- Object
- Todos::AllowedTargetFilterService
- Includes:
- Gitlab::Allowable
- Defined in:
- app/services/todos/allowed_target_filter_service.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(todos, current_user) ⇒ AllowedTargetFilterService
constructor
A new instance of AllowedTargetFilterService.
Methods included from Gitlab::Allowable
Constructor Details
#initialize(todos, current_user) ⇒ AllowedTargetFilterService
Returns a new instance of AllowedTargetFilterService.
7 8 9 10 11 |
# File 'app/services/todos/allowed_target_filter_service.rb', line 7 def initialize(todos, current_user) @todos = todos @current_user = current_user @project_can_read_by_id = {} end |
Instance Method Details
#execute ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/services/todos/allowed_target_filter_service.rb', line 13 def execute Preloaders::ProjectPolicyPreloader.new(projects, @current_user).execute @todos.select do |todo| can_read_target_project?(todo) && can?(@current_user, :read_todo, todo) end end |