gitlab-org--gitlab-foss/app/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 Handle unavailable system info 2016-08-25 08:28:35 +01:00
ci
concerns prevent authored awardable thumbs votes 2016-08-30 20:57:47 +01:00
dashboard Merge branch 'issue_18135' into 'master' 2016-08-19 23:06:30 +00:00
explore
groups Add expiration date to group memberships 2016-08-18 21:09:17 +01:00
import Remove gitorious 2016-08-25 10:10:10 +01:00
oauth
profiles Address review comments from @smcgivern. 2016-08-18 22:12:02 +05:30
projects add specs for tags finder 2016-08-31 19:16:47 +01:00
sherlock
abuse_reports_controller.rb
application_controller.rb remove Ability.abilities 2016-08-30 11:35:06 -07:00
autocomplete_controller.rb Move to project dropdown with infinite scroll for better performance 2016-08-17 07:33:51 +02:00
confirmations_controller.rb
dashboard_controller.rb
emojis_controller.rb
groups_controller.rb
health_check_controller.rb
help_controller.rb
invites_controller.rb
jwt_controller.rb
koding_controller.rb Split Koding admin/user docs 2016-08-22 17:09:15 +03:00
namespaces_controller.rb test if we can :read_group the group, not the namespace 2016-08-30 11:39:22 -07:00
notification_settings_controller.rb
omniauth_callbacks_controller.rb
passwords_controller.rb
profiles_controller.rb
projects_controller.rb Renamed `enable_lfs` to `lfs_enabled` for the Project field, and related fixes. 2016-08-30 17:17:45 -05:00
registrations_controller.rb
root_controller.rb
search_controller.rb
sent_notifications_controller.rb
sessions_controller.rb
snippets_controller.rb
uploads_controller.rb
users_controller.rb