Rechteverwaltung Start

This commit is contained in:
Andreas Stephanides
2013-08-13 22:21:45 +02:00
parent 746aff8fa4
commit 81c46e28b9
3 changed files with 27 additions and 8 deletions

View File

@@ -3,7 +3,11 @@ class UsersController < ApplicationController
@users = User.all
end
def add_role
@user.find(params[:id])
@user= User.find(params[:id])
@user.add_role(params[:role])
end
def do_confirm
@user= User.find(params[:id])
@user.confirm!
end
end

View File

@@ -27,13 +27,23 @@ class Ability
# For Debug allow everything
# Remove this line in production environment and for testing user management
can :manage, :all
# can :manage, :all
can [:show, :index], :all
# Rechteverwaltung f<>r Studien Modul
can :read, Modulgruppe
can :manage, Modulgruppe
# Rechteverwaltung Kalender
can [:show, :index], Calendar
can [:show], Calentry
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
can [:edit, :update,:new,:create,:verwalten], Calendar
can [:edit, :update,:new,:create,:verwalten], Calentry
end
if( user.has_role?("fetadmin"))
can [:delete],Calendar
can [:delete],Calentry
end
# Rechteverwaltung fuer Neuigkeiten

View File

@@ -5,12 +5,17 @@
</ul>
<table class="table table-striped">
<% @users.each do |user|%>
<tr><th>Name</th><th>E-Mail</th><th>Rollen</th>
</tr><tr><td></td>
<tr><th>E-Mail</th><th>Rollen</th><th>Actions</th>
</tr><tr>
<td>
<%= user.email %></td><td><ul>
<% user.roles.each do |role| %>
<li><%= role.name%></li>
<% end %></ul></td><td><%= link_to 'MK FETUSER', user_add_role_path(user, "fetadmin")%></td>
<% end %></ul></td>
<td>
<%= link_to 'MK fetadmin', user_add_role_path(user, "fetadmin")%>
<%= link_to 'MK fetuser', user_add_role_path(user, "fetuser")%>
<%= link_to 'doconfirm', user_do_confirm_path(user)%>
</td>
</tr><% end %>
</table>