Versionen für Gemfile, Für Debug Rechteverwaltung deaktiviert

This commit is contained in:
Andreas Stephanides
2013-02-14 07:32:02 +01:00
parent 247c9c675a
commit 154e338360
2 changed files with 32 additions and 16 deletions

22
Gemfile
View File

@@ -6,7 +6,7 @@ gem 'rails', '3.2.9'
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'execjs'
gem 'execjs', '~>1.4.0'
# Gems used only for assets and not required
@@ -14,7 +14,7 @@ gem 'execjs'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass','~> 2.2.0'
gem 'bootstrap-sass','~> 2.2.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
gem 'therubyracer', :platforms => :ruby
@@ -40,16 +40,24 @@ gem 'jquery-rails'
# gem 'debugger'
# Formbuilder for easier form generation
gem 'formtastic'
gem 'formtastic', '~>2.2.1'
gem 'formtastic-bootstrap'
gem "tinymce-rails"
gem "tinymce-rails" , '>=3.5.8'
gem "globalize3"
# Internationalisierung
gem "globalize3" ,'~>0.3.0'
gem "paper_trail"
# Version controll
gem "paper_trail" , '>=2.7.0'
gem "devise"
# User management
gem "devise" ,'~>2.2.3'
# Roles for users
gem "rolify"
# Abilities
gem "cancan"
# Fileupload
gem 'paperclip' ,'~>3.4.0'

View File

@@ -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