Ruby Forum Rails Engines > [ANN] mac_engine (oh dot pre-pre-alpha)

Posted by Vincent AE Scott (Guest)
on 06.04.2006 17:15
(Received via mailing list)
Announcing Model Access Control. (pre-alpha)

Purpose:
to provide finer grained control over ActiveRecord results than can be
achieved by using user_engine.  The intention is to provide filtering of
results and assigning permissions to users/groups over what they can
access.

Installation:
Install engines, login_engine and userstamp first.
Then run:
	rake db:migrate:engines ENGINE=mac
	rake mac_bootstrap

Configure your models to use acts_as_macable:

class Thing < ActiveRecord::Base
	acts_as_macable
	...
	...
end

Usage:

p = Person.find_by_username('me'))
[Things] = Thing.find_viewable_by( p )
[Things] = Thing.find_writeable_by( p )

t = Thing.find(1)
a = MacAction.find_by_permission('view')
[true|false] t.user_has_action( p, a )


So far its quite simplistic and lacking a whole chunk of functionality,
but its at an initial stage where I feel happy enough showing it to
everyone else.  More stuff will be added and you can expect some of the
interfaces to change, as i mentioned above its pre-alpha.


How to get it:
 cd $RAILS_ROOT/vendor/plugins
 svn co svn://codex.net/mac_engine/trunk mac_engine


Comments, questions, criticisms and even patches are all welcome :)

-v






--
keys:  http://codex.net/gpg.asc

 University: Establishment formerly for education, now for training
Posted by Martin Scheffler (Guest)
on 06.04.2006 18:52
Vincent AE Scott wrote:
> Announcing Model Access Control. (pre-alpha)
> 

Sounds good, maybe this is just what I am looking for.
Will check it out when I find time.
Can I add find_***able_by functions myself or are they predefined?

Cheers,
Martin