Adding ability authorizing in cancan
This commit is contained in:
parent
c80c3bbe5c
commit
f3a05d64c1
|
@ -1,4 +1,5 @@
|
|||
class DoorLogsController < ApplicationController
|
||||
authorize_resource
|
||||
before_filter :authenticate_user!
|
||||
|
||||
# GET /door_logs
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
class UsersController < ApplicationController
|
||||
authorize_resource
|
||||
before_filter :authenticate_user!
|
||||
|
||||
# GET /users
|
||||
|
|
|
@ -2,6 +2,9 @@ class Ability
|
|||
include CanCan::Ability
|
||||
|
||||
def initialize(user)
|
||||
can :manage, User do |u|
|
||||
u.id == user.id
|
||||
end
|
||||
# Define abilities for the passed in user here. For example:
|
||||
#
|
||||
# user ||= User.new # guest user (not logged in)
|
||||
|
|
Loading…
Reference in New Issue
Block a user