# Suggestions wanted for non-logged-in user in closed beta pha

**URL:** <https://www.ruby-forum.com/t/suggestions-wanted-for-non-logged-in-user-in-closed-beta-pha/62827>\
**Category:** Rails\
**Created:** [June 8, 2006, 4:31pm UTC](https://www.ruby-forum.com/t/suggestions-wanted-for-non-logged-in-user-in-closed-beta-pha/62827 "2006-06-08T16:31:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Chris\_T](https://www.ruby-forum.com/u/Chris_T)\
**Post date:** [June 8, 2006, 4:31pm UTC](https://www.ruby-forum.com/t/suggestions-wanted-for-non-logged-in-user-in-closed-beta-pha/62827/1 "2006-06-08T16:31:05Z")

</div>

Will shortly be deploying first iteration of app to some beta testers  
(i.e. friends), and want them to be able see it both from logged-in view  
and guest (i.e. not logged-in) view. The two are a fair bit different.  
It’s a closed beta, so (hopefully) no pages (other than a blank login  
page) will be visible.

The question is, what’s the best way for them to be able to see (and  
test) the app in guest mode. Have two layers of auth (the app’s and an  
external one), set up a group role that simulates guest access (not wild  
about this since it will mean changing the ACL setup after it’s done).

Any other ideas, opinions?

---

<div class="post-metadata">

**Author:** ![Chris\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Chris\_T](https://www.ruby-forum.com/u/Chris_T)\
**Post date:** [June 8, 2006, 9:39pm UTC](https://www.ruby-forum.com/t/suggestions-wanted-for-non-logged-in-user-in-closed-beta-pha/62827/2 "2006-06-08T21:39:33Z")

</div>

Chris T wrote:

> Will shortly be deploying first iteration of app to some beta testers  
> (i.e. friends), and want them to be able see it both from logged-in view  
> and guest (i.e. not logged-in) view. The two are a fair bit different.  
> It’s a closed beta, so (hopefully) no pages (other than a blank login  
> page) will be visible.
> 
> The question is, what’s the best way for them to be able to see (and  
> test) the app in guest mode. Have two layers of auth (the app’s and an  
> external one), set up a group role that simulates guest access (not wild  
> about this since it will mean changing the ACL setup after it’s done).
> 
> Any other ideas, opinions?

No-one?

---

<div class="post-metadata">

**Author:** ![Chris\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Chris\_T](https://www.ruby-forum.com/u/Chris_T)\
**Post date:** [June 8, 2006, 9:57pm UTC](https://www.ruby-forum.com/t/suggestions-wanted-for-non-logged-in-user-in-closed-beta-pha/62827/3 "2006-06-08T21:57:34Z")

</div>

On 8-Jun-06, at 12:39 PM, Chris T wrote:

> > test) the app in guest mode. Have two layers of auth (the app’s  
> > and an  
> > external one), set up a group role that simulates guest access  
> > (not wild  
> > about this since it will mean changing the ACL setup after it’s  
> > done).
> > 
> > Any other ideas, opinions?
> 
> No-one?

Hi Chris,

it’s kind of a vague question that requires an answer specific to  
your code 🙂

Have you considered using basic-auth at the webserver level to  
protect access to the site as a whole with a beta-site access password?

Regards,  
Trevor

–  
Trevor S.  
[http://somethinglearned.com](http://somethinglearned.com)

---

<div class="post-metadata">

**Author:** ![Chris\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Chris\_T](https://www.ruby-forum.com/u/Chris_T)\
**Post date:** [June 8, 2006, 11:59pm UTC](https://www.ruby-forum.com/t/suggestions-wanted-for-non-logged-in-user-in-closed-beta-pha/62827/4 "2006-06-08T23:59:12Z")

</div>

Trevor S. wrote:

> > > The question is, what’s the best way for them to be able to see (and  
> > > Hi Chris,
> 
> it’s kind of a vague question that requires an answer specific to your  
> code 🙂
> 
> Have you considered using basic-auth at the webserver level to protect  
> access to the site as a whole with a beta-site access password?
> 
> Regards,  
> Trevor  
> Yup, that’s what I was thinking of when I said two layers of auth. Not  
> terribly elegant or pretty though. I guess I just put the htdigest file  
> in the public directory?

---

<div class="post-metadata">

**Author:** ![Chris\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Chris\_T](https://www.ruby-forum.com/u/Chris_T)\
**Post date:** [June 9, 2006, 12:30am UTC](https://www.ruby-forum.com/t/suggestions-wanted-for-non-logged-in-user-in-closed-beta-pha/62827/5 "2006-06-09T00:30:11Z")

</div>

On 8-Jun-06, at 2:56 PM, Chris T wrote:

> > Trevor  
> > Yup, that’s what I was thinking of when I said two layers of auth.  
> > Not terribly elegant or pretty though. I guess I just put the  
> > htdigest file in the public directory?

Well, it’s been _years_ since I did basic-auth so I can’t say off the  
top of my head - likely it’ll be specific to your webserver.

## Regards, Trevor

Trevor S.  
[http://somethinglearned.com](http://somethinglearned.com)

---

<div class="post-metadata">

**Author:** ![Chris\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a8b319/32.png) [@Chris\_T](https://www.ruby-forum.com/u/Chris_T)\
**Post date:** [June 9, 2006, 12:36am UTC](https://www.ruby-forum.com/t/suggestions-wanted-for-non-logged-in-user-in-closed-beta-pha/62827/6 "2006-06-09T00:36:48Z")

</div>

Chris,

I recently had a similar situation and solved it simply this way.  
Basically it’s just another filter layer that

— [environment.rb] —

module YOUR\_APP  
PREVIEW\_KEY = ‘your\_app\_007’  
end

— [application.rb] —

class ApplicationController \< ActionController::Base

def ensure\_covertness  
return true if request.env[‘SERVER\_NAME’].nil? ||  
request.env[‘SERVER\_NAME’].include?(‘localhost’)  
if session[:preview\_key] != YOUR\_APP::PREVIEW\_KEY  
redirect\_to :controller =\> ‘index’, :action =\> ‘preview’ and  
return false  
else  
true  
end  
end

end

— [index\_controller.rb] —  
class IndexController \< ApplicationController

before\_filter :ensure\_covertness, :except =\> :preview

def preview  
if request.post? && params[:code] == YOUR\_APP::PREVIEW\_KEY  
session[:preview\_key] = YOUR\_APP::PREVIEW\_KEY  
redirect\_to :action =\> ‘index’  
else  
render :layout =\> false  
end  
end

end

— [preview.rhtml] —

Preview

\<%= start\_form\_tag %\>  
\<%= password\_field\_tag ‘code’ %\>  
\<%= submit\_tag ‘Submit’ %\>  
\<%= end\_form\_tag %\>

Now put this line in every controller as the first line or better yet  
in a base PublicController (for your public pages) and  
SecureController for those pages where the user must be logged in.

before\_filter :ensure\_covertness

Hope this helps,  
Zack
