class Decidim::Meetings::Abilities::CurrentUserAbility

Intended to be used with ‘cancancan`.
Defines the abilities related to meetings for a logged in user.

def authorized?(action)

def authorized?(action)
  return unless feature
  ActionAuthorizer.new(user, feature, action).authorize.ok?
end

def feature

def feature
  feature = context.fetch(:current_feature, nil)
  return nil unless feature && feature.manifest.name == :meetings
  feature
end

def initialize(user, context)

def initialize(user, context)
  return unless user
  @user = user
  @context = context
  can :join, Meeting do |meeting|
    authorized?(:join) && meeting.registrations_enabled?
  end
  can :leave, Meeting, &:registrations_enabled?
end