Sha256: 06e48de41113a0bd93164e1ef24a09f33b44a4cdae7268193ea3753c3b7e060b

Contents?: true

Size: 513 Bytes

Versions: 18

Compression:

Stored size: 513 Bytes

Contents

### context_roles.rb
#
# Defines the context roles for the CBAC system
#
include Cbac

# Defining context roles
ContextRole.add :not_logged_in_user, 'current_user == 0'
ContextRole.add :logged_in_user, 'current_user.to_i > 0'
ContextRole.add :everybody, "true"
ContextRole.add :news_owner do
  context[:post].user.id == current_user
end

ContextRole.add :news_owner_with_email do
  return false if News.find(params[:id]).author_id == current_user
  return false if User.find(current_user).email.nil?
  true
end


Version data entries

18 entries across 9 versions & 1 rubygems

Version Path
cbac-0.8.0 context_roles.rb
cbac-0.8.0 config/cbac/context_roles.rb
cbac-0.7.0 context_roles.rb
cbac-0.7.0 config/cbac/context_roles.rb
cbac-0.6.10 config/cbac/context_roles.rb
cbac-0.6.10 context_roles.rb
cbac-0.6.9 config/cbac/context_roles.rb
cbac-0.6.9 context_roles.rb
cbac-0.6.8 config/cbac/context_roles.rb
cbac-0.6.8 context_roles.rb
cbac-0.6.7 config/cbac/context_roles.rb
cbac-0.6.7 context_roles.rb
cbac-0.6.5 config/cbac/context_roles.rb
cbac-0.6.5 context_roles.rb
cbac-0.6.4 context_roles.rb
cbac-0.6.4 config/cbac/context_roles.rb
cbac-0.6.2 context_roles.rb
cbac-0.6.2 config/cbac/context_roles.rb