Merge branch 'master' of github.com:zyphlar/Open-Source-Access-Control-Web-Interface
Conflicts: .gitignore Gemfile Gemfile.lock app/controllers/door_logs_controller.rb app/controllers/users_controller.rb app/models/user.rb app/views/door_logs/download.html.erb app/views/door_logs/show.html.erb app/views/layouts/application.html.erb app/views/users/show.html.erb app/views/users/upload.html.erb app/views/users/upload_all.html.erb config/environments/development.rb config/environments/production.rb config/routes.rb db/schema.rb
This commit is contained in:
35
app/models/ability.rb
Normal file
35
app/models/ability.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
class Ability
|
||||
include CanCan::Ability
|
||||
|
||||
def initialize(user)
|
||||
if user.admin?
|
||||
can :manage, :all
|
||||
else
|
||||
can :read, User do |u|
|
||||
u.id == user.id
|
||||
end
|
||||
end
|
||||
# Define abilities for the passed in user here. For example:
|
||||
#
|
||||
# user ||= User.new # guest user (not logged in)
|
||||
# if user.admin?
|
||||
# can :manage, :all
|
||||
# else
|
||||
# can :read, :all
|
||||
# end
|
||||
#
|
||||
# The first argument to `can` is the action you are giving the user permission to do.
|
||||
# If you pass :manage it will apply to every action. Other common actions here are
|
||||
# :read, :create, :update and :destroy.
|
||||
#
|
||||
# The second argument is the resource the user can perform the action on. If you pass
|
||||
# :all it will apply to every resource. Otherwise pass a Ruby class of the resource.
|
||||
#
|
||||
# The third argument is an optional hash of conditions to further filter the objects.
|
||||
# For example, here the user can only update published articles.
|
||||
#
|
||||
# can :update, Article, :published => true
|
||||
#
|
||||
# See the wiki for details: https://github.com/ryanb/cancan/wiki/Defining-Abilities
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,15 @@
|
||||
class User < ActiveRecord::Base
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
# Include default devise modules. Others available are:
|
||||
# :token_authenticatable, :confirmable,
|
||||
# :lockable, :timeoutable and :omniauthable
|
||||
devise :database_authenticatable, :registerable,
|
||||
:recoverable, :rememberable, :trackable, :validatable
|
||||
|
||||
# Setup accessible (or protected) attributes for your model
|
||||
attr_accessible :email, :password, :password_confirmation, :remember_me
|
||||
>>>>>>> 03d99741e5b661e63f6281115d2db333082a09b1
|
||||
require 'open-uri'
|
||||
|
||||
attr_accessible :card_id, :card_number, :card_permissions, :name
|
||||
|
||||
Reference in New Issue
Block a user