Versionen für Gemfile, Für Debug Rechteverwaltung deaktiviert
This commit is contained in:
@@ -1,21 +1,13 @@
|
||||
class Ability
|
||||
include CanCan::Ability
|
||||
|
||||
def initialize(user)
|
||||
# Define abilities for the passed in user here. For example:
|
||||
#
|
||||
user ||= User.new # guest user (not logged in)
|
||||
# if user.admin?
|
||||
# can :manage, :all
|
||||
# else
|
||||
# can :read, :all
|
||||
# end
|
||||
can :read, Modulgruppe
|
||||
if user.has_role? "newsadmin"
|
||||
can :manage, Modulgruppe
|
||||
can :addmoderator, Modulgruppe
|
||||
can :addmoderator, Rubrik
|
||||
end
|
||||
# The first argument to `can` is the action you are giving the user permission to do.
|
||||
# If you pass :manage it will apply to every action. Other common actions here are
|
||||
# :read, :create, :update and :destroy.
|
||||
@@ -28,6 +20,22 @@ class Ability
|
||||
#
|
||||
# can :update, Article, :published => true
|
||||
#
|
||||
# See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities
|
||||
# See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilitiescan :manage, :all
|
||||
|
||||
user ||= User.new # guest user (not logged in)
|
||||
|
||||
|
||||
# For Debug allow everything
|
||||
# Remove this line in production environment and for testing user management
|
||||
can :manage, :all
|
||||
|
||||
# Rechteverwaltung f<>r Studien Modul
|
||||
can :read, Modulgruppe
|
||||
if user.has_role? "newsadmin"
|
||||
can :manage, Modulgruppe
|
||||
can :addmoderator, Modulgruppe
|
||||
can :addmoderator, Rubrik
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user