forked from bofh/fetsite
Merge /home/andis/fetsite
This commit is contained in:
@@ -21,7 +21,7 @@ class HomeController < ApplicationController
|
|||||||
|
|
||||||
end
|
end
|
||||||
def infoscreen
|
def infoscreen
|
||||||
authorize! :doadmin, User
|
authorize! :infoscreen, User
|
||||||
@neuigkeiten = Neuigkeit.accessible_by(current_ability, :show).where(flag_infoscreen: true)
|
@neuigkeiten = Neuigkeit.accessible_by(current_ability, :show).where(flag_infoscreen: true)
|
||||||
render layout: false
|
render layout: false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
require 'ipaddr'
|
||||||
class Ability
|
class Ability
|
||||||
include CanCan::Ability
|
include CanCan::Ability
|
||||||
def initialize(user,request=nil,key=nil)
|
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?)
|
loggedin=!(user.nil?)
|
||||||
unless key.nil?
|
unless key.nil?
|
||||||
k=Key.find_by_uuid(key)
|
k=Key.find_by_uuid(key)
|
||||||
@@ -10,6 +13,9 @@ class Ability
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
user ||= User.new # guest user (not logged in)
|
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"))
|
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
|
||||||
can [:show,:answer, :create,:new, :create_from_template, :flag], Survey::Question
|
can [:show,:answer, :create,:new, :create_from_template, :flag], Survey::Question
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
<div class="pull-left" href="#">
|
<div class="pull-left" href="#">
|
||||||
<% unless n.picture_robust.big_thumb.to_s.empty? %>
|
<% 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>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<h1>
|
<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 %>
|
<%= raw(n.title) %> <%#= link_to fa_icon("edit"), edit_rubrik_neuigkeit_path(n.rubrik, n), remote: true if can? :edit, n %>
|
||||||
</h1>
|
</h1>
|
||||||
<div itemprop="articleBody" style="font-size:large">
|
<div itemprop="articleBody" style="font-size:large">
|
||||||
<%= raw(n.text) %>
|
<%= raw(n.text_first_words) %>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user