Sha256: 752dd3a0a65bc2562707cb1e8e40251c359de1eac356b6a0de348a31ea9cfb51
Contents?: true
Size: 781 Bytes
Versions: 44
Compression:
Stored size: 781 Bytes
Contents
# frozen_string_literal: true module Decidim module Elections module TrusteeZone class Permissions < Decidim::DefaultPermissions def permissions return permission_action unless permission_action.scope == :trustee_zone case permission_action.subject when :trustee, :election toggle_allow(trustee_for_user?) if [:view, :update].member?(permission_action.action) when :user allow! if permission_action.action == :update_profile end permission_action end private def trustee_for_user? trustee && trustee.user == user end def trustee @trustee ||= context.fetch(:trustee, nil) end end end end end
Version data entries
44 entries across 44 versions & 1 rubygems