AutoCommit Mon Sep 14 15:54:50 CEST 2015

This commit is contained in:
Andreas Stephanides
2015-09-14 15:54:50 +02:00
parent e15526865d
commit 0337131472
3 changed files with 10 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ class HomeController < ApplicationController
end
def infoscreen
authorize! :doadmin, User
authorize! :infoscreen, User
@neuigkeiten = Neuigkeit.accessible_by(current_ability, :show).where(flag_infoscreen: true)
render layout: false
end

View File

@@ -1,7 +1,10 @@
# -*- coding: utf-8 -*-
require 'ipaddr'
class Ability
include CanCan::Ability
def initialize(user,request=nil,key=nil)
tunet=IPAddr.new("128.131.95.0/24")
local=IPAddr.new("127.0.0.1")
loggedin=!(user.nil?)
unless key.nil?
k=Key.find_by_uuid(key)
@@ -10,6 +13,9 @@ class Ability
end
end
user ||= User.new # guest user (not logged in)
if (user.has_role?("fetuser") || user.has_role?("fetadmin") || tunet.include?(IPAddr.new(request.remote_ip)) || local.include?(IPAddr.new(request.remote_ip)))
can :infoscreen, User
end
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
can [:show,:answer, :create,:new, :create_from_template, :flag], Survey::Question

View File

@@ -18,7 +18,8 @@
<div class="pull-left" href="#">
<% unless n.picture_robust.big_thumb.to_s.empty? %>
<p><br><%= link_to image_tag(n.picture_robust.big_thumb),n.picture_robust.try(:url) %>
<p>
<br><%= link_to image_tag(n.picture_robust.big_thumb),n.picture_robust.try(:url) %>
</p>
<% end %>
<h1>
@@ -42,7 +43,7 @@
<%= raw(n.title) %> <%#= link_to fa_icon("edit"), edit_rubrik_neuigkeit_path(n.rubrik, n), remote: true if can? :edit, n %>
</h1>
<div itemprop="articleBody" style="font-size:large">
<%= raw(n.text) %>
<%= raw(n.text_first_words) %>
</div>