@@ -37,12 +37,12 class GroupBuiltin < Group | |||
|
37 | 37 | class << self |
|
38 | 38 | def load_instance |
|
39 | 39 | return nil if self == GroupBuiltin |
|
40 | instance = order('id').first || create_instance | |
|
40 | instance = unscoped.order('id').first || create_instance | |
|
41 | 41 | end |
|
42 | 42 | |
|
43 | 43 | def create_instance |
|
44 | 44 | raise 'The builtin group already exists.' if exists? |
|
45 | instance = new | |
|
45 | instance = unscoped.new | |
|
46 | 46 | instance.lastname = name |
|
47 | 47 | instance.save :validate => false |
|
48 | 48 | raise 'Unable to create builtin group.' if instance.new_record? |
@@ -294,9 +294,9 private | |||
|
294 | 294 | end |
|
295 | 295 | |
|
296 | 296 | def self.find_or_create_system_role(builtin, name) |
|
297 | role = where(:builtin => builtin).first | |
|
297 | role = unscoped.where(:builtin => builtin).first | |
|
298 | 298 | if role.nil? |
|
299 | role = create(:name => name) do |r| | |
|
299 | role = unscoped.create(:name => name) do |r| | |
|
300 | 300 | r.builtin = builtin |
|
301 | 301 | end |
|
302 | 302 | raise "Unable to create the #{name} role (#{role.errors.full_messages.join(',')})." if role.new_record? |
@@ -750,9 +750,9 class User < Principal | |||
|
750 | 750 | # Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only |
|
751 | 751 | # one anonymous user per database. |
|
752 | 752 | def self.anonymous |
|
753 | anonymous_user = AnonymousUser.first | |
|
753 | anonymous_user = AnonymousUser.unscoped.first | |
|
754 | 754 | if anonymous_user.nil? |
|
755 | anonymous_user = AnonymousUser.create(:lastname => 'Anonymous', :firstname => '', :login => '', :status => 0) | |
|
755 | anonymous_user = AnonymousUser.unscoped.create(:lastname => 'Anonymous', :firstname => '', :login => '', :status => 0) | |
|
756 | 756 | raise 'Unable to create the anonymous user.' if anonymous_user.new_record? |
|
757 | 757 | end |
|
758 | 758 | anonymous_user |
General Comments 0
You need to be logged in to leave comments.
Login now