Sha256: bacd7f2f2b794e8493d83e7e2f341e9b33f1285ba457f2814ef93d91c1c1357a
Contents?: true
Size: 699 Bytes
Versions: 7
Compression:
Stored size: 699 Bytes
Contents
# frozen_string_literal: true module Decidim # This class gives a given User access to a given private ParticipatorySpacePrivateUser class ParticipatorySpacePrivateUser < ApplicationRecord belongs_to :user, class_name: "Decidim::User", foreign_key: :decidim_user_id belongs_to :privatable_to, polymorphic: true validate :user_and_participatory_space_same_organization private # Private: check if the participatory space and the user have the same organization def user_and_participatory_space_same_organization return if !privatable_to || !user errors.add(:privatable_to, :invalid) unless user.organization == privatable_to.organization end end end
Version data entries
7 entries across 7 versions & 1 rubygems