Questions tagged [cancan]

The CanCan gem offers a straight forward and flexible way to define what a user can and cannot do.

CanCan is an authorization library for Ruby on Rails which restricts what resources a given user is allowed to access.

CanCan uses a model to define the abilities of a user. Inside the class you declare what a user can and cannot do by using the “can” method. From your controllers you use the "can?" method to test the current user's authorization.

As development on CanCan is no longer active, it has been continued on under the new name CanCanCan.

Wiki

1405 questions
-1
votes
2 answers

Rails, CanCan manage all & other roles

class Ability include CanCan::Ability def initialize(user) @user = user || User.new can :manage, :all can :custom_action, User, role: 'admin' end end and in view if can? :custom_action, @user SHOW SOMETHING this if always show…
Alex808
  • 106
  • 1
  • 10
-1
votes
1 answer

How to provide CanCan ability for "view purchased field"?

I'm building a website where people can buy & watch video online. Paid users will see video, others will see only description & buy now button. There is an "Order" model, with "LineItems" pointing to videos. I am using "Video" resource, devise…
-1
votes
2 answers

CANCAN => Admin + Agent + User

Need Help! :) Use Case: Admin can create another admin when he have role of "SuperAdmin", Admin Can also Create "Agents" Roles for Admin Model: SuperAdmin Admin Admin can create both the roles can create "Agents" Agent can create "User" but he…
Syed
  • 15,657
  • 13
  • 120
  • 154
-2
votes
1 answer

Rails, CanCan and Rolify: Postresql error

Question for people who knows Rails with Cancan and Rolify gem. I want to understand how i can get list of user, that have some roles for (for example, Company). Here is description with code and detailed…
user1859243
  • 295
  • 1
  • 5
  • 11
-2
votes
1 answer

Guest user permissions with Rails and CanCan

Do I need to define permissions for creating user for guest? I mean can he sign up with out this permissions?
zergood
  • 711
  • 1
  • 10
  • 15
-2
votes
1 answer

How to implement the dynamic authorization with CanCan?

i am following this tutorial http://eveloverails.wordpress.com/2011/04/02/183/. I have created the users through devise and i want when the user log in as an admin he should have the list of users in which it can edit the permissions of the users…
Mohd Anas
  • 634
  • 1
  • 9
  • 22
-2
votes
2 answers

Open source projects to learn CanCan gem

Is there any good open source project which has Can Can implemented completely.
-2
votes
2 answers

string handling in Ruby on Rails bring difficulties

I am using Cancan In my user model there is ROLES = %w[admin user ram] I want to bring the value from my own module . all= Role.all @all.each do |all| all.name end Here i can carry all value that are in database from roll model. and i want to…
regmiprem
  • 735
  • 2
  • 14
  • 41
-3
votes
1 answer

How do I use CanCan to classify customers after they signed in?

The below is my class Ability. It means if you are admin you can do everything, else you just can read. But i don't know how to classify customers after they signed in? If you have any suggestion pls help me! class Ability include…
-4
votes
1 answer

What is a RESTful style resource?

I'm implementing cancan into my Rails 4 app. The documentation states "load_and_authorize_resource method is provided to automatically authorize all actions in a RESTful style resource controller." https://github.com/ryanb/cancan What is a RESTful…
ed_is_my_name
  • 601
  • 3
  • 9
  • 24
1 2 3
93
94