On Nov 16, 2010, at 8:03 PM, tommy wrote:

> Hi Guys,
> I want users to be anonymous on my site, so I set the following in the
> user model...
> 
>  def view_permitted?(field)
>    acting_user.administrator? || (acting_user == self) ||
> self.id==nil
>  end
> 
> But then the reset password page using the forgot password link shows
> no fields.
> 
> So I've done the following:
> 
>  def view_permitted?(field)
>    acting_user.administrator? || (acting_user == self) || self.id ==
> nil || field == :password || field == :password_confirmation
>  end
> 
> Which just feels wrong.  Is this the best way to handle this problem?
> Is it possible to check the key from view_permitted?
> 

You may want to try using "lifecycle.valid_key?" (without quotes) as part of 
that conditional. I *think* the key has already been attached to the model by 
the time the permissions methods get called.

--Matt Jones


-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to