[refs #818] fixed some errors
This commit is contained in:
parent
70903249ce
commit
52a2e03fff
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue