Displaying 13 results from an estimated 13 matches for "is_logged_in".
2009 Jun 05
6
rails 2.3.2
Hi all,
I am using rails v.2.3.2 and if I put following line to my
ApplicationController:
include LoginSystem
and I moved my login_system.rb to lib folder:
module LoginSystem
protected
def is_logged_in?
@logged_in_user = User.find(session[:user]) if session[:user]
end
def logged_in_user
return @logged_in_user if is_logged_in?
end
def logged_in_user=(user)
if !user.nil?
session[:user] = user.id
@logged_in_user = user
end
end
def self.included(base)
ba...
2009 Apr 29
7
problem with nil.user
...ew code into my app so that an administrator will have
extra privileges (administer users, edit pages). The error is:
''Couldn''t find User without an ID''
So the app is looking for a logged in user when the homepage is
accessed.
Heres my code:
site/index view:
<% if is_logged_in? and logged_in_user.has_role?(''Moderator'') -%>
<%= link_to ''Administer Users'', :controller => ''user'', :action =>
''show'' %>
<%= link_to '' | Edit pages'', pages_path %>
<% end...
2008 Jan 21
7
undefined method error
...al Rails: Social Networking
sites book. In chapter 7 photo gallery I am getting a
NoMethodError in Pages#show
Showing layouts/_menu.rhtml where line #12 raised:
undefined method `new_entry_path'' for #<ActionView::Base:0x52fa56c>
Extracted source (around line #12):
9: <% if is_logged_in? %>
10: <li>Logged in as: <i><%= logged_in_user.username %></i></li>
11: <li><%= link_to ''My Profile'', edit_user_path(logged_in_user)
%></li>
12: <li><%= link_to ''New Blog Post'', new_entry_pa...
2010 Jul 05
1
[PATCH] gettext initiation problem Thanks to Thibault Deloffre <tdeloffre@linagora.com>
...uire 'gettext_rails'
class ApplicationController < ActionController::Base
# FIXME: once all controller classes include this, remove here
include ApplicationService
-# init_gettext "ovirt"
+ init_gettext "ovirt"
layout :choose_layout
before_filter :is_logged_in, :get_help_section
--
1.7.0.1
2010 Mar 31
1
[PATCH] Upgrading the server to work with Rails 2.3.4.
...controller.rb
@@ -25,7 +25,7 @@ class ApplicationController < ActionController::Base
# FIXME: once all controller classes include this, remove here
include ApplicationService
- init_gettext "ovirt"
+# init_gettext "ovirt"
layout :choose_layout
before_filter :is_logged_in, :get_help_section
diff --git a/src/config/environment.rb b/src/config/environment.rb
index 913b9f9..9c1a9fa 100644
--- a/src/config/environment.rb
+++ b/src/config/environment.rb
@@ -20,7 +20,7 @@
# Be sure to restart your web server when you modify this file.
# Specifies gem version of Rails...
2010 May 10
1
Rails/mongrel/httpd issue - F13, rails 2.3.5
...t.par.lng/ovirt/login/login">redirected</a>.</body></html>
and logs :
==> rails.log <==
Processing DashboardController#index (for 10.75.128.51 at 2010-05-10 10:37:25) [GET]
Redirected to http://ovirt.admin.virt.par.lng/ovirt/login/login
Filter chain halted as [:is_logged_in] rendered_or_redirected.
Completed in 5ms (DB: 28) | 302 Found [http://ovirt.admin.virt.par.lng/ovirt/]
==> mongrel.log <==
Mon May 10 10:37:25 +0200 2010: Error calling Dispatcher.dispatch #<NoMethodError: undefined method `[]' for nil:NilClass>
/usr/lib/ruby/gems/1.8/gems/mongrel...
2006 Nov 14
11
RESTful mixin, mixin repo?
Hi,
I just put together a little mixin to provide pseudo-RESTful services
in camping apps. Basically, it looks for a hidden _verb field in form
posts, and sets the @method to the supplied value (e.g. put or delete
- which browsers don''t support). This lets you define put and delete
methods in your controllers. Groovy.
Code:
http://pastie.caboo.se/22613
Is there any permanent repo of
2006 Jan 19
4
Can the session be trusted for Username/password?
I understand that a session is server side, and not externally visible.
For this reason can it be used to store a User class (username/ hashed
password) safely?
Or do I need to check whats in the session against the user table every
time I access a controller?
Many thanks, P.
--
Posted via http://www.ruby-forum.com/.
2008 Mar 01
15
before_filter strange behaviour on update and create
Hi,
I wrote a authentication script and I''m calling it like this in every
class:
class Blah < ApplicationController
before_filter :auth
def auth
req_perm = Permission.find_by_name("Permission Blah")
access = AccessController.new()
if access.is_logged_in(session.session_id)
if
!access.get_current_user(session.session_id).role.permissions.include?
req_perm
redirect_to no_permission_url
end
else
redirect_to login_url
end
end
It works for the view pages but if an update or create is made then it
always redirects to the login_url. Acting lik...
2009 Jul 07
0
[PATCH server] Update app to work with rails 2.3.2
...e all controller classes include this, remove here
- include ApplicationService
-
- # Pick a unique cookie name to distinguish our session data from others'
- session :session_key => '_ovirt_session_id'
- init_gettext "ovirt"
- layout :choose_layout
-
- before_filter :is_logged_in, :get_help_section
-
- # General error handlers, must be in order from least specific
- # to most specific
- rescue_from Exception, :with => :handle_general_error
- rescue_from PermissionError, :with => :handle_perm_error
- rescue_from ActionError, :with => :handle_action_error
- res...
2009 May 15
0
[PATCH server] final cleanup for service layer refactoring.
...te]
- # the following is to facilitate transition to service layer
- before_filter :tmp_pre_update, :only => [:edit, :update, :destroy]
- before_filter :pre_show, :only => [:show]
- before_filter :tmp_authorize_admin, :only => [:new, :edit, :create, :update, :destroy]
before_filter :is_logged_in, :get_help_section
# General error handlers, must be in order from least specific
@@ -83,39 +70,6 @@ class ApplicationController < ActionController::Base
protected
# permissions checking
- def pre_new
- end
- def pre_edit
- end
-
- # FIXME: remove these when service layer trans...
2007 May 10
13
REST own action
I can sent my own action to a users_controller stating in routes.rb
map.resources :users, :member => { :network => get }
I defined in my users_controller the network action....
so I can have an url like
"http://localhost:3000/users/168.xml;network"
now I would like to have another action network_plus which is a little
bit different fron the network..
sure, I can state another
2009 Jul 20
9
Upgrade server to run on Rails 2.3.2/F11
Note that one of the 8 patches (#6) will be sent separately in reply
to this email, as some of the replaced lines are too long, so git
won't let me send the email. However, there is nothing wrong with
that patch, and it should be applied in the sequence listed below.
Note also that I assume this will be tested on a clean f11 install, rather
than an upgrade of an existing ovirt server