Sha256: 658f1546f2f5fa85fa08bf19caefdc56cc7e59b28d7b2218b385ffbc472276f6
Contents?: true
Size: 843 Bytes
Versions: 29
Compression:
Stored size: 843 Bytes
Contents
class Eco::API::Common::People::DefaultParsers::PolicyGroupsParser < Eco::API::Common::Loaders::Parser attribute "policy_group_ids" def parser(hash, deps) policy_group_ids = [] if policy_ids = hash["policy_group_ids"] policy_group_ids = policy_ids.split("|").map do |name| policy_groups.to_id(name&.downcase.strip) end.compact end policy_group_ids.empty?? default_id : policy_group_ids.join("|") end def serializer(person, deps) ids = person&.account&.policy_group_ids || [] ids.map do |id| policy_groups.to_name(id) end.compact.join("|") end private def policy_groups @policy_groups ||= ASSETS.config.policy_groups end def default_id @default_id ||= policy_groups.to_id(ASSETS.config.people.default_usergroup) end end
Version data entries
29 entries across 29 versions & 1 rubygems