Groups
Groups
Sign in
Groups
Groups
acl9-discuss
Conversations
About
Send feedback
Help
Self ownership
8 views
Skip to first unread message
Kevin Monk
unread,
Jan 8, 2011, 3:50:52 PM
1/8/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to acl9-discuss
It is possible to add access control that allows the current_user to
access the user show action it they are that user!?
Something like
UsersController <AC::BAse
access_control do
allow :admin
# allow if the current_user is @user, :to => [:show]
deny anonymous, :except => [:new]
end
def index
@users = User.all
..
end
def show
@user = User.find(params[:id])
...
end
end
I could set up lots of self ownership roles on create but that seems
really messy i.e.
@user = User.create!(params[:user])
@user.has_role!(:owner, @user)
SHould I just forget ACL9 for this part and user a before_filter?
oleg dashevskii
unread,
Jan 9, 2011, 10:00:46 AM
1/9/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to acl9-d...@googlegroups.com
Hi Kevin,
here's an example
allow all, :to => :show, :if => :me?
private
def me?
current_user == @user
end
2011/1/9 Kevin Monk
<
ke...@mangoswiss.com
>
--
Олег.
Kevin Monk
unread,
Jan 10, 2011, 5:04:28 AM
1/10/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to acl9-discuss
Simple when you put it like that! :)
Thanks Oleg.
Reply all
Reply to author
Forward
0 new messages