gitlab-org--gitlab-foss/spec/controllers
Robert Speicher e71cd7a300 Merge branch 'refactor/add-policies' into 'master'
Refactor ability.rb into Policies

## What does this MR do?
Factors out `ability.rb` into a new abstraction - the "policy" (stored in `app/policies`). A policy is a class named `#{class_name}Policy` (looked up automatically as needed) that implements `rules` as follows:

``` ruby
class ThingPolicy < BasePolicy
  def rules
    @user # this is a user to determine abilities for, optionally nil in the anonymous case
    @subject # this is the subject of the ability, guaranteed to be an instance of `Thing`
    can! :some_ability # grant the :some_ability permission
    cannot! :some_ability # ensure that :some_ability is not allowed. this overrides any `can!` that is called before or after
    delegate! @subject.other_thing # merge the abilities (can!) and prohibitions (cannot!) from `@subject.other_thing`
    can? :some_ability # test whether, so far, :some_ability is allowed
  end

  def anonymous_rules
    # optional. if not implemented `rules` is called where `@user` is nil. otherwise this method is called when `@user` is nil.
  end
end
```

See merge request !5796
2016-08-31 20:53:40 +00:00
..
admin Fix incorrect "stopped impersonation" log message 2016-08-23 01:09:16 -07:00
ci Redirect to root path when visiting `/ci` 2016-03-29 08:04:17 +02:00
groups fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
import Remove gitorious 2016-08-25 10:10:10 +01:00
oauth Use HTTP matchers if possible 2016-06-27 20:10:42 +02:00
profiles fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
projects Merge branch 'refactor/add-policies' into 'master' 2016-08-31 20:53:40 +00:00
abuse_reports_controller_spec.rb Add `AbuseReport#notify` 2016-01-04 18:59:42 -05:00
application_controller_spec.rb fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
autocomplete_controller_spec.rb Move to project dropdown with infinite scroll for better performance 2016-08-18 15:31:51 +02:00
blob_controller_spec.rb Fix Error 500 when viewing a blob with binary characters after the 1024-byte mark 2016-06-12 07:36:25 -07:00
groups_controller_spec.rb This fixes a long running tests due to changed Sidekiq state 2016-08-15 23:26:40 +02:00
health_check_controller_spec.rb Use HTTP matchers if possible 2016-06-27 20:10:42 +02:00
help_controller_spec.rb Fix failing spec on help controller 2016-07-22 11:49:09 +03:00
invites_controller_spec.rb Use HTTP matchers if possible 2016-06-27 20:10:42 +02:00
namespaces_controller_spec.rb Use HTTP matchers if possible 2016-06-27 20:10:42 +02:00
notification_settings_controller_spec.rb Merge branch 'master' into issue_3359_3 2016-06-29 11:32:38 -03:00
projects_controller_spec.rb fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
registrations_controller_spec.rb Assert against `ActionMailer::Base.deliveries` relatively. 2016-07-05 10:20:32 +05:30
root_controller_spec.rb Implementing 'Groups View' and 'TODOs View' as options for dashboard preferences. 2016-03-24 19:59:54 +01:00
sent_notifications_controller_spec.rb Move a few controller specs to their correct locations 2016-02-18 21:50:49 -05:00
sessions_controller_spec.rb Add a U2F-specific audit log entry after logging in. 2016-06-06 12:50:31 +05:30
snippets_controller_spec.rb Use HTTP matchers if possible 2016-06-27 20:10:42 +02:00
uploads_controller_spec.rb Use HTTP matchers if possible 2016-06-27 20:10:42 +02:00
users_controller_spec.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00