[refs #818] fixed some errors

This commit is contained in:
Alexander Machehin 2012-12-29 20:49:28 +06:00
parent 70903249ce
commit 52a2e03fff
3 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@ class User < Avatar
attr_readonly :uname
attr_accessor :login
scope :opened, where('users.role != \'system\'')
scope :opened, where('users.role != \'system\' OR users.role IS NULL')
scope :real, where(:role => ['', nil])
EXTENDED_ROLES.select {|type| type.present?}.each do |type|
scope type.to_sym, where(:role => type)

View File

@ -67,6 +67,6 @@ class ApiDefender < Rack::Throttle::Hourly
end
def system_user? request
authorized?(request) && @user.system?
authorized?(request) && @user.try(:system?)
end
end

View File

@ -33,7 +33,7 @@ describe ApiDefender do
before(:each) do
@user = FactoryGirl.create :user, :password => @password
@system_user = FactoryGirl.create :user, :uname => 'rosa_system'
@system_user = FactoryGirl.create :user, :role => 'system'
end
if APP_CONFIG['anonymous_access'] == true