Orbit/app/helpers/admin_helper.rb

37 lines
896 B
Ruby
Raw Permalink Normal View History

2010-01-18 07:52:52 +00:00
module AdminHelper
def show_parent_items_link
@parent_items = @parent_item.ancestors.map{ |i| i }
link_to('/' , admin_items_path) + ( @parent_items.map{ |i| link_to(i.name, admin_items_path(:parent_id=>i.id) ) } << @parent_item.name ).join("/").html_safe
2010-01-18 07:52:52 +00:00
end
# Check if the current_user is manager in current module app
def is_manager?
(@module_app.is_manager?(current_or_guest_user) rescue nil) || is_admin?
end
# Check if the current_user is sub manager in current module app
def is_sub_manager?
(@module_app.is_sub_manager?(current_or_guest_user) rescue nil) || is_admin?
end
def is_admin?
2012-12-03 10:52:36 +00:00
current_or_guest_user.admin? rescue false
end
2012-09-11 03:30:58 +00:00
def is_member?
if (current_user rescue false)
return true
end
return false
end
def is_guest?
if session[:guest_user_id]
return true
end
return false
end
2010-01-18 07:52:52 +00:00
end