Displaying 20 results from an estimated 300 matches similar to: "cancan breaks scoped mass assignment"
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
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
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
2010 Nov 24
1
NameError in Devise/sessionsController#new
I created a sample application.
Added devise in it, it works fine.
Then added cancan gem into it.
Created an ability class. define some permissions.
Then added line
load_and_authorize_resource
to the Application Controller, after that when i go to the page
http://0.0.0.0:3000/users/sign_in it gave the following error,
NameError in Devise/sessionsController#new
uninitialized constant Session
2011 Mar 02
1
Setting CanCan ability.rs model
I successfully made login system with Devise and CanCan, and I have 3
types of users. Admin, internal and global users. I created
Controllers and index actions: Admin, Cpanel, Report and State, and I
want to restrict access to this controllers for some users.
Admin user should have privilegies to access: Reports(all), State
(read), Admin (all)
Global user should have privilegies to access:
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
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
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
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 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
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\":
2011 Aug 11
1
How to secure file access using Carrierwave + S3 hosted on Heroku
My site is hosted on Heroku and I am using Carrierwave to upload files
to Amazon.
How can i restrict file access based on roles? Is this possible?
Using Devise and CanCan.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To
2013 Feb 14
1
create object after before_filter :authenticate_user!
hi
I use devise and cancan
my model
class PostsController < ApplicationController
before_filter :authenticate_user!, only: [:create, :update, :destroy]
...
end
so an unauthentificate user can access new post form. Now when
unauthentificate user submit new or edit forms, he is redirected to login
form. But when he logs in, his post is not save in database. Is there
anythings to do such
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,
2009 Oct 20
2
Find sub sub records
Hi everyone, I have the following problem, maybe someone can help me
figure out what to do.
To simplify my situation, I''m going to make an example of what I need,
this is not the real app structure.
Let''s suppose we have three models, Library, Author, Book.
Manager
has_and_belongs_to_many :area_managers
AreaManager
has_and_belongs_to_many :managers
has_many :employees
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
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