Module: Hyrax::Ability::PermissionTemplateAbility

Defined in:
app/models/concerns/hyrax/ability/permission_template_ability.rb

Instance Method Summary collapse

Instance Method Details

#permission_template_abilitiesObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/concerns/hyrax/ability/permission_template_ability.rb', line 5

def permission_template_abilities
  if admin?
    can :manage, [Hyrax::PermissionTemplate, Hyrax::PermissionTemplateAccess]
  else
    can [:create, :edit, :update, :destroy], Hyrax::PermissionTemplate do |template|
      test_edit(template.source_id)
    end
    can [:create, :edit, :update, :destroy], Hyrax::PermissionTemplateAccess do |access|
      test_edit(access.permission_template.source_id)
    end
  end
end