Skip to content
Snippets Groups Projects
Commit 08103b61 authored by pabois's avatar pabois
Browse files

roles

parent fe3bbe24
No related branches found
No related tags found
No related merge requests found
......@@ -32,9 +32,12 @@ class Ability
def teacher
can :manage, University::Person, user_id: @user.id
# can :read, University::Person, university_id: @user.university_id
cannot :create, University::Person
can :read, Education::Program, university_id: @user.university_id
can :read, University::Role, university_id: @user.university_id
can :manage, University::Person::Involvement, person_id: @user.person&.id
can :read, University::Person::Involvement, university_id: @user.university_id
end
def program_manager
......
......@@ -2,5 +2,5 @@
<%= render 'admin/education/program/roles/list', roles: @roles %>
<% content_for :action_bar_right do %>
<%= link_to t('add'), new_admin_education_program_role_path(program_id: @program.id), class: button_classes %>
<%= link_to t('add'), new_admin_education_program_role_path(program_id: @program.id), class: button_classes if can? :create, University::Role %>
<% end %>
......@@ -11,7 +11,7 @@
<% involvements.each do |involvement| %>
<tr>
<td class="ps-0">
<%= involvement %>
<%= link_to_if can?(:read, involvement.person), involvement.person.to_s, admin_university_person_path(involvement.person) %>
</td>
<td><%= involvement.description %></td>
<td class="text-end pe-0">
......
......@@ -20,7 +20,7 @@
role,
admin_education_program_role_path(role, { program_id: @program.id }) %>
</td>
<td><%= role.involvements.includes(:person).ordered.map { |involvement| involvement.person.to_s }.to_sentence %></td>
<td><%= role.involvements.includes(:person).ordered.map { |involvement| link_to_if can?(:read, involvement.person), involvement.person.to_s, admin_university_person_path(involvement.person) }.to_sentence.html_safe %></td>
</tr>
<% end %>
</tbody>
......
......@@ -16,7 +16,7 @@
<% @teacher_involvements.each do |involvement| %>
<tr>
<td class="ps-0">
<%= involvement %>
<%= link_to_if can?(:read, involvement.person), involvement.person.to_s, admin_university_person_path(involvement.person) %>
</td>
<td><%= involvement.description %></td>
</tr>
......
......@@ -15,12 +15,12 @@
<div class="btn-group" role="group">
<%= link_to t('edit'),
edit_admin_university_person_path(person),
class: button_classes %>
class: button_classes if can?(:update, person) %>
<%= link_to t('delete'),
admin_university_person_path(person),
method: :delete,
data: { confirm: t('please_confirm') },
class: button_classes_danger %>
class: button_classes_danger if can?(:destroy, person) %>
</div>
</td>
</tr>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment