Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Devise login and current_user
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Peter Hamilton  
View profile  
 More options May 9 2012, 12:54 am
From: Peter Hamilton <peterghamil...@gmail.com>
Date: Tue, 8 May 2012 22:54:42 -0600
Local: Wed, May 9 2012 12:54 am
Subject: Re: [decl_auth] Devise login and current_user

Since I'm using declarative at the model level, I'm not sure jearlu's
solution will work.

Here's my gross hack... (we've got a demo tomorrow and a slow internal
rollout of the tool, so I'm not super worried about security for now.  I'll
come up will a better solution over the next few days):

  def set_current_user
    Authorization.ignore_access_control true
    Authorization.current_user = current_user
    Authorization.ignore_access_control false
  end

I can hear everyone cringing...

On Tue, May 8, 2012 at 10:36 PM, Edward Rudd <ur...@outoforder.cc> wrote:
> If you look through the archives there is a post I made with a monkey
> patch that solves this without having to give gust the ability to write to
> the user model.

> Sent from my iPad

> On May 8, 2012, at 23:15, Peter Hamilton <peterghamil...@gmail.com> wrote:

> I am having trouble getting Devise login to work.  When the form is
> posted, my before_filter in application_controller.rb assigns
> Authentication.current_user = current_user.  Since current_user is not set
> at this point (as the login has not happened), it uses guest permission
> throughout the request, even though current_user is soon set.

> So I get:

> Authorization::NotAuthorized in Devise::SessionsController#create

> No matching rules found for update for #<Authorization::AnonymousUser:0x007fa09af957d0 @role_symbols=[:guest]> (roles [:guest], privileges [:update, :all], context :users).

> Does anyone have a good solution to deal with this?

>  --
> You received this message because you are subscribed to the Google Groups
> "declarative_authorization" group.
> To post to this group, send email to
> declarative_authorization@googlegroups.com.
> To unsubscribe from this group, send email to
> declarative_authorization+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/declarative_authorization?hl=en.

>  --
> You received this message because you are subscribed to the Google Groups
> "declarative_authorization" group.
> To post to this group, send email to
> declarative_authorization@googlegroups.com.
> To unsubscribe from this group, send email to
> declarative_authorization+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/declarative_authorization?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.