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
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
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
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
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
help_controller_spec.rb Fix failing spec on help controller 2016-07-22 11:49:09 +03:00
invites_controller_spec.rb
namespaces_controller_spec.rb
notification_settings_controller_spec.rb
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
sent_notifications_controller_spec.rb
sessions_controller_spec.rb
snippets_controller_spec.rb
uploads_controller_spec.rb
users_controller_spec.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00