Sha256: e7b1c06109a816e26a2739fc4845705e4315a9091d6f74559a98e9f5379bf4f4
Contents?: true
Size: 723 Bytes
Versions: 4
Compression:
Stored size: 723 Bytes
Contents
# frozen_string_literal: true module Decidim module Initiatives module Abilities # Defines the abilities for non logged users.. # Intended to be used with `cancancan`. class NonLoggedUserAbility include CanCan::Ability attr_reader :context def initialize(user, context) return if user @context = context can :create, Initiative if creation_enabled? can :vote, Initiative can :request_membership, Initiative do |initiative| !initiative.published? end end private def creation_enabled? Decidim::Initiatives.creation_enabled end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems