Class: ProtectedBranch::PushAccessLevel

Inherits:
ApplicationRecord show all
Includes:
ProtectedBranchAccess
Defined in:
app/models/protected_branch/push_access_level.rb

Constant Summary

Constants included from ProtectedRefAccess

ProtectedRefAccess::HUMAN_ACCESS_LEVELS

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Instance Method Summary collapse

Methods included from ProtectedRefAccess

#humanize, #role?

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from SensitiveSerializableHash

#serializable_hash

Instance Method Details

#check_access(user) ⇒ Object


21
22
23
24
25
26
27
# File 'app/models/protected_branch/push_access_level.rb', line 21

def check_access(user)
  if user && deploy_key.present?
    return user.can?(:read_project, project) && enabled_deploy_key_for_user?(deploy_key, user)
  end

  super
end

#typeObject


13
14
15
16
17
18
19
# File 'app/models/protected_branch/push_access_level.rb', line 13

def type
  if self.deploy_key.present?
    :deploy_key
  else
    super
  end
end