I'd probably change it so the manager doesn't set a password, but
instead the create sends a key in email to the user which then can set
the password (very much like the reset password lifecycle).  But you
might not be in a situation were having the manager knowing the user
password is bad.

On Oct 20, 8:10 pm, oillio <[email protected]> wrote:
> Thanks Bryan, that question solved it for me.  I had forgotten I
> overrode main-nav in front_site.dryml.
>
> FYI- If anyone runs into this and is allowing logged in users to
> create new users, it is not as simple as I described.
> Simply allowing access to the standard create functionality for models
> does not cut it for users as this won't set the password.
> Additionally I wanted to set the managed_by belongs_to field on
> creating, and I couldn't use the :creator flag because it screws up a
> normal guest signup.
> I ended up creating a new lifecycle create function that looks like
> this:
>     create :new_managed, :available_to => "User",
>            :params =>
> [:name, :email_address, :password, :password_confirmation],
>            :become => :active,
>            :user_becomes => :managed_by
>
> I had to create my own link to it in the users index view.  But it
> works great.
>
> On Oct 19, 9:15 am, Bryan Larsen <[email protected]> wrote:
>
> > oillio wrote:
> > > Funny how you always find a solution just after you post the question.
> > > I fixed it by changing my permissions to:
> > > def view_permitted?(field)
> > >   return true if nil == id && acting_user.manager?
> > >   acting_user == self || acting_user.administrator? || managed_by_is?
> > > (acting_user)
> > > end
>
> > > But I still don't get why view_permitted? is getting called on a new
> > > user.
>
> > This is standard behaviour.  It makes sense why view_permitted is called
> > on update.  The argument for create is a little less solid, but I'm sure
> > Tom had a reason when he did it.
>
> > > I am also having a problem getting a Users tab to appear in my
> > > navigation bar.  My main-nav tag in pages.dryml shows a Users nav-
> > > item.  But it does not actually show up on my page...  What could be
> > > going wrong?
>
> > Where and how are you overriding main-nav?  Please post your code.
>
> > thanks,
> > Bryan
--~--~---------~--~----~------------~-------~--~----~
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