Skip to content

Commit 417a059

Browse files
committed
Assistants can add asssistants
1 parent 55147ca commit 417a059

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

app/controllers/setup/course_assistants_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class Setup::CourseAssistantsController < Setup::SetupController
22
before_action :set_course
33

44
def index
5-
authorize! :teach, @organization
5+
authorize! :modify_assistants, @course
66
@setup_in_progress = setup_in_progress?
77

88
@assistants = @course.assistants
@@ -17,7 +17,7 @@ def index
1717
end
1818

1919
def create
20-
authorize! :teach, @organization
20+
authorize! :modify_assistants, @course
2121

2222
if params[:commit] == 'Add new assistant'
2323
new_assistant = User.find_by(login: assistant_params[:username])
@@ -43,7 +43,7 @@ def create
4343
end
4444

4545
def destroy
46-
authorize! :remove_assistant, @course
46+
authorize! :modify_assistants, @course
4747
@assistantship = Assistantship.find(params[:id])
4848
destroyed_username = @assistantship.user.login
4949
@assistantship.destroy!

app/models/ability.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ def initialize(user)
239239
can? :teach, o
240240
end
241241

242-
can :remove_assistant, Course do |c|
243-
can? :teach, c.organization
242+
can :modify_assistants, Course do |c|
243+
can? :teach, c
244244
end
245245

246246
can :edit, Organization do |o|

app/views/courses/show.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
<% if can? :manage_exercises, @course %>
144144
<%= link_to 'Manage exercises', manage_exercises_organization_course_path, class: "btn btn-default btn-sm" %>
145145
<% end %>
146-
<% if can? :teach, @organization %>
146+
<% if can? :modify_assistants, @course %>
147147
<%= link_to 'Manage assistants', setup_organization_course_course_assistants_path(@organization, @course), class: "btn btn-default btn-sm" %>
148148
<% end %>
149149
</li>

0 commit comments

Comments
 (0)