forked from bofh/fetsite
Abilities für Rollenvergabe
This commit is contained in:
@@ -4,7 +4,13 @@ class UsersController < ApplicationController
|
|||||||
end
|
end
|
||||||
def add_role
|
def add_role
|
||||||
@user= User.find(params[:id])
|
@user= User.find(params[:id])
|
||||||
|
if (params[:role]=="fetuser" && can?(:addfetuser,User))
|
||||||
@user.add_role(params[:role])
|
@user.add_role(params[:role])
|
||||||
|
end
|
||||||
|
if (params[:role]=="fetadmin" && can?(:addfetadmin,User))
|
||||||
|
@user.add_role(params[:role])
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
def do_confirm
|
def do_confirm
|
||||||
@user= User.find(params[:id])
|
@user= User.find(params[:id])
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ class Ability
|
|||||||
# For Debug allow everything
|
# For Debug allow everything
|
||||||
# Remove this line in production environment and for testing user management
|
# Remove this line in production environment and for testing user management
|
||||||
can :manage, :all
|
can :manage, :all
|
||||||
|
can :addfetuser, User
|
||||||
|
can :addfetadmin, User
|
||||||
can [:show, :index], Studium
|
can [:show, :index], Studium
|
||||||
can [:show, :index], Modulgruppe
|
can [:show, :index], Modulgruppe
|
||||||
can [:show, :index], Modul
|
can [:show, :index], Modul
|
||||||
@@ -39,6 +41,7 @@ class Ability
|
|||||||
|
|
||||||
# Rechteverwaltung Kalender
|
# Rechteverwaltung Kalender
|
||||||
can [:show, :index], Calendar, :public => true
|
can [:show, :index], Calendar, :public => true
|
||||||
|
can [:showics], Calendar
|
||||||
can [:show], Calentry
|
can [:show], Calentry
|
||||||
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user