summaryrefslogtreecommitdiff
path: root/app/policies/base_policy.rb
blob: 00067ce756e455d2b36d0b6d28f5d8e88bc8b83e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
require 'declarative_policy'

class BasePolicy < DeclarativePolicy::Base
  desc "User is an instance admin"
  with_options scope: :user, score: 0
  condition(:admin) { @user&.admin? }

  with_options scope: :user, score: 0
  condition(:external_user) { @user.nil? || @user.external? }

  with_options scope: :user, score: 0
  condition(:can_create_group) { @user&.can_create_group }
end