summaryrefslogtreecommitdiff
path: root/app/models/ability.rb
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2016-08-16 14:09:44 -0700
committerhttp://jneen.net/ <jneen@jneen.net>2016-08-30 11:39:22 -0700
commit3fdcebfdda31b0cc0f5641489bb4066b1f815df3 (patch)
tree5fbbc121af98b7f0c72ea0d8659ecb4779d56b7f /app/models/ability.rb
parentd87c1d550f4870275432698e3cb19033c6855a15 (diff)
downloadgitlab-ce-3fdcebfdda31b0cc0f5641489bb4066b1f815df3.tar.gz
trim dead code
Diffstat (limited to 'app/models/ability.rb')
-rw-r--r--app/models/ability.rb81
1 files changed, 0 insertions, 81 deletions
diff --git a/app/models/ability.rb b/app/models/ability.rb
index ac5e82c14d2..323597c8888 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -73,7 +73,6 @@ class Ability
def abilities_by_subject_class(user:, subject:)
case subject
- when ProjectSnippet then project_snippet_abilities(user, subject)
when PersonalSnippet then personal_snippet_abilities(user, subject)
when Group then group_abilities(user, subject)
when Namespace then namespace_abilities(user, subject)
@@ -140,13 +139,6 @@ class Ability
end
end
- def anonymous_commit_status_abilities(subject)
- rules = anonymous_project_abilities(subject.project)
- # If subject is Ci::Build which inherits from CommitStatus filter the abilities
- rules = filter_build_abilities(rules) if subject.is_a?(Ci::Build)
- rules
- end
-
def anonymous_group_abilities(subject)
rules = []
@@ -169,14 +161,6 @@ class Ability
end
end
- def anonymous_project_snippet_abilities(snippet)
- if snippet.public?
- [:read_project_snippet]
- else
- []
- end
- end
-
def anonymous_user_abilities
[:read_user] unless restricted_public_level?
end
@@ -248,46 +232,6 @@ class Ability
rules.flatten
end
- [:issue, :merge_request].each do |name|
- define_method "#{name}_abilities" do |user, subject|
- rules = []
-
- if subject.author == user || (subject.respond_to?(:assignee) && subject.assignee == user)
- rules += [
- :"read_#{name}",
- :"update_#{name}",
- ]
- end
-
- rules += project_abilities(user, subject.project)
- rules = filter_confidential_issues_abilities(user, subject, rules) if subject.is_a?(Issue)
- rules
- end
- end
-
- def note_abilities(user, note)
- rules = []
-
- if note.author == user
- rules += [
- :read_note,
- :update_note,
- :admin_note,
- :resolve_note
- ]
- end
-
- if note.respond_to?(:project) && note.project
- rules += project_abilities(user, note.project)
- end
-
- if note.for_merge_request? && note.noteable.author == user
- rules << :resolve_note
- end
-
- rules
- end
-
def personal_snippet_abilities(user, snippet)
rules = []
@@ -306,24 +250,6 @@ class Ability
rules
end
- def project_snippet_abilities(user, snippet)
- rules = []
-
- if snippet.author == user || user.admin?
- rules += [
- :read_project_snippet,
- :update_project_snippet,
- :admin_project_snippet
- ]
- end
-
- if snippet.public? || (snippet.internal? && !user.external?) || (snippet.private? && snippet.project.team.member?(user))
- rules << :read_project_snippet
- end
-
- rules
- end
-
def group_member_abilities(user, subject)
rules = []
target_user = subject.user
@@ -362,13 +288,6 @@ class Ability
rules
end
- def commit_status_abilities(user, subject)
- rules = project_abilities(user, subject.project)
- # If subject is Ci::Build which inherits from CommitStatus filter the abilities
- rules = filter_build_abilities(rules) if subject.is_a?(Ci::Build)
- rules
- end
-
def filter_build_abilities(rules)
# If we can't read build we should also not have that
# ability when looking at this in context of commit_status