lib/eco/api/session.rb in eco-helpers-2.0.16 vs lib/eco/api/session.rb in eco-helpers-2.0.17
- old
+ new
@@ -59,31 +59,12 @@
def schema=(value)
@schema = to_schema(value)
self
end
- # Builds the presets using the usergroup ids of the input.
- # @note for each flag/ability it will take the highest among those mapped for the present usergroups.
- # @param input [Ecoportal::API::Internal::Person, Array<String>] the array should be of usegroup names or ids.
- # @return [Hash] with custom presets.
- def new_preset(input)
- case input
- when Ecoportal::API::Internal::Person
- presets_factory.new(*input&.account&.policy_group_ids)
- when Array
- presets_factory.new(*input)
- else
- presets_factory.new(input)
- end
- end
-
# Helper to state the abilities that a person should have with given their usergroups
def presets_factory
- @presets_factory ||= Eco::API::Organization::PresetsFactory.new({
- presets_custom: file_manager.dir.file(config.people.presets_custom, should_exist: true),
- presets_map: file_manager.dir.file(config.people.presets_map, should_exist: true),
- enviro: enviro
- })
+ @presets_factory ||= Eco::API::Organization::PresetsFactory.new(enviro: enviro)
end
# Helper to obtain a EntryFactory
# @param schema [String, Ecoportal::API::V1::PersonSchema] `schema` to which associate the EntryFactory,
# where `String` can be the _name_ or the _id_ of the schema.