Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only allow admins to change course editors #610

Merged
merged 7 commits into from
Apr 9, 2024
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
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
//////////////////////////////////////
"cSpell.words": [
"commontator",
"helpdesk",
"turbolinks"
]
}
13 changes: 6 additions & 7 deletions app/controllers/courses_controller.rb
fosterfarrell9 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,12 @@ def set_course_admin
end

def course_params
params.require(:course).permit(:title, :short_title, :organizational,
:organizational_concept, :locale,
:term_independent, :image,
tag_ids: [],
preceding_course_ids: [],
editor_ids: [],
division_ids: [])
allowed_params = [:title, :short_title, :organizational,
:organizational_concept, :locale,
:term_independent, :image,
{ tag_ids: [], preceding_course_ids: [], division_ids: [] }]
allowed_params.push(editor_ids: []) if current_user.admin?
params.require(:course).permit(allowed_params)
end

def tag_params
Expand Down
3 changes: 3 additions & 0 deletions app/views/courses/_basics.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
</div>
<% else %>
<%= t('basics.editors') %>
<%= helpdesk(t('admin.course.info.no_right_to_change_editors',
project_email: mail_to(DefaultSetting::PROJECT_EMAIL)),
true) %>
<ul>
<% course.editors.each do |e| %>
<li>
Expand Down
4 changes: 4 additions & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,10 @@ de:
das Modul bearbeiten, insbesondere können sie Veranstaltungen innerhalb
des Moduls anlegen. ModuleditorInnen erben die Bearbeitungsrechte für
alle Veranstaltungen innerhalb des Moduls.
no_right_to_change_editors: >
ModuleditorInnen können nur von AdministratorInnen geändert werden.
Bitte wende Dich per Email an %{project_email}, wenn hier
eine Änderung vorgenommen werden soll.
preceding_courses: >
Hier kannst Du angeben, auf welchen Modulen das
vorliegende Modul aufbaut.
Expand Down
4 changes: 4 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,10 @@ en:
in particular they can create event series within the course. Every course
editor inherits editing access for all event series belonging to the
course.
no_right_to_change_editors: >
Course editors can only be changed by administrators.
Please contact %{project_email} by email if you want a change to be made
here.
preceding_courses: >
Here you can enter which courses this course builds upon.
E.g., Linear Algebra 1 and Linear Algebra 2 might be preceding
Expand Down