# Login-engine restrict by role?

**URL:** <https://www.ruby-forum.com/t/login-engine-restrict-by-role/53647>\
**Category:** Engines\
**Created:** [February 13, 2006, 2:09am UTC](https://www.ruby-forum.com/t/login-engine-restrict-by-role/53647 "2006-02-13T02:09:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryantate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e56c9b/32.png) [@ryantate](https://www.ruby-forum.com/u/ryantate)\
**Post date:** [February 13, 2006, 2:09am UTC](https://www.ruby-forum.com/t/login-engine-restrict-by-role/53647/1 "2006-02-13T02:09:00Z")

</div>

OK, I haven’t been able to figure out the answer to this reading over  
the login-engine docs.

I’ve got login-engine set up on a rails app of mine that is a  
rudimentary bug tracker. Great.

Trouble is, any schmoe who hits my site can sign up for an account in  
a few seconds, and I don’t want just any schmoe to be able to see my  
bug database. I only want people I explicitly authorize to be able to  
see the bug database.

So – how do I make it so that a registered user has to have a  
particular “role” (I saw this column in the schema) to be able to  
access certain pages?

---

<div class="post-metadata">

**Author:** ![ryantate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e56c9b/32.png) [@ryantate](https://www.ruby-forum.com/u/ryantate)\
**Post date:** [February 13, 2006, 5:17am UTC](https://www.ruby-forum.com/t/login-engine-restrict-by-role/53647/2 "2006-02-13T05:17:21Z")

</div>

On 2/12/06, Ryan T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> So – how do I make it so that a registered user has to have a  
> particular “role” (I saw this column in the schema) to be able to  
> access certain pages?

It looks like what I want is to override def authorize, although I’m  
not quite sure yet where to put my own version of authorize.

And it looks like I may want to install user-engine to get the  
scaffolding I want to setup Roles.

---

<div class="post-metadata">

**Author:** ![ryantate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e56c9b/32.png) [@ryantate](https://www.ruby-forum.com/u/ryantate)\
**Post date:** [February 13, 2006, 10:55am UTC](https://www.ruby-forum.com/t/login-engine-restrict-by-role/53647/3 "2006-02-13T10:55:30Z")

</div>

The ‘role’ column in the schema is vestigial, and was present in the  
SHLG upon which the login engine is heavily, heavily based. It will be  
snipped out in the next version.

On 2/13/06, Ryan T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> * * *
> 
> engine-users mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org](http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org)

–

- J \*  
~

---

<div class="post-metadata">

**Author:** ![ryantate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e56c9b/32.png) [@ryantate](https://www.ruby-forum.com/u/ryantate)\
**Post date:** [February 13, 2006, 4:53pm UTC](https://www.ruby-forum.com/t/login-engine-restrict-by-role/53647/4 "2006-02-13T16:53:56Z")

</div>

I had what I think is a similar issue. Search the archives for my  
name and login engine.

On 2/12/06, Ryan T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> So – how do I make it so that a registered user has to have a  
> particular “role” (I saw this column in the schema) to be able to  
> access certain pages?
> 
> * * *
> 
> engine-users mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org](http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org)

–  
Greg F.  
The Norcross Group  
Forensics for the 21st Century

---

<div class="post-metadata">

**Author:** ![ryantate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e56c9b/32.png) [@ryantate](https://www.ruby-forum.com/u/ryantate)\
**Post date:** [February 13, 2006, 11:38pm UTC](https://www.ruby-forum.com/t/login-engine-restrict-by-role/53647/5 "2006-02-13T23:38:45Z")

</div>

On 2/12/06, Ryan T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> And it looks like I may want to install user-engine to get the  
> scaffolding I want to setup Roles.

This did it. It had everything I needed. I just don’t give the base  
User role any powers by default (beside changing his own name and  
password), and give people who should have access a certain role  
manually.

Kind of a pain to install on top of login-engine, however. It didn’t  
want to make my one existing user (me) admin, despite following the  
instructions on config options, so I stopped trying to make that work  
and re-bootstrapped so it made the default “admin” login (with a  
default password) , signed in as “admin,” promoted myself to  
administrator, then deleted the “admin” account.

---

<div class="post-metadata">

**Author:** ![ryantate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e56c9b/32.png) [@ryantate](https://www.ruby-forum.com/u/ryantate)\
**Post date:** [February 13, 2006, 11:42pm UTC](https://www.ruby-forum.com/t/login-engine-restrict-by-role/53647/6 "2006-02-13T23:42:21Z")

</div>

Feel free to supply a patch which will ‘promote’ an existing user…

- james

On 2/13/06, Ryan T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Kind of a pain to install on top of login-engine, however. It didn’t  
> want to make my one existing user (me) admin, despite following the  
> instructions on config options, so I stopped trying to make that work  
> and re-bootstrapped so it made the default “admin” login (with a  
> default password) , signed in as “admin,” promoted myself to  
> administrator, then deleted the “admin” account.
> 
> * * *
> 
> engine-users mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org](http://lists.rails-engines.org/listinfo.cgi/engine-users-rails-engines.org)

–

- J \*  
~
