gitlab-org--gitlab-foss/app/services
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
..
auth Fix private method visibility in container registry 2016-07-19 15:12:06 +02:00
boards Fix issue boards leak private label names and descriptions 2016-08-29 16:04:28 -03:00
ci Block concurrent pipeline processings 2016-08-31 17:22:01 +02:00
commits Revert "Revert "Merge branch '18193-developers-can-merge' into 'master' "" 2016-07-18 10:16:56 +02:00
files Prevents accidental overwrites of commits from UI 2016-08-15 02:34:55 +00:00
groups
issues Merge branch '4273-slash-commands' into 'master' 2016-08-18 16:41:16 -05:00
members Ensure last group owner isn't removed on expiry 2016-08-18 21:32:42 +01:00
merge_requests Merge branch '19315-can-edit-merge-request-with-deleted-fork' into 'master' 2016-08-30 17:43:15 +00:00
milestones
notes Merge branch 'master' into 4273-slash-commands 2016-08-16 17:49:53 -05:00
oauth2
projects Fix specs and implement fixes based on failing specs 2016-08-17 17:54:24 -05:00
protected_branches Backport changes from gitlab-org/gitlab-ee!581 to CE. 2016-08-16 11:05:14 +05:30
search
slash_commands Fix behavior around commands with optional arguments 2016-08-18 14:29:49 -05:00
wiki_pages
akismet_service.rb Further refactor and syntax fixes. 2016-08-15 17:20:57 -05:00
audit_event_service.rb
base_service.rb remove Ability.abilities 2016-08-30 11:35:06 -07:00
compare_service.rb switch from diff_file_collection to diffs 2016-08-03 07:00:20 +02:00
create_branch_service.rb Fix of 'Commits being passed to custom hooks are already reachable when using the UI' 2016-07-19 07:45:22 +03:00
create_deployment_service.rb
create_release_service.rb
create_snippet_service.rb
create_tag_service.rb
delete_branch_service.rb Simplify the name for data builder, feedback: 2016-08-12 16:09:29 +08:00
delete_tag_service.rb Simplify the name for data builder, feedback: 2016-08-12 16:09:29 +08:00
delete_user_service.rb Fix bug where destroying a namespace would not always destroy projects 2016-08-11 15:36:35 -07:00
destroy_group_service.rb Fix bug where destroying a namespace would not always destroy projects 2016-08-11 15:36:35 -07:00
event_create_service.rb
git_hooks_service.rb
git_push_service.rb Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into pipeline-hooks-without-slack 2016-08-16 21:17:15 +01:00
git_tag_push_service.rb Simplify the name for data builder, feedback: 2016-08-12 16:09:29 +08:00
gravatar_service.rb
ham_service.rb Further refactor and syntax fixes. 2016-08-15 17:20:57 -05:00
import_export_clean_up_service.rb using shared path for project import uploads and refactored gitlab remove export worker 2016-08-04 12:51:55 +02:00
issuable_base_service.rb if issue is not valid we revert back to the old labels when updating 2016-08-30 18:39:03 +01:00
notification_service.rb Fix notification_service argument error of declined invitation emails 2016-08-19 13:18:13 +02:00
repair_ldap_blocked_user_service.rb
repository_archive_clean_up_service.rb using shared path for project import uploads and refactored gitlab remove export worker 2016-08-04 12:51:55 +02:00
spam_service.rb Further refactor and syntax fixes. 2016-08-15 17:20:57 -05:00
system_hooks_service.rb
system_note_service.rb Capitalize mentioned issue timeline notes 2016-08-25 10:47:40 -05:00
test_hook_service.rb Simplify the name for data builder, feedback: 2016-08-12 16:09:29 +08:00
todo_service.rb Add specs to ensure a successful return 2016-08-25 06:46:11 +02:00
update_release_service.rb
update_snippet_service.rb
user_agent_detail_service.rb Further refactor and syntax fixes. 2016-08-15 17:20:57 -05:00