Displaying 20 results from an estimated 4000 matches similar to: "ACL System restrict_to"
2007 Aug 11
2
Rspec and acl_system2 plugin
Hello,
I''m trying to spec a Rails application using the couple
restful_authentication/acl_system2 plugins.
In my admin layout, I put the following code :
<% restrict_to "admin" do -%>
<ul id="admin-tabs">
<li> /users Users management </li>
</ul>
<% end -%>
Then in my spec file
2007 Jul 06
3
stubbing helper methods for View specs
Hi there
I have several view specs, that include the following snippet in
their "before" block to stub the methods by acts_as_authenticated
before :each do
@u = mock_model(User)
@u.should_receive(:name).and_return("Hans Muster")
template.should_receive(:logged_in?).and_return(true)
template.should_receive(:current_user).and_return(@u)
end
this
2006 Jul 14
1
role-based conditionals
in the Rails Recipes book there is a chapter on role-based
authentication. it basically set up priviliges based on what page the
user was able to access. i went through the chapter and felt like i got
a pretty good understanding of how to do it.
now i am needing something a little more advanced though. instead of a
per page (or action) i would like to have certain sections on a page
either
2006 Feb 21
0
acl_system plugin first look
Friends-
Here is another plugin hot off the presses of the three day
weekend ;) Its a role based authorization system. I have been talking
with Bill Katz about this system so it ties in with his recent
announcement as well. Its just my implementation.
Its an acl/role type system that can sit on top of the
acts_as_authenticated login system or any login system that
implements a few
2006 Jul 16
9
acl_system help is needed
i found Ezra''s acl_system plugin yesterday and i am trying to figure it
out.
based on the simple instructions on the site, it does exactly what i
need but i''m getting some errors when i try to use it:
NoMethodError in UsersController#index
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.roles
i am pretty new to rails and
2008 Jan 21
3
A method accessible from all controllers and views ? How ?
Hi,
I''ve got this method :
def is_admin?
@current_user && @current_user.admin == 1
end
I want to be able to call this method from all my controllers and all my
views.
If I put this method in application_controller I can call it from all my
controllers but none of my views.
If I put this method in application_helper I can call it from all my
views but none of my controllers.
2006 Jun 26
0
How to limit access to model objects based on role?
Hi all,
I want to limit access to model objects based on the role of the logged in
user. It seemed the most blunt way of doing this would be make copies of
each controller which accessed the models and use one of the access control
systems out there to limit access to the controllers. However, with 9
different controllers this seems like a terrible choice.
Here''s what I''ve
2008 Jul 08
4
Conditional "link_to" helper function - AYUDAME POR FAVOR
Hello,
I need to write a function that will return a link only if the current
user is the owner. Here is my code...
1. application_helper.rb
2.
3. def link_to_if_owned(owner_id, anchor_text, where_to_go)
4. if current_user.id == owner_id # current user is owner
5. "#{link_to anchor_text, where_to_go}"
6. else
7. anchor
8. end
9. end
And
2008 Jul 21
0
Re: Listing user jobs
I have been able to list all jobs for a user with the following code:
In application_helper.rb:
def userjobs
userid = current_user.id
@jobs = Job.find(:all, :conditions => { :user_id => userid })
return(@jobs)
end
In application.rb:
helper :application
In qalayout.html.erb:
<% if logged_in? %>
<a href="javascript:;"
2007 May 24
3
Help with Create and Update with options_for_select in a select_tag
I have a select_tag in my view that uses options_for_select with
multiple = true. I am having trouble figuring out the Rails way to
create and update that field. Please help.
Models:
-------------
Service has_many AccessControl
AccessControl belongs_to Service
application.rb
-------------------------
$types = Array["Athens", "htpasswd", "IP", "None",
2006 Mar 22
4
Problem with ACL plugin system
Don''t know if anyone else has experienced this but I''m having a problem
with the access_denied method in Ezra''s ACL access control plugin. It''s
working fine (in conjunction with acts_as_authenticated) until it comes
across a user it denies access to, in which case it throws the following
error:
NoMethodError in Admin#index
protected method
2006 Aug 05
2
acl_system2 undefined method `access_control''
I''ve installed acts_as_authenticated and have that working like a charm
and now would like to add the acl_system2 plugin so I can do some role
based authorization stuff.
I went ahead and installed the plugin like this:
>ruby script\plugin source http://opensvn.csie.org/ezra/rails/plugins/dev/acl_system2
Then I installed the lib and test
>ruby script\plugin install lib
>ruby
2006 Jan 16
16
acts_as_authenticated current_user in a model?
What do I need to do to be able to use an acts_as_authenticated
current_user in a model?
Is there some sort of include or require I can do some where that would
allow this?
**********************************************************
Here is what I am trying to do:
**********************************************************
class Setting < ActiveRecord::Base
before_create :created_by_user #
2007 May 24
1
How do I show the selected values in options_for_select? Not as simple as it sounds.
How do I show the selected values in options_for_select? I have a
Service model and a AccessControl model. When a user edits a Service I
want the services access_controls to be pre-selected.
Models:
Service has_many AccessControls
AccessControl belongs_to Service
application.rb:
$types = Array["Athens", "htpasswd", "IP", "None", "Other",
2007 Oct 04
0
Prototyping the Dir class
Hi all,
I''ve been prototyping a Windows-only Dir class for Ruby. Below is what
I''ve got so far. The class methods were easy, except for Dir.glob. The
code in dir.c is just nasty, and I can''t help but think that it could be
heavily refactored. I did come across this link:
http://www.codeproject.com/file/fileglob.asp
But I haven''t investigated it yet. Anyone
2006 Dec 20
0
[Xense-devel] [PATCH] [3/4] Flask XSM tools
This patch implements the Flask tools for the xen control plane (xm &
xend). The patch also refactors the ACM toolchain so that a common
security API (based on the existing ACM toolchain) is exported to xm and
xend.
To create a domain with the Flask module, add the following (for
example) to a domain''s configuration file
access_control =
2006 Nov 27
2
ActionMailer & application_helper.rb
Hi,
I''m trying to send some emails with the same formatting as my pages & I
can''t seem to access my display routines in application_helper.rb. I''m
trying a hack to bypass this.
At the top of my ActionMailer notifier script I''ve included
application_helper.rb - my understanding is that this should arrive as a
module and should be able to be used
2006 Mar 06
20
How painful is the 1.0 -> 1.1 upgrade going to be?
Does anyone have a sense for how painful the 1.0 -> 1.1 upgrade is
going to be for existing apps? I''m finishing up my first real RoR
application with Rails 1.0. I can live with it staying at that level,
but I really want to use the has_many :through attribute to clean up
some of my code.
I''m not particularly interested in edge Rails, mainly because the
documentation for
2005 Jul 22
3
testing application_helper.rb
I am trying to run some functional (or are they unit?) tests on my
application_helper.rb. So far, I''ve not had any success in being able
to call the methods defined in application_helper.rb.
Here is my app/test/functional/helpers.rb
require File.dirname(__FILE__) + ''/../test_helper''
require File.dirname(__FILE__) +
2006 Sep 29
1
yielding consecutive values
I''m not sure if someone has already addressed this issue, but if not,
here goes.
I need the following behavior:
def test_generate(documentation = ''/test_documentation/'',
destination = ''/destination/'')
yield_results = [''/'', ''filename.yaml'', ''blah.xml'']