summaryrefslogtreecommitdiff
path: root/app/policies
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-17 15:06:17 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-17 15:06:17 +0000
commit238d22c07218adf2b8f3db630ee8b74ca6f29df5 (patch)
tree23fd5f85efef0fb95eb73bf6395d5b7e8c0f1b9f /app/policies
parent6b75320f525f841454f1ab162d141d3610f2e77b (diff)
downloadgitlab-ce-238d22c07218adf2b8f3db630ee8b74ca6f29df5.tar.gz
Add latest changes from gitlab-org/gitlab@masterlist
Diffstat (limited to 'app/policies')
-rw-r--r--app/policies/todo_policy.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/policies/todo_policy.rb b/app/policies/todo_policy.rb
new file mode 100644
index 00000000000..f8644217f04
--- /dev/null
+++ b/app/policies/todo_policy.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class TodoPolicy < BasePolicy
+ desc 'User can only read own todos'
+ condition(:own_todo) do
+ @user && @subject.user_id == @user.id
+ end
+
+ rule { own_todo }.enable :read_todo
+end