diff options
author | Stan Hu <stanhu@gmail.com> | 2018-07-20 16:31:14 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-07-20 16:31:14 -0700 |
commit | 48ea89af121bdf627fc08673f9203e5f05dc0776 (patch) | |
tree | 52ab1338ae9a626158189bd01e9ba70c1497aada /app/models | |
parent | 33c319508e3e554db6c6d673cb0f564262133e06 (diff) | |
parent | 4271f448c85f6a3dc50728a4b77d7d57474bac6f (diff) | |
download | gitlab-ce-48ea89af121bdf627fc08673f9203e5f05dc0776.tar.gz |
Merge branch 'master' into sh-support-bitbucket-server-import
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/protected_ref_access.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/concerns/protected_ref_access.rb b/app/models/concerns/protected_ref_access.rb index 71b0c3468b9..5ff7b41b82b 100644 --- a/app/models/concerns/protected_ref_access.rb +++ b/app/models/concerns/protected_ref_access.rb @@ -17,6 +17,11 @@ module ProtectedRefAccess scope :master, -> { maintainer } # @deprecated scope :maintainer, -> { where(access_level: Gitlab::Access::MAINTAINER) } scope :developer, -> { where(access_level: Gitlab::Access::DEVELOPER) } + scope :by_user, -> (user) { where(user_id: user ) } + scope :by_group, -> (group) { where(group_id: group ) } + scope :for_role, -> { where(user_id: nil, group_id: nil) } + scope :for_user, -> { where.not(user_id: nil) } + scope :for_group, -> { where.not(group_id: nil) } validates :access_level, presence: true, if: :role?, inclusion: { in: ALLOWED_ACCESS_LEVELS |