# Restricting user access to certain admin tabs

**URL:** <https://www.ruby-forum.com/t/restricting-user-access-to-certain-admin-tabs/118352>\
**Category:** Radiant CMS\
**Created:** [October 25, 2007, 11:29pm UTC](https://www.ruby-forum.com/t/restricting-user-access-to-certain-admin-tabs/118352 "2007-10-25T23:29:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![travisbell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@travisbell](https://www.ruby-forum.com/u/travisbell)\
**Post date:** [October 25, 2007, 11:29pm UTC](https://www.ruby-forum.com/t/restricting-user-access-to-certain-admin-tabs/118352/1 "2007-10-25T23:29:20Z")

</div>

Hey guys,

Is there a quick and dirty way I can make a certain user type (say  
developer) have access to certain tabs in the admin?

We have some custom extensions we made that we’d like to give a  
customer access to but not the rest of the admin interface.

Thanks,

–  
Travis B.  
Not sent from my iPhone.

---

<div class="post-metadata">

**Author:** ![travisbell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@travisbell](https://www.ruby-forum.com/u/travisbell)\
**Post date:** [October 26, 2007, 10:57am UTC](https://www.ruby-forum.com/t/restricting-user-access-to-certain-admin-tabs/118352/2 "2007-10-26T10:57:44Z")

</div>

Still there is no ACL ([Access-control list - Wikipedia](http://en.wikipedia.org/wiki/Access_control_list))  
support in Radiant.

```
If the tabs are generated by a custom extension, they you may verify

```

there that the logged in user has the rights to use it.

```
 /AITOR

```

---

<div class="post-metadata">

**Author:** ![travisbell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@travisbell](https://www.ruby-forum.com/u/travisbell)\
**Post date:** [October 26, 2007, 12:11pm UTC](https://www.ruby-forum.com/t/restricting-user-access-to-certain-admin-tabs/118352/3 "2007-10-26T12:11:27Z")

</div>

In your extensions you can specify this by adding:

admin.tabs.add “tab name”, “/admin/path/to/tab”, :visibility  
=\> :developer

If you also want to change other tabs, you can add this:

admin.tabs[“tab name”].visibility = [:developer]

Or change :developer to :admin, if you only want the admin to be able  
to change whatever the name of the tab is, for example “Pages”.

Greetings

Hans-Christian Fjeldberg  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![travisbell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@travisbell](https://www.ruby-forum.com/u/travisbell)\
**Post date:** [October 26, 2007, 3:14pm UTC](https://www.ruby-forum.com/t/restricting-user-access-to-certain-admin-tabs/118352/4 "2007-10-26T15:14:08Z")

</div>

Hans-Christian Fjeldberg wrote:

> to change whatever the name of the tab is, for example “Pages”.  
> That will only hide the tabs. It won’t prevent people from getting to  
> the URL. He might try something like this on the controller in the  
> activate method of an extension:

Admin::ControllerName.only\_allow\_access\_to(  
:index, :new, :edit, :remove,  
:when =\> [:admin],  
:denied\_url =\> { :controller =\> ‘page’, :action =\> ‘index’ },  
:denied\_message =\> ‘You must have admin privileges to perform this  
action.’  
)

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![travisbell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@travisbell](https://www.ruby-forum.com/u/travisbell)\
**Post date:** [October 26, 2007, 7:15pm UTC](https://www.ruby-forum.com/t/restricting-user-access-to-certain-admin-tabs/118352/5 "2007-10-26T19:15:51Z")

</div>

Travis B. wrote:

> Interesting little hack.
> 
> I am curious, are their plans to do some basic access control stuff?

Beyond what we already have? Maybe. I’d love to see it extracted into a  
extension somehow so that the system could be replaced with whatever  
flavor your prefer.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![travisbell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@travisbell](https://www.ruby-forum.com/u/travisbell)\
**Post date:** [October 26, 2007, 5:43pm UTC](https://www.ruby-forum.com/t/restricting-user-access-to-certain-admin-tabs/118352/6 "2007-10-26T17:43:28Z")

</div>

Interesting little hack.

I am curious, are their plans to do some basic access control stuff?

Thanks!

–  
Travis B.  
Not sent from my iPhone.

---

<div class="post-metadata">

**Author:** ![travisbell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@travisbell](https://www.ruby-forum.com/u/travisbell)\
**Post date:** [October 27, 2007, 2:23am UTC](https://www.ruby-forum.com/t/restricting-user-access-to-certain-admin-tabs/118352/7 "2007-10-27T02:23:31Z")

</div>

I was looking through the Rails 2.0 stuff and it looks like they have  
overhauled the permissions piece quite a bit. If/when Radiant goes to  
Rails  
2.0 we should get that functionality for “free” right?

Later…  
Richard

---

<div class="post-metadata">

**Author:** ![travisbell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@travisbell](https://www.ruby-forum.com/u/travisbell)\
**Post date:** [October 26, 2007, 7:22pm UTC](https://www.ruby-forum.com/t/restricting-user-access-to-certain-admin-tabs/118352/8 "2007-10-26T19:22:17Z")

</div>

Yes, an extension would be nice… maybe it’s something we can look  
at doing.

Thanks!

–  
Travis B.  
Not sent from my iPhone.

---

<div class="post-metadata">

**Author:** ![travisbell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@travisbell](https://www.ruby-forum.com/u/travisbell)\
**Post date:** [October 27, 2007, 3:00am UTC](https://www.ruby-forum.com/t/restricting-user-access-to-certain-admin-tabs/118352/9 "2007-10-27T03:00:56Z")

</div>

Richard H. wrote:

> I was looking through the Rails 2.0 stuff and it looks like they have  
> overhauled the permissions piece quite a bit. If/when Radiant goes to Rails  
> 2.0 we should get that functionality for “free” right?

I’m not familiar with that. What are you referring to?

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)
