ssh_access.rb revision 4551681c4cb82bac457cde91a4cce63e6c070a9b
70N/A 'public_r' => %w{read}, 70N/A 'private_r' => %w{}, 70N/A 'private_rw' => %w{}, 70N/A 'public_r' => %w{}, 70N/A 'public_rw' => %w{}, 70N/A 'private_r' => %w{read}, 70N/A def determine_permission(requested_permission, permission, repository) 70N/A not_a_write_to_mirror_repository!(requested_permission, repository) && 70N/A (allowed_for_everyone?(requested_permission, repository) || 359N/A allowed_for?(requested_permission, repository, through: permission)) 98N/A def write_to_mirror_repository?(requested_permission, repository) 321N/A repository.remote? && requested_permission == 'write' 304N/A def not_a_write_to_mirror_repository!(requested_permission, repository) 325N/A if write_to_mirror_repository?(requested_permission, repository) 320N/A raise InvalidAccessOnMirrorError 346N/A def allowed_for?(requested_permission, repository, through: nil) 347N/A (included_in?(:permission, :all, repository, requested_permission) || 310N/A included_in_role?(through.role.to_sym, requested_permission)) 332N/A def allowed_for_everyone?(requested_permission, repository) 332N/A included_in?(:everyone, repository, requested_permission) 128N/A def included_in?(*groups, repository, requested_permission) 414N/A in_map = groups.reduce(PERMISSION_MAP) { |map, group| map[group] } 326N/A !! in_map[repository.access].try(:include?, requested_permission) 70N/A def included_in_role?(role, requested_permission) 400N/A !! PERMISSION_MAP[:permission][role].try(:include?, requested_permission) 277N/A def extract_permission_params(params, repository) 356N/A key_field = params[:key_id].sub("key-", "") 289N/A requested_permission = params[:permission] 326N/A user = User.joins(:keys). 290N/A where(keys: {id: key_field}).first 90N/A permission = repository.highest_permission(user) if user 295N/A [requested_permission, permission]