cancan Questions

3

Solved

I am implementing Devise and Cancan for user authentication and permissions. Everything works great so far except I am not able to redirect users to the login page when they are not allowed to acce...
Whenever asked 26/12, 2012 at 21:4

2

Solved

New to testing, I'm struggling to get some controller tests to pass. The following controller test throws the error: expecting <"index"> but rendering with <""> I have the followin...
Allerus asked 25/10, 2012 at 19:40

1

Solved

I having quite a bit of troubling getting cancan to authorize my new routes setup below: namespace :api do namespace :v1 do resources :users do resources :user_songs resources :friendships re...
Columnar asked 8/9, 2012 at 20:49

1

Solved

I have an engine mounted to my main app and I want to protect certain controllers and actions within that engine. The engine is mounted with: mount SomeEngine::Engine => '/some_engine' Devis...
Kalliekallista asked 31/8, 2012 at 3:19

1

Solved

I have a large ability file that decides what exactly users can do by searching from a table of 'Roles'. Each role corresponds to something a particular user can do, for example, being able to add ...

2

I have a non-restful controller that I am trying to use the cancan authorize! method to apply permissions to. I have a delete_multiple action that starts like so def delete_multiple @invoices = ...
Winnifredwinning asked 27/3, 2011 at 1:42

2

Solved

I've started a Rails application with Devise and CanCan. I have users which has a one-to-many relationship to articles. I'm new to CanCan, here's what I'm planning to do: Admin can do any action...

3

Solved

A have a bunch of controllers with the Admin namespace. I want to restrict access to these unless the user is an admin. Is there a way to do this using CanCan without having to call unauthorized! i...
Irvingirwin asked 19/1, 2011 at 16:24

1

Solved

Hers is my application.rb class ApplicationController < ActionController::Base protect_from_forgery rescue_from CanCan::AccessDenied do |exception| flash[:error] = "You must first login to ...
Hearttoheart asked 21/6, 2012 at 15:54

2

Solved

Let's say you're writing the software for Blogger. Each user can create a blog post only if they are the owner of the blog. CanCan would normally define an ability check in this circumstance as: ...
Cockneyfy asked 21/2, 2012 at 9:46

3

Solved

I have a controller with a method like; def show if params[:format].eql?("pdf") // do something elsif params[:format].eql?("csv") // do something end end But i have users with different ro...
Admixture asked 27/2, 2012 at 21:4

4

Solved

I have a Post model with a :published attribute (boolean) and a User model with a role attribute (string). There are three roles: ROLES = %w[admin publisher author] I don't want users whose role i...
Cannibalize asked 7/5, 2011 at 14:11

1

Solved

I've written this spec in products_controller_spec.rb, that is intended to test a redirect when destroy is called on a non-existent record: it "deleting a non-existent product should redirect to t...
Alarm asked 17/4, 2012 at 9:55

2

Solved

I'm looking to do pagination with cancan however it's not obvious how to integrate this with gems such as will_paginate. Ideally cancan's load_resource will delegate to will_paginate and add extra...
Georgiana asked 11/5, 2011 at 9:38

2

Solved

I'm using devise and cancan in a Rails 3.2 project. I have an event model with a boolean flag public. If the event is marked as public => true then I want anybody, signed in or not to be able to ac...
Hydatid asked 5/3, 2012 at 20:17

1

Solved

Because anyone can sign up and then log in,... and because a user isn't identified for roles until after log in, doesn't it make sense to skip authorization_check for Devise? Going on that premise...
Tunisia asked 11/8, 2011 at 1:24

1

Solved

When a user in my app isn't an admin user i want to only let them see the fields that they have ownership of. Is there a so set can :see or something like that on a per field basis so that it disp...
Electrodynamics asked 21/12, 2011 at 14:47

2

Solved

Hey I hope you can help me: I was going through this tutorial http://www.tonyamoyal.com/2010/07/28/rails-authentication-with-devise-and-cancan-customizing-devise-controllers/ and I did every step...
Andrea asked 12/1, 2011 at 23:39

1

Solved

I was wondering how I can define an ability class and serve that ability class depending on the user that has logged in. I am using Active Admin, Can Can and Devise and I have successfully created...
Sauer asked 26/10, 2011 at 2:21

3

Solved

I made authentication in my Rails 3 app fallowed by Tony's tutorial I don't want public registrations on my app, just to create new users with Admin account, but I can't create Admin account manua...
Etymologize asked 1/3, 2011 at 2:3

1

Solved

I'm working on a rails project in which I use CanCan to authorize my resources. When a user is not signed in and tries to submit a "talk" (via an ajax form submission), CanCan correctly raises a 40...
Chico asked 6/10, 2011 at 22:41

1

Solved

I want to use CanCan to handle my permissions. My site has many different permissions levels, and most of them are context aware. For instance, Here are the relations in my 3 main models: class Us...
Roeder asked 18/8, 2011 at 4:24

2

Solved

In trying to debug use of cancan i found that if use the following i can get past the accessdenied message: can :manage, Model When i changed it to the following I am denied access: can :read...
Deadlight asked 14/8, 2011 at 14:12

1

I'm using Devise and CanCan for authorization on the frontend of a Rails 3 app. I also have Active Admin as the interface for the backend. I'm trying to create different roles for admins in the bac...
Mordacious asked 20/7, 2011 at 12:2

2

Solved

I'm quite new to this and I'm using cancan + devise for my user auth. However I'm not really sure what it means to set up a typical users HABTM roles relationship nor do I really understand what a ...

© 2022 - 2024 — McMap. All rights reserved.