mdarby / restful_acl Goto Github PK
View Code? Open in Web Editor NEWRails gem/plugin that provides contextual access control to RESTful resources.
Home Page: http://matt-darby.com/search?term=restful_acl
License: MIT License
Rails gem/plugin that provides contextual access control to RESTful resources.
Home Page: http://matt-darby.com/search?term=restful_acl
License: MIT License
@creatable@ is correctly called, @klass@ and @current_user@ is correctly set, but it seems that @parent_object@ is always @nil@, thus forcing @is_creatable_by@ to return @nil@ if the parent object is referenced.
I'm getting the error
undefined method `visit_ActiveSupport_SafeBuffer' for #Arel::Visitors::PostgreSQL:0x29a1b98
whenever the allowed? helper method is called. Not sure if it's just me though, but it worked fine on 3.0.0.
uninitialized constant UrlParser::OpenStruct
Extracted source (around line #122):
119: }
120: </script>
121:
122: <%= allowed?{ link_to 'Sites', sites_path} %>
RAILS_ROOT: /Users/darnellbrawner/workspace/jetty_proj
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in const_missing' /Library/Ruby/Gems/1.8/gems/restful_acl-3.0.3/lib/restful_acl/url_parser.rb:72:in
invoke_url_type_method'
/Library/Ruby/Gems/1.8/gems/restful_acl-3.0.3/lib/restful_acl/url_parser.rb:64:in options_hash' /Library/Ruby/Gems/1.8/gems/restful_acl-3.0.3/lib/restful_acl/helper.rb:5:in
allowed?'
/Users/darnellbrawner/workspace/jetty_proj/app/views/sites/show.html.erb:122:in _run_erb_app47views47sites47show46html46erb' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:34:in
send'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:34:in render' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:306:in
with_template'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/renderable.rb:30:in render' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/template.rb:205:in
render_template'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:265:in render' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:348:in
_render_with_layout'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_view/base.rb:262:in render' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1250:in
render_for_file'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:945:in render_without_benchmark' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:51:in
render'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in ms' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in
ms'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:51:in render' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1326:in
default_render'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1332:in perform_action_without_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:617:in
call_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:638:in run_before_filters' /Users/darnellbrawner/workspace/jetty_proj/app/controllers/application_controller.rb:115:in
widwio'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in send' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/callbacks.rb:178:in
evaluate_method'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:186:in call' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:635:in
run_before_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:615:in call_filters' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:610:in
perform_action_without_benchmark'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in
ms'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in ms' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:160:in perform_action_without_flash' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/flash.rb:146:in
perform_action'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in send' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in
process_without_filters'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:606:in process' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:391:in
process'
/Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:386:in call' /Library/Ruby/Gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:437:in
call'
Hello,
I installed the gem, added config.gem 'restful_acl' in my environment.rb, added the denied route but when I try to start my local server using script/server it fails throwing this :
/Library/Ruby/Gems/1.8/gems/restful_acl-3.0.3/lib/restful_acl/helper.rb:12: syntax error, unexpected ',', expecting '|'
define_method("#{m}able?") do |*args, &block|
Am I missing something ?
Thanks
Marc
When I try to use the allowed? helper in my show.html.erb file, I get this error:
uninitialized constant Edit
The url being protected is a nested resource edit url = /seasons/1/edit
I am using the 3.0.0 gem, and Rails 2.3.4
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Hey Matt,
Firstly, great gem. We have a complex Linux-like permission setup for our users so a typical role-based solution just wouldn't work. I really have two questions and didn't know where else to ask them:
1.) Is there a way I can either write extensions for the view helper you've included (= ?allowed{url}) so I can determine if a link is allowed then do alternate content? For example, if a link isn't allowed for that user, I'd like to show something else, say a span or div instead. Since it's just a view helper, I don't get a return value that I can use in a Ruby conditional. Is there a way to do this as-is, and if not where can I go to extend it? I can't locate the helper.
2.) I like the idea of having RESTful methods that can each return their own boolean to determine authorization, but for our app those methods are unlikely to change from resource to resource. To keep it DRY, I tried sticking those model methods in a module and including it, but having those 2 class methods seems to really be hosing up the works. Do you know another way I can have resources all reference the same 5 methods without using a module?
Thanks again for such a great job.
I am currently trying to put your is_indexable_by() (and so on) rules into a module, but I'm stuck at the problem, that I cannot access the calling object, because it isn't passed as an argument and self within a module always refers to the module itself, but not the object which it is implemented in.
Do you know how to get this done? Maybe a small demo snippet module would do the trick here...
This would make your plugin even more modular, as you can define ACLs globally without hardcoding it in each model :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.