# Declarative authorization funny problem

**URL:** <https://www.ruby-forum.com/t/declarative-authorization-funny-problem/179207>\
**Category:** Rails\
**Created:** [November 19, 2009, 5:02pm UTC](https://www.ruby-forum.com/t/declarative-authorization-funny-problem/179207 "2009-11-19T17:02:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![a-mj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d07c76/32.png) [@a-mj](https://www.ruby-forum.com/u/a-mj)\
**Post date:** [November 19, 2009, 5:02pm UTC](https://www.ruby-forum.com/t/declarative-authorization-funny-problem/179207/1 "2009-11-19T17:02:05Z")

</div>

Hi! I’m having this problem:  
my declarative authorization gem doesn’t allow the ADMIN even to see the  
index of any page of my application ^^  
i’m explaining better:  
i have, in my user table, a boolean column named “admin”…in my user.rb  
i wrote:  
def role\_symbol  
[:admin] if admin?  
end  
and in my authorization\_rules i have:  
role :admin do  
has\_permission\_on [:artists, :albums, :events, :neews],  
:to =\> [:index, :show, :new, :create, :edit, :update, :destroy]  
end

the problem is that when i login as an admin user(which has admin =  
true) i can’t reach any model which has “filter\_resource\_access” in its  
controller, i see the “You are not allowed to access this action.”  
page…why?  
when i’m not logged in(i’m a guest) it works as i want, i can see  
anything but i can’t edit, create or destroy things…and that’s ok  
Thanks a lot!

---

<div class="post-metadata">

**Author:** ![a-mj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d07c76/32.png) [@a-mj](https://www.ruby-forum.com/u/a-mj)\
**Post date:** [November 19, 2009, 6:43pm UTC](https://www.ruby-forum.com/t/declarative-authorization-funny-problem/179207/2 "2009-11-19T18:43:40Z")

</div>

Saw that simply doesn’t recognise the role of :admin…

Permission denied: User object doesn’t respond to roles (#\<User id: 8,  
username: “a-mj”, email: “removed\_email\_address@domain.invalid”, crypted\_password:  
“200c1e87dca7e8641f029e09c46fda29a64756dec73315adcf6…”, password\_salt:  
“n9TfqFhxfHy0diTrOoiq”, persistence\_token:  
“3b0cd3eb4005fe9d29e57066a20ebdc16d726c1af7bd68aeaef…”, login\_count:  
20, created\_at: “2009-11-12 17:09:59”, updated\_at: “2009-11-19  
17:38:14”, admin: true\>)

So how can i tell him that the admin role is simply an user who has the  
admin value = true ?  
Thank you

---

<div class="post-metadata">

**Author:** ![a-mj](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/d07c76/32.png) [@a-mj](https://www.ruby-forum.com/u/a-mj)\
**Post date:** [November 20, 2009, 1:18pm UTC](https://www.ruby-forum.com/t/declarative-authorization-funny-problem/179207/3 "2009-11-20T13:18:28Z")

</div>

up!!!  
i need help, please!
