Add contract strategy for BCF module

pull/9957/head
Henriette Darge 3 years ago
parent bfb0d9167a
commit c3c77d1ea4
  1. 3
      frontend/src/app/features/work-packages/components/wp-list/wp-query-view.service.ts
  2. 24
      modules/bim/app/contracts/bim/ifc_models/views/contract_strategy.rb
  3. 3
      modules/bim/lib/open_project/bim/engine.rb

@ -39,6 +39,9 @@ export class WorkPackagesQueryViewService {
if (this.$state.includes('team_planner')) {
return 'team_planner';
}
if (this.$state.includes('bim')) {
return 'BCF';
}
throw new Error('Not on a path defined for query views');
}

@ -0,0 +1,24 @@
module ::Bim
module Views
class ContractStrategy < ::BaseContract
validate :manageable
private
def manageable
return if model.query.blank?
errors.add(:base, :error_unauthorized) unless query_permissions?
end
def query_permissions?
# TODO: This currently does not differentiate between public and private queries since it isn't specified yet.
user_allowed_on_query?(:manage_ifc_models)
end
def user_allowed_on_query?(permission)
user.allowed_to?(permission, model.query.project, global: model.query.project.nil?)
end
end
end
end

@ -100,6 +100,9 @@ module OpenProject::Bim
end
end
add_view :BCF,
contract_strategy: 'Bim::Views::ContractStrategy'
class_inflection_override('v2_1' => 'V2_1')
assets %w(bim/logo_openproject_bim_big.png)

Loading…
Cancel
Save