Displaying 20 results from an estimated 1100 matches similar to: "Setting CanCan ability.rs model"
2011 Jun 05
1
Cancan redirect back at AccessDenied
Hello
I have a rails 3 app and I am trying to implement the redirect back
action at access denied for cancan.
If I try this in my application_controller:
rescue_from CanCan::AccessDenied do |exception|
redirect_to :back
end
It gives the following error:
No HTTP_REFERER was set in the request to this action, so
redirect_to :back could not be called successfully. If this is a test,
make sure
2012 Mar 30
1
cancan breaks scoped mass assignment
Hi all,
I just installed cancan on a new project and found out that it creates
some problems with the new scoped mass assignment features of rails 3.2
.
Basically, in my User model I create some attr_accessible attributes in
order to avoid users to edit their roles or other sensitive information.
From the administration I allow admins to edit those protected
attributes by passing
2013 Nov 22
2
Cancan Rspec load_and_authorize_resource
Hello!
While running bundle exec rake, I receive following error (see in
attached file)
However, my tests are steel passing with command rspec spec/controllers/
Some info:
ads_controller.rb:
class AdsController < ApplicationController
load_and_authorize_resource except: :create
end
ads_controller_spec.rb:
require ''spec_helper''
describe AdsController do
render_views
2010 Dec 02
8
CanCan issue when being very specific
So I got CanCan and Devise working well. I have two types of users:
Admins and Nonadmins. Admins can edit all of Nonadmins profiles.
The problem is, every user (either Admin or Nonadmin) belongs to an
Account or Organization. Admins should only be able to edit users from
their own Account or Organization. I was able to do that too.
The problem is, I can''t display the Create New User
2000 Mar 28
3
password problem -- or bug?
A Redhat 6.0 linux server with Samba 2.0.6, Windows 95/98 clients.
By accident I just discovered a surprising and quite disappointing
password problem on our Samba network.
If a user on our network has a non-empty Windows password,
he is forced to supply his password to log in to the network and
gain writing privilegies -- as expected.
However, if the user has an empty Windows password, he is
2001 Dec 24
11
Traffic balancing by IP.
Hello all!
As far as I know that the traffic that will pass thru the router is balanced
so that all connections have the same privilegies. Is it possible to
configure the linux based router so that all computers will have the same
privilegies? I mean that if in default case full traffic is splitted by
connections, so I need to split it by users to prevent one user occupy all
traffic by starting
2014 Mar 25
0
Looking for some glue between Strong Parameters and CanCan
Hello Rails World,
does anybody know a good solution for Strong Parameters in a Rails app
authorized by Cancan (or a similar authorization gem)?
def user_params
if current_user.admin?
params.require(:user).permit!
else
params.require(:user).permit(:password, :password_confirmation)
end
end
Now I want to do this the "Cancan way". My first idea looks strange to me:
def
2014 Mar 25
0
cancan gem being replaced
I just came across this so I thought I would post it on this board since I
see cancan come up a lot. It seems that Ryan Bates (who is primarily
responsible for cancan) is taking a hiatus and the gem is no longer being
actively maintained. The collaborators on that gem have formed a new team
and have released the gem cancancan which is now cancan updated for Rails
4. You read more about it
2011 Nov 28
4
getting a subdomain name in model.
Hi all,
I am facing problem in getting subdomain name inside the model. The
following is my setup.
I am using cancan for authorization.I wanted a specific condition in
Ability.rb ( the file which is placed in models if we install cancan gem).
Below is the condition I wanted:
=========================================================
user ||= User.new # guest user (not logged in)
if
2011 Jul 28
0
CanCan filtering meta_search results?
At the moment, I am running meta_search, and then filtering through
CanCan after I have a set of results. Is there any other way to
restrict the returned objects within the initial search query?
def index
@search =
User
.search :first_name_or_last_name_or_practice_name_or_role_contains_any
=> params[:search].to_s.split('' '')
@users =
2012 Mar 06
0
Devise/Cancan Signout User On Controller Action
I have implemented Devise for Authentication and Authorization in ROR
application everything seems fine but getting one issue. I have two
modals "Account" and "Transactiona" , and so two controllers
respectively.
My Transaction Index view call one of Account Controller method like
this
2012 Oct 02
0
cancan and authorization on controller actions of a gem.
Hello.
I''ve installed cancan and bigbluebutton_rails,
https://github.com/mconf/bigbluebutton_rails.
The gem bigbluebutton_rails has some models and controllers, for
example has bigbluebutton/servers_controller.rb.
This controller has some actions like create, join, authorize, etc.
I want that only users with role admin can create.
What can I do?
I need to put load_resource in
2012 Oct 15
0
CanCan load_resource get a nil resource
Hi,
I''ve opened a question on StackOverflow regarding #load_resources and
a create action in UserController:
http://stackoverflow.com/questions/12882284/load-resource-get-a-nil-resource
Could anyone please give me some hints?
thank you!
enrico
--
· Enrico Stano
·
· twitter @enricostano
· skype ocirneonats
--
You received this message because you are subscribed to the Google
2012 Apr 05
5
rspec: identical tests fails when repeated
I''m doing RSpec controller testing with CanCan authorization, and I''m
seeing something I''ve never seen in RSpec before: the same test run
twice fails on the second one. I am NOT doing before(:all) or other
things that should cause state to persist between tests:
Here''s the relevant code:
context "POST create" do
context "with user logged
2003 Oct 10
0
ADMNISTRATOR PRIVILEGIES ON SAMBA 2.2.8 PDC
Hello guruz.
I have big trouble. I installed SAMBA 2.2.8 from 2.2.3a. My problem is about
administrator privilegies. When I log on some WIN2k workstation as root of
SAMBA domain I have no admin privilegies as domain administrator(remote
admin any workstation, shares modify, policy modify ...). It worked well
before. I was finding solution 2 mounth but without some solution. I have no
idea why
2013 Feb 20
3
Complex abilities and scoping of records
I have the following scenario.
Users have various levels of ability. They can only view and edit
their own records (their profile). Their managers can only view and
edit their employees records. The regional managers can view and edit
only the people in their regions and the corporate headquarters can
view and edit all records. There are multiple regions so somebody
can be the manager of the
2011 Aug 09
2
Devise AssociationTypeMismatch
My site is using Devise and Cancan. Currently I have 3 roles setup
I am testing creating a new user using the following command (role is
required):
curl -H "Content-Type:application/json" -H "Accept:application/json" -
d "{\"user\":{\"email\":\"test01-J0of1frlU80@public.gmane.org\", \"role\":\"2\", \"name\":
2012 Oct 09
8
unexpected should_receive behaviour
Hi,
surely I''m missing something... but what!?
in my spec I''ve
User.should_receive(:find).with("1").and_return(@user)
and in my controller
User.find(params[:id])
green light... correct...
but if I change my controller using another method, for example first:
User.first
or even
User.all
I get green light too... I was expecting an error like
expected: 1 time
2010 May 19
4
R in sandbox/jail (long question)
Hello,
I have a setup similar to Rweb ( http://www.math.montana.edu/Rweb/ ):
I get R scripts from users and need to execute them in in a safe manner (they are executed automatically, without human inspection).
I would like to limit the user's script to reading from STDIN and writing to STDOUT/ERR.
Specifically, preventing any kind of interaction with the underlying operating system (files,
2010 Jun 02
5
user routing versus admin routing strategies?
In an app where ordinary users are limited to viewing and editing their
own "stuff", but someone with admin privs can view and edit anybody''s
stuff, what''s the right strategy for routing?
At first blush, I''d think that an ordinary user (e.g. with id 565)
should see something like:
http://example.com/mystuff.html
... where the controller assumes