Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Ability
include CanCan::Ability

def initialize(user)
define_common_non_student_abilities(user)
define_common_abilities

return unless user

Expand All @@ -22,9 +22,7 @@ def initialize(user)

private

def define_common_non_student_abilities(user)
return if user&.student?

def define_common_abilities
# Anyone can view projects not owned by a user or a school.
can :show, Project, user_id: nil, school_id: nil
can :show, Component, project: { user_id: nil, school_id: nil }
Expand Down
2 changes: 1 addition & 1 deletion spec/models/ability_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@

context 'with a starter project' do
it { is_expected.not_to be_able_to(:index, starter_project) }
it { is_expected.not_to be_able_to(:show, starter_project) }
it { is_expected.to be_able_to(:show, starter_project) }
it { is_expected.not_to be_able_to(:create, starter_project) }
it { is_expected.not_to be_able_to(:update, starter_project) }
it { is_expected.not_to be_able_to(:destroy, starter_project) }
Expand Down
Loading