I just did this myself, and in the model you can set up four methods that,
if they return true when a new record is sent to them creates the text for
the link ("edit", "delete", "show", "create new") and then when passed the
actual record if they return true that link is enabled.

This part of the wiki explains it:

http://wiki.github.com/activescaffold/active_scaffold/security

So you should be able to do something like this:

def authorized_for_update?
    #Greys out the associated link when the user isn't the creator or
authorized
    new_record? || current_user.userlimits.find(:first, :conditions =>
"universe_id = #{current_user.current_universe_id}").rights >= 3
end

In this case I have a model called Userlimits that has a column called
rights that is just an integer. If it is a rew record, it returns true so
the "edit" link is shown, but grayed out (and unclickable). This method is
called again and if the current_user has a Userlimit on the current Universe
(basically a container I use to divide story telling elements from unrelated
elements apart) and his rights are equal to or greater than 3, the link is
enabled, otherwise it is still grayed out.

You can do this for each of the 4 crud methods.

Carl

On Wed, Jun 3, 2009 at 3:38 AM, IceD <[email protected]> wrote:

>
> The problem is that we can specify needed links in config section and
> I don't see any way to alter them per-user (e.g. some users can only
> view data, not delete or add).
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to