Module: ProtectedRefAccess
- Extended by:
- ActiveSupport::Concern
- Included in:
- ProtectedBranchAccess, ProtectedTagAccess
- Defined in:
- app/models/concerns/protected_ref_access.rb
Constant Summary collapse
- HUMAN_ACCESS_LEVELS =
{ Gitlab::Access::MAINTAINER => "Maintainers", Gitlab::Access::DEVELOPER => "Developers + Maintainers", Gitlab::Access::NO_ACCESS => "No one" }.freeze
Instance Method Summary collapse
- #check_access(user) ⇒ Object
- #humanize ⇒ Object
-
#role? ⇒ Boolean
CE access levels are always role-based, where as EE allows groups and users too.
Instance Method Details
#check_access(user) ⇒ Object
45 46 47 48 49 50 |
# File 'app/models/concerns/protected_ref_access.rb', line 45 def check_access(user) return true if user.admin? user.can?(:push_code, project) && project.team.max_member_access(user.id) >= access_level end |
#humanize ⇒ Object
35 36 37 |
# File 'app/models/concerns/protected_ref_access.rb', line 35 def humanize HUMAN_ACCESS_LEVELS[self.access_level] end |
#role? ⇒ Boolean
CE access levels are always role-based, where as EE allows groups and users too
41 42 43 |
# File 'app/models/concerns/protected_ref_access.rb', line 41 def role? true end |